GCP.CloudBuild reference
AccessReadToken
Section titled “AccessReadToken”Source:
src/GCP/CloudBuild/AccessReadToken.ts
Runtime binding for Cloud Build v2 repositories.accessReadToken.
Bind this operation to a Repository in a Function/Action init
phase. Provide AccessReadTokenHttp. Returns a short-lived token
that can clone the remote Git repository.
AccessReadToken: Fetching a Read Token
Section titled “AccessReadToken: Fetching a Read Token”const accessReadToken = yield* GCP.CloudBuild.AccessReadToken(source);const { token, expirationTime } = yield* accessReadToken();AccessReadTokenHttp
Section titled “AccessReadTokenHttp”Source:
src/GCP/CloudBuild/AccessReadTokenHttp.tsKind: Layer · Provides:GCP.CloudBuild.AccessReadToken
HTTP implementation of AccessReadToken.
AccessReadWriteToken
Section titled “AccessReadWriteToken”Source:
src/GCP/CloudBuild/AccessReadWriteToken.ts
Runtime binding for Cloud Build v2 repositories.accessReadWriteToken.
Bind this operation to a Repository in a Function/Action init
phase. Provide AccessReadWriteTokenHttp. Returns a short-lived
token that can clone and push to the remote Git repository.
AccessReadWriteToken: Fetching a Read/Write Token
Section titled “AccessReadWriteToken: Fetching a Read/Write Token”const accessReadWriteToken = yield* GCP.CloudBuild.AccessReadWriteToken(source);const { token, expirationTime } = yield* accessReadWriteToken();AccessReadWriteTokenHttp
Section titled “AccessReadWriteTokenHttp”Source:
src/GCP/CloudBuild/AccessReadWriteTokenHttp.tsKind: Layer · Provides:GCP.CloudBuild.AccessReadWriteToken
HTTP implementation of AccessReadWriteToken.
Connection
Section titled “Connection”Source:
src/GCP/CloudBuild/Connection.ts
A Cloud Build v2 connection to a source-control host (GitHub, GitHub Enterprise, GitLab, Bitbucket Data Center, or Bitbucket Cloud).
Changing connectionId or location replaces the connection. Switching
SCM kinds, or changing immutable host fields (hostUri, workspace,
webhookSecretSecretVersion), also replaces. disabled and
annotations update in place.
Cloud Build connections have no labels. Alchemy stores ownership in
annotations (alchemy-stack / alchemy-stage / alchemy-id) so
list / pnpm nuke:gcp can find them.
Connection: Creating a Connection
Section titled “Connection: Creating a Connection”Generated GitHub connection
const github = yield* GCP.CloudBuild.Connection("Github", { githubConfig: {},});Named GitHub connection with installation
const github = yield* GCP.CloudBuild.Connection("Github", { connectionId: "app-github", location: "us-central1", annotations: { env: "prod" }, githubConfig: { appInstallationId: "123456", authorizerCredential: { oauthTokenSecretVersion: "projects/{project}/secrets/github-pat/versions/latest", }, },});Connection: Disabling a Connection
Section titled “Connection: Disabling a Connection”const github = yield* GCP.CloudBuild.Connection("Github", { connectionId: "app-github", githubConfig: {}, disabled: true,});Connection: GitLab
Section titled “Connection: GitLab”const gitlab = yield* GCP.CloudBuild.Connection("Gitlab", { gitlabConfig: { webhookSecretSecretVersion: "projects/{project}/secrets/gitlab-webhook/versions/latest", readAuthorizerCredential: { userTokenSecretVersion: "projects/{project}/secrets/gitlab-read/versions/latest", }, authorizerCredential: { userTokenSecretVersion: "projects/{project}/secrets/gitlab-api/versions/latest", }, },});FetchGitRefs
Section titled “FetchGitRefs”Source:
src/GCP/CloudBuild/FetchGitRefs.ts
Runtime binding for Cloud Build v2 repositories.fetchGitRefs.
Bind this operation to a Repository in a Function/Action init
phase. Provide FetchGitRefsHttp.
FetchGitRefs: Listing Branches
Section titled “FetchGitRefs: Listing Branches”Fetch branch names
const fetchGitRefs = yield* GCP.CloudBuild.FetchGitRefs(source);const { refNames } = yield* fetchGitRefs({ refType: "BRANCH" });Fetch tags
const { refNames } = yield* fetchGitRefs({ refType: "TAG", pageSize: 50 });FetchGitRefsHttp
Section titled “FetchGitRefsHttp”Source:
src/GCP/CloudBuild/FetchGitRefsHttp.tsKind: Layer · Provides:GCP.CloudBuild.FetchGitRefs
HTTP implementation of FetchGitRefs.
Repository
Section titled “Repository”Source:
src/GCP/CloudBuild/Repository.ts
A Cloud Build v2 repository — links a remote Git repository to a
Connection.
Changing repositoryId, connection, location, remoteUri, or
annotations replaces the repository. There is no update API; every
user-facing field is immutable.
Cloud Build repositories have no labels. Alchemy stores ownership in
annotations (alchemy-stack / alchemy-stage / alchemy-id) so
list / pnpm nuke:gcp can find them.
Repository: Creating a Repository
Section titled “Repository: Creating a Repository”Generated name
const github = yield* GCP.CloudBuild.Connection("Github", { githubConfig: {},});const source = yield* GCP.CloudBuild.Repository("Source", { connection: github.name, remoteUri: "https://github.com/{owner}/{repo}.git",});Named repository with annotations
const source = yield* GCP.CloudBuild.Repository("Source", { connection: github.name, repositoryId: "app-source", remoteUri: "https://github.com/{owner}/{repo}.git", annotations: { env: "prod" },});Repository: Fetching Git Refs
Section titled “Repository: Fetching Git Refs”const fetchGitRefs = yield* GCP.CloudBuild.FetchGitRefs(source);const { refNames } = yield* fetchGitRefs({ refType: "BRANCH" });Repository: Cloning with a Token
Section titled “Repository: Cloning with a Token”const accessReadToken = yield* GCP.CloudBuild.AccessReadToken(source);const { token } = yield* accessReadToken();