Fix mirror step failing after a successful copy#59
Merged
Conversation
The mirror summary block ended with:
[ -n "${referrers_note}" ] && echo "${referrers_note}"
On the standard (non-referrer) mirror path referrers_note is empty, so the
test returns non-zero. As the final command in the step under `set -e`, that
non-zero status failed the job even though the image copied successfully
("Copied. New destination digest..."). It only surfaced when an actual copy
happened; when digests matched the step short-circuited with exit 0.
Replace the `[ ... ] && echo` shorthand with an `if`, which returns 0 when
referrers_note is empty.
Fixes the failure in mirror / quarantine/python (run 27183374610).
There was a problem hiding this comment.
Pull request overview
Fixes a failure mode in the reusable image mirroring workflow where a successful copy could still end the job with exit code 1 due to the final summary-writing command returning non-zero under set -euo pipefail.
Changes:
- Replace a trailing
[ ... ] && echo ...summary line with anifblock so an emptyreferrers_notedoesn’t fail the step. - Add an in-script comment documenting why the
ifform is required underset -e.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Problem
The scheduled
mirror / quarantine/pythonrun #27183374610 failed after the image copied successfully — the log showsCopied. New destination digest: sha256:c845af93…immediately followed by##[error]Process completed with exit code 1.Root cause
The job summary block in
_mirror-image.ymlended with:On the standard mirror path (no
copy_referrers),referrers_noteis empty, so[ -n "" ]returns a non-zero status. Because this was the final command in the step running underset -euo pipefail, that non-zero status became the step's exit code and failed the job — despite a successful copy.It only surfaced now because the bug requires an actual copy to happen: when the source and destination digests matched, the step short-circuited earlier with
exit 0. Thepython:3.14-slimupstream update changed the digest, triggering a real copy and exposing the latent bug.Fix
Replace the
[ ... ] && echoshorthand with anif, which returns 0 whenreferrers_noteis empty:Validation
shellcheck -S warningpasses on the main script step (the only remaining finding is the known SC2296 false positive on the${{ }}login step).[ ... ] && cmdtrailing-command hazards remain in the file.referrers_note, so theechoruns either way).