fix(ci): make test build work on pull requests from forks - #173
fix(ci): make test build work on pull requests from forks#173Ganeshkumar Ashokavardhanan (ganeshkumarashok) wants to merge 1 commit into
Conversation
VerificationThe CI run on this PR passes, but it runs from a branch on this repo, so secrets are present and it does not exercise the fallback. To validate the actual failing configuration I ran a controlled A/B in a fork with no repository secrets (identical to the
Control reproduced the reported error exactly: Treatment built every image against the placeholder: Notes:
|
ci.yaml tags the test image with ${{ secrets.AZURE_REGISTRY_SERVER }}. Secrets
are not exposed to `pull_request` workflows triggered from a fork, so on those
runs the expression resolves to an empty string and the tag becomes
`/public/aks/<repo>:<version>`, which buildx rejects:
ERROR: failed to build: invalid tag
"/public/aks/aks-gpu-cuda:595.71.05-...": invalid reference format
Every build job then fails within seconds, so pull requests from forks get no
build signal at all and the red checks are indistinguishable from a genuine
breakage.
Fall back to a placeholder registry when the secret is unavailable. ci.yaml
only builds images -- it never runs azure/login, az acr login, or docker push
(verified: zero occurrences of each) -- so the registry portion of the tag is
not meaningful here. It only has to be a syntactically valid reference for
buildx to accept.
Runs that do have the secret are unaffected and keep tagging exactly as before,
since `||` returns the first truthy operand.
Rebased onto main so the fallback lives in the `env:` blocks introduced by the
workflow expression-injection fix (d97b02b), rather than inline in the
`docker buildx build` arguments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e525ff6d-7072-4f71-92b9-4d5a87808b20
0a4b3df to
e40bb9f
Compare
|
Rebased onto current REGISTRY_SERVER: ${{ secrets.AZURE_REGISTRY_SERVER || 'localhost:5000' }}Applied to all three build jobs ( End-to-end validation under the real failure conditionRather than add noise here, I dispatched So the tag is now valid, the build runs to completion, and a real image is produced — versus today's instant Live example of the bug this fixes: #178 (a fork PR, now superseded by #179) failed all six build jobs in seconds, with the Other checks
|
Problem
ci.yamltags the test image with${{ secrets.AZURE_REGISTRY_SERVER }}. Secrets are not exposed topull_requestworkflows triggered from a fork, so on those runs the expression resolves to an empty string and the tag becomes/public/aks/<repo>:<version>, which buildx rejects:All six build jobs then fail within seconds. Pull requests from forks get no build signal at all, and the red checks are indistinguishable from a genuine breakage — which makes fork PRs hard to review.
This is long-standing rather than new. For example #161 (from a fork) failed this way, while #159 passed only because that run had
Secret source: Actions.Fix
Fall back to a placeholder registry when the secret is unavailable:
-t ${{ secrets.AZURE_REGISTRY_SERVER || 'localhost:5000' }}/public/aks/...This workflow only builds images — it never runs
azure/login, never runsaz acr login, and never runsdocker push(verified: zero occurrences of each inci.yaml). The registry portion of the tag is therefore not meaningful here; it only has to be a syntactically valid reference for buildx to accept.Runs that do have the secret are unaffected and keep tagging exactly as before, since
||returns the first truthy operand and a populated secret is truthy.Validation
actionlint: 7 pre-existing SC2086 findings onmain, 7 on this branch — identical, no new findings introduced.localhost:5000/public/aks/...(valid), secret present gives<registry>/public/aks/...(unchanged from today).ci.yamlwhere the registry secret is consumed, and it is build-only.Note
This is intentionally independent of #172 (the workflow expression-injection fix). Both touch the same
docker buildx buildlines, so whichever merges second will need a trivial conflict resolution — in #172 the fallback simply moves into theenv:block asREGISTRY_SERVER: ${{ secrets.AZURE_REGISTRY_SERVER || 'localhost:5000' }}.