Skip to content

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

@vraiti

Description

@vraiti

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleIssue or PR with no activity for extended period of time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions