Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't concurrently build boot images for multiple architectures #545

Open
vraiti opened this issue Jul 15, 2024 · 0 comments
Open

Can't concurrently build boot images for multiple architectures #545

vraiti opened this issue Jul 15, 2024 · 0 comments

Comments

@vraiti
Copy link

vraiti commented Jul 15, 2024

It appears that bootc gets confused if you try to build the same image for two architectures concurrently using the --target-arch option.

I have the following script to produce a multi-arch manifest of disk image artifacts from bootc image builder:

WDIR=/home/vraiti/scrap
URL=quay.io/flightctl/flightctl-agent-rhel
DST_URL=quay.io/vraiti/artifacts:parallel
cd $WDIR
buildah manifest create bootc-images

for ARCH in amd64 arm64; do
for FORMAT in qcow2 raw; do

  echo "$WDIR/run-bib.sh $ARCH $FORMAT $URL:bootstrap > $ARCH-$FORMAT.log" >> args

done
done

cat args | xargs -I CMD --max-procs=4 bash -c CMD
buildah manifest push --all bootc-images docker://$DST_URL

This is the run-bib.sh script:

#!/usr/bin/env bash

ARCH=$1
FORMAT=$2
URL=$3

OUTPUT="$ARCH-$FORMAT"
mkdir $OUTPUT

sudo podman run --rm \
  -it \
  --privileged \
  --pull=newer \
  --security-opt label=type:unconfined_t \
  -v $(pwd)/$OUTPUT:/output \
  -v /var/lib/containers/storage:/var/lib/containers/storage \
  quay.io/centos-bootc/bootc-image-builder:latest \
  --type $FORMAT \
  --target-arch $ARCH \
    "$URL"    

if [ -f $OUTPUT/image/disk.raw ]; then
  OUTPUT=$OUTPUT/image/disk.raw
else
  OUTPUT=$OUTPUT/qcow2/disk.qcow2
fi

buildah manifest add bootc-images \
  --artifact $OUTPUT \
  --artifact-type application/vnd.diskimage+$FORMAT \
  --os $FORMAT \
  --arch $ARCH

Running this script will either produce

error: cannot build manifest: image found is for unexpected architecture "aarch64" (expected "x86_64"), if that is intentional, please make sure --target-arch matches

or

error: cannot build manifest: image found is for unexpected architecture "x86_64" (expected "aarch64"), if that is intentional, please make sure --target-arch matches

And the corresponding architecture fails to build.

If I remove -v /var/lib/containers/storage:/var/lib/containers/storage \, then the script works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant