diff --git a/hack/overlay-main-images.sh b/hack/overlay-main-images.sh index 2e6c4a1c4..6e8feafd2 100755 --- a/hack/overlay-main-images.sh +++ b/hack/overlay-main-images.sh @@ -141,7 +141,9 @@ bare_ref_line='^[^[:space:]#][^[:space:]]*/[^[:space:]]+$' # under an image key, taking the line from that has the same key and # indentation, an @sha256: digest and the same first-party image, i.e. a path # ending in /cozystack/. Exactly one such line must exist; two are -# ambiguous and none means build-main did not stamp it. Every other line of +# ambiguous, and none means build-main did not stamp it, or the key moved +# (another indentation or parent) or the image was renamed on main since the +# PR's merge commit. Every other line of # stays as the PR has it. # # The trade-off is deliberate. A bare first-party ref that does exist (an older @@ -299,8 +301,10 @@ echo "Overlay current-main images: overlaid=$overlaid same=$same skipped(rebuilt # cost three unrelated PRs, one round each. if [ "$drift" -gt 0 ]; then drift_pkgs=$(echo "$drift_files" | tr ' ' '\n' | grep -v '^$' | sort -u) - printf '::warning title=Image overlay drift::%s package(s) kept committed release refs, so they run release images in this lane rather than current main: %s\n' \ - "$(printf '%s\n' "$drift_pkgs" | wc -l | tr -d ' ')" \ + except="" + [ "$bare" -eq 0 ] || except=" (bare first-party refs excepted, see Image overlay bare refs)" + printf '::warning title=Image overlay drift::%s package(s) kept committed release refs%s, so they run release images in this lane rather than current main: %s\n' \ + "$(printf '%s\n' "$drift_pkgs" | wc -l | tr -d ' ')" "$except" \ "$(printf '%s' "$drift_pkgs" | tr '\n' ' ' | sed 's/ $//')" fi # Among those, a package whose bare first-party ref took main's image runs that diff --git a/hack/overlay-main-images_test.bats b/hack/overlay-main-images_test.bats index 4059f9ea1..68438ffa5 100644 --- a/hack/overlay-main-images_test.bats +++ b/hack/overlay-main-images_test.bats @@ -527,6 +527,7 @@ load test_helper fi grep -q 'bare first-party ref in packages/system/proxy/values.yaml -> current-main' "$w/out.txt" grep -q '::warning title=Image overlay bare refs::1 drifted package(s) .*: system/proxy$' "$w/out.txt" + grep -q '::warning title=Image overlay drift::1 package(s) kept committed release refs (bare first-party refs excepted, see Image overlay bare refs), .*: system/proxy$' "$w/out.txt" grep -q 'bare-refs=1' "$w/out.txt" rm -rf "$w" }