feat(gitops): add an Artifact Registry push target - #509
Closed
lucaghersi wants to merge 1 commit into
Closed
lucaghersi wants to merge 1 commit into
lucaghersi wants to merge 1 commit into
Conversation
artifact-registry: true switches the push to europe-docker.pkg.dev/staffbase-artifacts/images-publish and authenticates with a service account key instead of the Harbor credentials, which are ignored when it is set. A key rather than Workload Identity Federation, because a job's permissions cannot be raised from inside a called workflow: adding id-token: write here would fail every caller that has not granted it. The key needs no permission, so a service migrates by passing one secret. The condition is negated on each expression rather than selecting an empty string on the true branch, because empty is falsy and would fall through to the Harbor value. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
2 tasks
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Let a service push to Google Artifact Registry instead of Harbor by changing two lines in its own workflow.
The registry becomes
europe-docker.pkg.devanddocker-imageis prefixed with the publish repository, sosb-images/my-serviceis pushed aseurope-docker.pkg.dev/staffbase-artifacts/images-publish/sb-images/my-service.docker-username/docker-passwordare ignored when it is set.Default is
false, so nothing changes for anyone until they opt in.How to review
inputs.artifact-registry && '' || secrets.docker-passwordwould not blank the password: empty is falsy in a GitHub expression, so it falls through to the Harbor value. Hence!inputs.artifact-registry && secrets.docker-password || ''.docker-imageis prefixed rather than replaced, so a service that overrides it keeps its own name.Why a key and not Workload Identity Federation
WIF is set up and preferred, but a called workflow cannot raise the caller's permissions — adding
permissions: id-token: writehere would fail every caller that has not granted it. The key needs no permission, so a service migrates without touching itspermissionsblock.Services that grant
id-token: writecan pass the provider and account togitops-github-actiondirectly today; aworkload-identity: trueinput here is the natural follow-up once some have.Before merging
2c7f44d08b1e3e03357a10cfd703bea1c55051c9, the head of feat(auth): support Workload Identity Federation for Artifact Registry gitops-github-action#163, markedUNRELEASED. That PR must merge and be tagged first.GCP_ARTIFACT_PUBLISHER_KEYis Terraform-managed. Note it is set toprivatevisibility there — a public repository opting in would need that changed toall.Rollback
Remove the two lines from the service. Pulls are unaffected in both directions, because the
imagesrepository serves Harbor as an upstream.🤖 Generated with Claude Code