ci: Gate the Legacy Mirror Behind an Environment - #328
Merged
Merged
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The legacy-namespace mirror reads
LEGACY_GHCR_TOKEN, a credential that can write packages under another account. As a repository secret read from inside the build job, every workflow in this repository can reach it, including one added on any branch.This moves the mirror into its own job that declares the
legacy-mirrorenvironment, in bothimages.yamland the reusabledocker-build-workflow.yaml. Once the secret lives on that environment rather than the repository, only workflows running on the branches the environment allows can read it. Published images and tags are unchanged.How it works
The mirror job recomputes the image names from the owner and the matrix, so it needs nothing from the build job beyond ordering. Its guards are unchanged: it skips when the legacy owner matches the publishing owner, and warns and exits 0 when the secret is missing.
Separating it also isolates failure.
continue-on-errornow sits on the job, so a mirror problem — including an environment that refuses the branch — leaves the publish green.Turning it on
legacy-mirror, with a deployment branch policy allowingmainand tags, and no required reviewers (reviewers would stall every image build).LEGACY_GHCR_TOKENas an environment secret there, and delete the repository-level secret. Until that move, the job still reads the repository secret and the gate does nothing.write:packagesand nodelete:packages, and an expiry matching the deprecation window.Testing
actionlint1.7.7 reports nothing new; the only findings are the pre-existingdocker/login-action@v2warnings.build→mirror, withmirrorcarryingenvironment: legacy-mirror,continue-on-error: trueand thevars.LEGACY_GHCR_OWNER != ''guard.ghcr.io/librechat-ai/librechat-rag-api-dev:{abc1234,latest}to the matchingghcr.io/danny-avila/...tags.