/registry-credentials stores encrypted credentials for pulling private task images. It supports
Google Artifact Registry (GAR), GitHub Container Registry (GHCR), and Amazon Elastic Container
Registry (ECR).
The examples below use $BASE and $KEY. Get a key from
Harbor Hub API Key.
Storing a Credential
POST /registry-credentials validates the credential, encrypts it, and returns metadata without ever
returning the secret. Every request takes a registry_host and a display_name of at most 100
characters, which is how jobs later select the credential. The provider is inferred from the host, so
provider is optional; if you do send it, it has to agree with the host.
A GAR credential:
roles/artifactregistry.reader scoped to that repository.
A GHCR credential:
read:packages.
An ECR credential:
ASIA, are rejected because they need a session token that
Harbor does not store.
A successful response looks like:
display_name returns 409 replacement_required with the existing record’s
fingerprint; confirm it with supersede_credential_id exactly as with secrets. Each organization can
hold at most 20 active registry credentials.
For GAR, build the request from the service account file to avoid shell quoting problems:
Listing and Revoking Registry Credentials
GET /registry-credentials lists active credentials and returns metadata only. Use status=revoked
or status=all to include other states.
DELETE /registry-credentials revokes a credential by default. Set purge to true only when the
stored record should be permanently deleted.
Using a Credential In a Job
Pin a stored credential by display name or ID inregistry_credentials, as a sibling of config:
us-east1-docker.pkg.dev, use the stored credential named
prod-puller. Keys have to be supported registry hosts, and you can send at most 20 entries.
If exactly one active credential is available for a host you can leave registry_credentials out
entirely. When several match, the launch has to pick one by display name, credential ID, or the
owner-qualified display name Harbor shows.
