Skip to content

GCP.ArtifactRegistry reference

Source: packages/gcp/src/ArtifactRegistry/ListDockerImages.ts

Runtime binding for Artifact Registry dockerImages.list.

Bind this operation to a Repository in a Function/Action init phase. Provide ListDockerImagesHttp.

const listImages = yield* GCP.ArtifactRegistry.ListDockerImages(images);
const page = yield* listImages({ pageSize: 50 });

Source: packages/gcp/src/ArtifactRegistry/ListDockerImagesHttp.ts Kind: Layer · Provides: GCP.ArtifactRegistry.ListDockerImages

HTTP implementation of ListDockerImages.

Source: packages/gcp/src/ArtifactRegistry/RepositoriesAttachment.ts

Artifact Registry metadata attached to a repository, package, or version. An attachment points at one or more files already stored in the repository.

Attachments have no update API — any change replaces the resource. Alchemy stamps ownership into annotations so list / nuke can find them.

RepositoriesAttachment: Creating a RepositoriesAttachment

Section titled “RepositoriesAttachment: Creating a RepositoriesAttachment”
const attachment = yield* GCP.ArtifactRegistry.RepositoriesAttachment(
"Sbom",
{
repository: artifacts.name,
target: artifacts.name,
type: "application/spdx+json",
files: [sbomFileName],
annotations: { env: "prod" },
},
);

RepositoriesAttachment: Looking up an existing repositories attachment

Section titled “RepositoriesAttachment: Looking up an existing repositories attachment”

RepositoriesAttachment.lookup references a repositories attachment Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared repositories attachment.

const repositoriesAttachment = GCP.ArtifactRegistry.RepositoriesAttachment.lookup({
attachmentId: "my-attachment",
repository: "my-repository",
});

Source: packages/gcp/src/ArtifactRegistry/RepositoriesPackagesTag.ts

An Artifact Registry package tag — an alternate name for a version.

Tags have no labels field. list / nuke find tags whose parent repository carries Alchemy labels. Changing repository, packageId, location, or tagId replaces the tag. version updates in place.

The package and version must already exist (for example a Docker image digest). Generic repositories reject tag create with HTTP 501.

RepositoriesPackagesTag: Creating a RepositoriesPackagesTag

Section titled “RepositoriesPackagesTag: Creating a RepositoriesPackagesTag”

Point stable at a version

const tag = yield* GCP.ArtifactRegistry.RepositoriesPackagesTag("Stable", {
repository: images.name,
packageId: "app",
tagId: "stable",
version: "sha256:abc123",
});

Move the tag to a new version

const tag = yield* GCP.ArtifactRegistry.RepositoriesPackagesTag("Stable", {
repository: images.name,
packageId: "app",
tagId: "stable",
version: "sha256:def456",
});

RepositoriesPackagesTag: Looking up an existing repositories packages tag

Section titled “RepositoriesPackagesTag: Looking up an existing repositories packages tag”

RepositoriesPackagesTag.lookup references a repositories packages tag Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared repositories packages tag.

const repositoriesPackagesTag = GCP.ArtifactRegistry.RepositoriesPackagesTag.lookup({
tagId: "my-tag",
repository: "my-repository",
packageId: "my-package",
});

Source: packages/gcp/src/ArtifactRegistry/RepositoriesRule.ts

An Artifact Registry download rule on a repository.

Download rules are a Preview API. Each repository may have one repository-level rule and one rule per package. Changing repository, location, or ruleId replaces the rule. action, operation, packageId, and condition update in place.

Rules have no labels field. Alchemy stamps ownership into condition.title so list / pnpm nuke:gcp can find them.

RepositoriesRule: Creating a RepositoriesRule

Section titled “RepositoriesRule: Creating a RepositoriesRule”

Deny all downloads

const rule = yield* GCP.ArtifactRegistry.RepositoriesRule("Deny", {
repository: images.name,
action: "DENY",
});

Allow a package except old versions

const rule = yield* GCP.ArtifactRegistry.RepositoriesRule("AllowApp", {
repository: images.name,
action: "ALLOW",
packageId: "app",
condition: { expression: "pkg.version.id >= '1.0.0'" },
});

RepositoriesRule: Looking up an existing repositories rule

Section titled “RepositoriesRule: Looking up an existing repositories rule”

RepositoriesRule.lookup references a repositories rule Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared repositories rule.

const repositoriesRule = GCP.ArtifactRegistry.RepositoriesRule.lookup({
ruleId: "my-rule",
repository: "my-repository",
});

Source: packages/gcp/src/ArtifactRegistry/Repository.ts

An Artifact Registry repository for Docker images, language packages, or generic artifacts.

Changing repositoryId, location, format, mode, kmsKeyName, or Maven version policy replaces the repository.

Generated name

const images = yield* GCP.ArtifactRegistry.Repository("Images", {});

Explicit id, format, and labels

const images = yield* GCP.ArtifactRegistry.Repository("Images", {
repositoryId: "app-images",
location: "us-central1",
format: "DOCKER",
description: "container images",
labels: { env: "prod" },
dockerConfig: { immutableTags: true },
});

Repository: Looking up an existing repository

Section titled “Repository: Looking up an existing repository”

Repository.lookup references a repository Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared repository.

const repository = GCP.ArtifactRegistry.Repository.lookup({
repositoryId: "my-repository",
});