Skip to content

Commit b537810

Browse files
committed
Compare the image config when checking for a platform
The platform check used regctl manifest get --platform, which only selects an entry inside a manifest list. Against a plain manifest it succeeds whatever platform is asked for: an arm64-only tag answers yes to linux/amd64, and to linux/ppc64le for that matter. The tags this check exists for are plain manifests. skopeo copy without --all writes a single manifest, so an amd64-only tag left behind by an earlier run is exactly the case that slipped through, and the check went on skipping the push it was added to allow. regctl image config resolves the platform and reports the architecture it actually found, so comparing that against the requested platform distinguishes the two. Signed-off-by: Abrar Shivani <ashivani@nvidia.com>
1 parent cb2b095 commit b537810

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/precompiled.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ function imageExistsForAllTargetPlatforms(){
102102
imageExists "$image" || return 1
103103
local platform
104104
for platform in $(targetPlatforms); do
105-
# unlike --list, --platform fails when the manifest list carries no entry for that platform
106-
regctl manifest get "$image" --platform "$platform" > /dev/null || return 1
105+
# manifest get --platform only selects within a manifest list; against a
106+
# single manifest it succeeds for any platform, so compare the config.
107+
[ "$(regctl image config "$image" --platform "$platform" --format '{{.OS}}/{{.Architecture}}' 2>/dev/null)" = "$platform" ] || return 1
107108
done
108109
return 0
109110
}

0 commit comments

Comments
 (0)