Skip to content

Commit cb2b095

Browse files
committed
Promote a precompiled tag that is missing an architecture
pushImage skipped the push whenever the destination tag already existed, and imageExists only asked regctl whether the tag resolved at all. regctl manifest get --list succeeds for any manifest list, no matter which platforms it contains, and FORCE_PUSH is not set anywhere in this repository, so the skip always won. That is harmless while a distribution is amd64 only, but ubuntu24.04 and now ubuntu26.04 build both architectures. Once an amd64-only tag existed at the destination, the arm64 instance could never be published: every later run saw the tag, skipped, and reported success. The check now probes each platform the build targets with regctl manifest get --platform, which fails when the manifest list has no entry for it, and pushes when any of them is missing. push runs as a separate invocation from build, so the platform set has to be recomputed rather than carried over; both paths now read it from targetPlatforms so they cannot disagree about which distributions and kernel flavors are multi-arch. Distributions that stay single-arch keep the old behaviour, since targetPlatforms is empty for them and only the tag existence check runs. Signed-off-by: Abrar Shivani <ashivani@nvidia.com>
1 parent ba64f09 commit cb2b095

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

scripts/precompiled.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,19 @@ function buildBaseImage(){
4141
make DRIVER_BRANCH=${DRIVER_BRANCH} KERNEL_FLAVOR=${KERNEL_FLAVOR} build-base-${BASE_TARGET}
4242
}
4343

44-
function buildImage(){
44+
function targetPlatforms(){
4545
# linux-objects-nvidia-*-azure-fde is published for amd64 only.
4646
if [[ "$DIST" == "signed_ubuntu24.04" || "$DIST" == "signed_ubuntu26.04" ]] \
4747
&& [[ "$KERNEL_FLAVOR" != "azure-fde" ]]; then
48-
export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64,linux/arm64"
48+
echo "linux/amd64 linux/arm64"
49+
fi
50+
}
51+
52+
function buildImage(){
53+
local platforms
54+
platforms=$(targetPlatforms)
55+
if [ -n "$platforms" ]; then
56+
export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=${platforms// /,}"
4957
fi
5058
make DRIVER_VERSIONS=${DRIVER_VERSIONS} DRIVER_BRANCH=${DRIVER_BRANCH} build-${DIST}-${DRIVER_VERSION}
5159
}
@@ -63,7 +71,7 @@ function pushImage(){
6371
# note: DIST is in the form "signed_<distribution>", so we drop the '*_' prefix
6472
# to extract the distribution string.
6573
local out_image=${OUT_IMAGE_NAME}:${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST##*_}
66-
if imageExists "$out_image"; then
74+
if imageExistsForAllTargetPlatforms "$out_image"; then
6775
echo "image tag already exists in output registry - $out_image"
6876
if [ "$FORCE_PUSH" != "true" ]; then
6977
echo "exiting"
@@ -89,6 +97,17 @@ function imageExists(){
8997
regctl manifest get $1 --list > /dev/null && return 0 || return 1
9098
}
9199

100+
function imageExistsForAllTargetPlatforms(){
101+
local image=$1
102+
imageExists "$image" || return 1
103+
local platform
104+
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
107+
done
108+
return 0
109+
}
110+
92111
case $1 in
93112
build)
94113
buildBaseImage

0 commit comments

Comments
 (0)