Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions test/bin/ci_phase_iso_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,14 @@ update_build_cache() {
# Build the composer-cli base layer and brew RPMs to be cached
$(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer1-base
$(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer4-release

# Build templates
$(dry_run) bash -x ./bin/build_bootc_images.sh -g ./image-blueprints-bootc/templates
# Build the bootc base layer and brew RPMs to be cached
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer1-base
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer4-release
for os in el9 el10; do
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os}/layer4-release"
done

# Prepare for the cache upload by stopping composer services and cleaning
# temporary artifacts
Expand Down Expand Up @@ -115,28 +120,44 @@ run_image_build() {
run_bootc_image_build() {
make -C "${ROOTDIR}" verify-containers

# Build templates first
$(dry_run) bash -x ./bin/build_bootc_images.sh -g ./image-blueprints-bootc/templates

if [ -v CI_JOB_NAME ] ; then
# Skip all image builds for release testing CI jobs because all the images are fetched from the cache.
if [[ "${CI_JOB_NAME}" =~ .*release(-arm)?$ ]]; then
$(dry_run) bash -x ./bin/build_bootc_images.sh -X
return
fi

$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer1-base
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer2-presubmit
local -r os="${CI_JOB_NAME##*-}"

if [[ "${os}" == "el9" || "${os}" == "el10" ]]; then

if [[ "${CI_JOB_NAME}" =~ .*periodic.* ]]; then
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer3-periodic
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer1-base
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os}/layer2-presubmit"

if [[ "${os}" == "el10" ]]; then
# Build el9 images for upgrade tests
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/el9/layer2-presubmit
fi

if [[ "${CI_JOB_NAME}" =~ .*periodic.* ]]; then
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os}/layer3-periodic"
fi
if [[ "${CI_JOB_NAME}" =~ .*release.* ]]; then
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os}/layer4-release"
fi
fi

Comment on lines +126 to +147
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fail fast when CI_JOB_NAME does not map to a supported OS.

Lines 125-144 only build OS layers when the last job-name token is exactly el9 or el10. Any other bootc job name currently exits successfully after building templates only, which makes a naming mismatch look green while skipping the artifacts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/bin/ci_phase_iso_build.sh` around lines 123 - 145, The script currently
silently skips building bootc images when CI_JOB_NAME's last token (variable os)
isn't "el9" or "el10"; update the CI_JOB_NAME handling to fail fast for
unsupported OS values by validating the derived os and exiting non‑zero with an
error message if it isn't one of the supported values. Locate the block that
assigns local -r os="${CI_JOB_NAME##*-}" and the conditional if [[ "${os}" ==
"el9" || "${os}" == "el10" ]]; then and add an else branch that prints a clear
error mentioning CI_JOB_NAME and os and calls exit 1 (respecting dry_run
behavior if necessary), so mismatched job names do not report success while
skipping build_bootc_images.sh invocations.

# Build upstream images
if [[ "${CI_JOB_NAME}" =~ .*upstream.* ]]; then
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer5-upstream
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/upstream
fi
else
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer1-base
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer2-presubmit
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer3-periodic
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer4-release
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer5-upstream
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer1-base
# Full build for all OS versions
for os_ver in el9 el10; do
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os_ver}/layer2-presubmit"
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os_ver}/layer3-periodic"
$(dry_run) bash -x ./bin/build_bootc_images.sh -l "./image-blueprints-bootc/${os_ver}/layer4-release"
done
$(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/upstream
fi
}

Expand Down
3 changes: 2 additions & 1 deletion test/bin/manage_build_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=test/bin/common.sh
source "${SCRIPTDIR}/common.sh"

AWS_BUCKET_NAME="${AWS_BUCKET_NAME:-microshift-build-cache}"
#AWS_BUCKET_NAME="${AWS_BUCKET_NAME:-microshift-build-cache}"
AWS_BUCKET_NAME="thalenar-test-cache-us-west-2"
BCH_SUBDIR=
TAG_SUBDIR=
ARCH_SUBDIR="${UNAME_M}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM localhost/rhel102-bootc-source:latest

# The qemu-guest-agent is used in offline tests
RUN dnf install -y qemu-guest-agent && \
systemctl enable qemu-guest-agent && \
dnf clean all

# Override the default qemu-ga service configuration on the guest to allow all RPCs.
# BLOCK_RPCS is a deny-list of qemu-guest-agent RPCs to block, such as file read/write, process execution, etc. By
# default, all RPCs are blocked.
# FREEZE_HOOK_PATHNAME is the dir-path containing hook scripts. This override does not change the default value.
# These scripts are executed before or after guest image snapshot ops ("freezing" and "thawing" in libvirt speak).
# No hooks are installed by default.
RUN printf '\
\# This is a systemd environment file, not a shell script.\n\
\# It provides settings for "/lib/systemd/system/qemu-guest-agent.service".\n\
BLOCK_RPCS=\n\
FSFREEZE_HOOK_PATHNAME=/etc/qemu-ga/fsfreeze-hook\n' > /etc/sysconfig/qemu-ga

# Embed images based on contents of release-info RPMs
COPY --chmod=755 ./bootc-images/microshift-copy-images.sh /usr/bin/microshift-copy-images
RUN --mount=type=secret,id=pullsecret,dst=/run/secrets/pull-secret.json \
images="$(jq -r ".images[]" /usr/share/microshift/release/release-"$(uname -m)".json)" ; \
images="${images} quay.io/microshift/busybox:1.36" ; \
IMAGE_PULL_LIST="${images}" /usr/bin/microshift-copy-images pull

# Install a systemd drop-in unit to address the problem with image upgrades
# overwriting the container images in additional store. The workaround is to
# copy the images from the pre-loaded to the main container storage.
# In this case, it is not necessary to update /etc/containers/storage.conf with
# the additional store path.
# See https://issues.redhat.com/browse/RHEL-75827
RUN mkdir -p /usr/lib/systemd/system/microshift.service.d
COPY --chmod=644 ./bootc-images/microshift-copy-images.conf /usr/lib/systemd/system/microshift.service.d/microshift-copy-images.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost/rhel102-bootc-source-isolated:latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- if env.Getenv "BREW_LREL_RELEASE_VERSION" "" -}}
localhost/rhel102-bootc-brew-lrel-optional:latest
{{- end }}