test-bootc-build

centos-automotive-suite's avatarfrom centos-automotive-suite

Run a bootc build test and report results. Builds a bootc container image, optionally creates a disk image, and downloads the artifact.

⭐0stars🔀3forks📁View on GitHub🕐Updated Jan 6, 2026

When & Why to Use This Skill

This Claude skill automates the end-to-end workflow for building, testing, and reporting on bootc container and disk images. It streamlines the development cycle by managing OpenShift authentication, monitoring build progress in real-time, and automatically downloading generated artifacts like QCOW2 images. Additionally, it features intelligent debugging capabilities that extract and analyze logs from PipelineRuns to identify common failure patterns, significantly reducing the time spent on manual troubleshooting in automotive and edge computing development environments.

Use Cases

  • Automated Image Building: Streamline the creation of bootable container images and disk images (QCOW2, RAW) for edge devices and automotive systems.
  • CI/CD Pipeline Integration: Execute and validate bootc build tests as part of a continuous integration suite to ensure image consistency and manifest validity.
  • Automated Debugging and Log Analysis: Rapidly diagnose build failures by automatically retrieving logs from OpenShift/Tekton pods and filtering for common error patterns like 'unauthorized' or 'invalid reference'.
  • Artifact Distribution: Automate the process of pushing images to registries and downloading local copies for virtualization and hardware-in-the-loop (HIL) testing.
nametest-bootc-build
descriptionRun a bootc build test and report results. Builds a bootc container image, optionally creates a disk image, and downloads the artifact.

Bootc Build Test Workflow

Run a bootc build with the specified parameters, monitor until completion, and download the artifact.

Parameters

$ARGUMENTS contains the build name (required)

Required Environment Variables

Before running, ensure these are set:

  • BOOTC_REGISTRY - Base registry URL (e.g., quay.io/myorg/myimage)
  • REGISTRY_USERNAME - Registry username (or read from registry-user file)
  • REGISTRY_PASSWORD - Registry password (or read from registry-pass file)

Execution Steps

1. Validate Environment

# Check required environment
if [ -z "$BOOTC_REGISTRY" ]; then
  echo "ERROR: BOOTC_REGISTRY environment variable not set"
  echo "Example: export BOOTC_REGISTRY=quay.io/myorg/myimage"
  exit 1
fi

2. Infer CAIB_SERVER from OpenShift Route

CAIB_SERVER="https://$(oc get route ado-build-api -n automotive-dev-operator-system -o jsonpath='{.spec.host}')"
echo "Using CAIB_SERVER: $CAIB_SERVER"

3. Get Authentication Token

TOKEN=$(oc whoami -t)

4. Get Registry Credentials

# Try environment variables first, fall back to files
REGISTRY_USERNAME="${REGISTRY_USERNAME:-$(cat registry-user 2>/dev/null)}"
REGISTRY_PASSWORD="${REGISTRY_PASSWORD:-$(cat registry-pass 2>/dev/null)}"

5. Submit Build with Download

The build command creates a bootc container image and optionally a disk image.

BUILD_NAME="$ARGUMENTS"
PUSH_IMAGE="${BOOTC_REGISTRY}:latest"
DISK_IMAGE="${BOOTC_REGISTRY}:latest-disk"
OUTPUT_FILE="./output/${BUILD_NAME}.qcow2"

bin/caib build simple.aib.yml \
  --server "$CAIB_SERVER" \
  --token "$TOKEN" \
  --name "$BUILD_NAME" \
  --arch arm64 \
  --target qemu \
  --push "$PUSH_IMAGE" \
  --disk \
  --format qcow2 \
  --push-disk "$DISK_IMAGE" \
  --output "$OUTPUT_FILE" \
  --registry-username "$REGISTRY_USERNAME" \
  --registry-password "$REGISTRY_PASSWORD" \
  --follow

6. Monitor Build (if not using --follow)

# Check build status
oc get imagebuild -n automotive-dev-operator-system $BUILD_NAME -o jsonpath='{.status.phase}'

7. On Failure - Debug

# Get PipelineRun name from ImageBuild status
PIPELINE_RUN=$(oc get imagebuild -n automotive-dev-operator-system $BUILD_NAME -o jsonpath='{.status.pipelineRunName}')

# Get pod name using correct PipelineRun label
POD=$(oc get pods -n automotive-dev-operator-system -l tekton.dev/pipelineRun=${PIPELINE_RUN} -o jsonpath='{.items[0].metadata.name}')

# Get build logs
oc logs -n automotive-dev-operator-system $POD -c step-build-image --tail=200

# Check for common issues
oc logs -n automotive-dev-operator-system $POD -c step-build-image | grep -i "builder\|cluster registry\|Pulling\|error\|failed"

8. Verify Download

# Check if artifact was downloaded
if [ -f "$OUTPUT_FILE" ]; then
  echo "SUCCESS: Artifact downloaded to $OUTPUT_FILE"
  ls -lh "$OUTPUT_FILE"
else
  echo "WARNING: Artifact not found at $OUTPUT_FILE"
fi

9. Report Results

Provide a summary with:

  • Build status (success/failure)
  • Download location and file size
  • If failed: the specific error and relevant log snippets
  • Suggestions for fixes based on the error type

CLI Command Reference

build (bootc - default)

Creates a bootc container image from an AIB manifest.

caib build <manifest.aib.yml> \
  --push <registry/image:tag>    # Required: push container to registry
  --disk                          # Also build disk image from container
  --format <qcow2|raw|simg>      # Disk image format (default: qcow2)
  --push-disk <registry/img:tag> # Push disk as OCI artifact
  --output <file>                 # Download disk image to file
  --follow                        # Follow build logs
  --wait                          # Wait for build to complete

disk

Creates a disk image from an existing bootc container.

caib disk <container-ref> \
  --push <registry/image:tag>    # Push disk as OCI artifact
  --output <file>                 # Download disk image to file
  --format <qcow2|raw|simg>      # Disk format (default: qcow2)

build-legacy

Traditional ostree/package-based builds (for backwards compatibility).

caib build-legacy <manifest.aib.yml> \
  --mode <image|package>          # Required: build mode
  --format <qcow2|raw|simg>       # Required: export format
  --name <build-name>             # Required: build name

Common Error Patterns

  • "Builder image not found" - prepare-builder task failed or result not passed
  • "containers-storage: invalid reference" - skopeo copy using wrong format
  • "setfiles: Operation not supported" - SELinux context issues in osbuild
  • "unauthorized" - Token or registry auth issues
  • "BOOTC_REGISTRY not set" - Environment variable missing
  • "container-ref is required for disk mode" - Missing container reference for disk command

Alternative: Download Only (for completed builds)

bin/caib download \
  --server "$CAIB_SERVER" \
  --token "$TOKEN" \
  --name "$BUILD_NAME" \
  --output-dir ./output