diff --git a/test/bin/build_images.sh b/test/bin/build_images.sh index 7a30a997d1..7762d36a0a 100755 --- a/test/bin/build_images.sh +++ b/test/bin/build_images.sh @@ -610,6 +610,8 @@ build_images.sh [-iIsdf] [-l layer-dir | -g group-dir] [-t template] The FILE should be the path to the template to build. Implies -f along with -l and -g based on the filename. + -X Skip all images builds and installer builds. + EOF } @@ -622,9 +624,10 @@ TEMPLATE="" FORCE_REBUILD=false FORCE_SOURCE=false EXTRACT_CONTAINER_IMAGES=true +SKIP_ALL_BUILDS=false selCount=0 -while getopts "dEfg:hiIl:sSt:" opt; do +while getopts "dEfg:hiIl:sSt:X" opt; do case "${opt}" in d) COMPOSER_DRY_RUN=true @@ -666,6 +669,9 @@ while getopts "dEfg:hiIl:sSt:" opt; do selCount=$((selCount+1)) FORCE_REBUILD=true ;; + X) + SKIP_ALL_BUILDS=true + ;; *) usage "ERROR: Unknown option ${opt}" exit 1 @@ -736,6 +742,12 @@ if [ $(pgrep -cx nginx) -eq 0 ] ; then "${TESTDIR}/bin/manage_webserver.sh" "start" fi +# Build the images +if ${SKIP_ALL_BUILDS}; then + echo "INFO: Skipping all images builds and installer builds." + exit 0 +fi + if [ -n "${LAYER}" ]; then for group in "${LAYER}"/group*; do do_group "${group}" "" diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 0abfee4f19..46e963adb4 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -91,6 +91,12 @@ update_build_cache() { # - Only build the 'periodic' layer when 'CI_JOB_NAME' contains 'periodic' token. run_image_build() { 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.* ]]; then + $(dry_run) bash -x ./bin/build_images.sh -X + return + fi + # Conditional per-layer builds when running in CI. # The build_images.sh script skips any images that have been downloaded from the cache. $(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer1-base @@ -99,9 +105,6 @@ run_image_build() { if [[ "${CI_JOB_NAME}" =~ .*periodic.* ]]; then $(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer3-periodic fi - if [[ "${CI_JOB_NAME}" =~ .*release.* ]]; then - $(dry_run) bash -x ./bin/build_images.sh -l ./image-blueprints/layer4-release - fi else # Fall back to full build when not running in CI $(dry_run) bash -x ./bin/build_images.sh @@ -113,6 +116,12 @@ run_bootc_image_build() { make -C "${ROOTDIR}" verify-containers 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.* ]]; 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 @@ -122,9 +131,6 @@ run_bootc_image_build() { if [[ "${CI_JOB_NAME}" =~ .*upstream.* ]]; then $(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer4-upstream fi - if [[ "${CI_JOB_NAME}" =~ .*release.* ]]; then - $(dry_run) bash -x ./bin/build_bootc_images.sh -l ./image-blueprints-bootc/layer5-release - 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 diff --git a/test/bin/pyutils/build_bootc_images.py b/test/bin/pyutils/build_bootc_images.py index 6a1a75e2ea..b907c1088e 100644 --- a/test/bin/pyutils/build_bootc_images.py +++ b/test/bin/pyutils/build_bootc_images.py @@ -569,18 +569,25 @@ def main(): parser.add_argument("-d", "--dry-run", action="store_true", help="Dry run: skip executing build commands.") parser.add_argument("-f", "--force-rebuild", action="store_true", help="Force rebuilding images that already exist.") parser.add_argument("-E", "--no-extract-images", action="store_true", help="Skip container image extraction.") + parser.add_argument("-X", "--skip-all-builds", action="store_true", help="Skip all image builds.") parser.add_argument("-b", "--build-type", choices=["image-bootc", "containerfile", "container-encapsulate"], help="Only build images of the specified type.") - dirgroup = parser.add_mutually_exclusive_group(required=True) + dirgroup = parser.add_mutually_exclusive_group(required=False) dirgroup.add_argument("-l", "--layer-dir", type=str, help="Path to the layer directory to process.") dirgroup.add_argument("-g", "--group-dir", type=str, help="Path to the group directory to process.") dirgroup.add_argument("-t", "--template", type=str, help="Path to a template to build. Allows glob patterns (requires double qoutes).") args = parser.parse_args() + + # Validate: directory is required unless skip-all-builds mode + if not args.skip_all_builds and not (args.layer_dir or args.group_dir or args.template): + parser.error("one of the arguments -l/--layer-dir -g/--group-dir -t/--template is required (unless using -X/--extract-only)") + success_message = False try: pattern = "*" + dir2process = None # Convert input directories to absolute paths if args.group_dir: args.group_dir = os.path.abspath(args.group_dir) @@ -592,8 +599,8 @@ def main(): args.template = os.path.abspath(args.template) dir2process = os.path.dirname(args.template) pattern = os.path.basename(args.template) - # Make sure the input directory exists - if not os.path.isdir(dir2process): + # Make sure the input directory exists (only if specified) + if dir2process and not os.path.isdir(dir2process): raise Exception(f"The input directory '{dir2process}' does not exist") # Make sure the local RPM repository exists if not os.path.isdir(LOCAL_REPO): @@ -637,7 +644,6 @@ def main(): extract_container_images(BREW_NIGHTLY_RELEASE_VERSION, BREW_REPO, CONTAINER_LIST, args.dry_run) # Sort the images list, only leaving unique entries common.sort_uniq_file(CONTAINER_LIST) - # Process package source templates ipkgdir = f"{SCRIPTDIR}/../package-sources-bootc" for ifile in os.listdir(ipkgdir): @@ -647,6 +653,11 @@ def main(): run_template_cmd(ifile, ofile, args.dry_run) # Run the mirror registry common.run_command([f"{SCRIPTDIR}/mirror_registry.sh"], args.dry_run) + # Skip all image builds + if args.skip_all_builds: + common.print_msg("Skipping all image builds") + success_message = True + return # Add local registry credentials to the input pull secret file global PULL_SECRET opull_secret = os.path.join(BOOTC_IMAGE_DIR, "pull_secret.json", ) diff --git a/test/image-blueprints-bootc/README.md b/test/image-blueprints-bootc/README.md index 6925087a6c..a167642bc7 100644 --- a/test/image-blueprints-bootc/README.md +++ b/test/image-blueprints-bootc/README.md @@ -51,3 +51,14 @@ Artifacts built in this layer cannot be cached as they depend on the current sou |group2| Average | Current source artifacts on CentOS used only in upstream > Note: Total build times are up to 15 minutes. + +## Bootc Release Layer + +Artifacts built in this layer are cached as they depend on Brew RPM packages available only behind the VPN. + +|Group |Build Time|Description| +|------|----------|-----------| +|group1| Average | Bootc images from for release testing (EC, RC, z-stream, y-1, y-2) including all microshift RPMs. +|group2| Average | Bootc images from previous group plus special config (FIPS, tuned) and image installers. + +> Note: Total build times are up to 15 minutes. diff --git a/test/image-blueprints-bootc/layer5-release/group2/rhel96-bootc-brew-nightly-with-optional.containerfile b/test/image-blueprints-bootc/layer5-release/group1/rhel96-bootc-brew-nightly-with-optional.containerfile similarity index 100% rename from test/image-blueprints-bootc/layer5-release/group2/rhel96-bootc-brew-nightly-with-optional.containerfile rename to test/image-blueprints-bootc/layer5-release/group1/rhel96-bootc-brew-nightly-with-optional.containerfile diff --git a/test/image-blueprints/README.md b/test/image-blueprints/README.md index ee5ec78e75..038c7799be 100644 --- a/test/image-blueprints/README.md +++ b/test/image-blueprints/README.md @@ -42,3 +42,20 @@ The artifacts are only used by periodic CI jobs. |group1| Average | Current source prerequisites used only in periodics > Note: Total build times are up to 15 minutes. + +## OSTree Release Layer + +Artifacts built in this layer are cached as they depend on Brew RPM packages available only behind the VPN. + +Groups 1-to-2 enforce an ordered build chain, necessary to satisfy a mandatory +layer dependency of `rhel96 os-only -> rhel96 y-2 -> rhel96 y-1`, which is needed +for testing upgrades. + +|Group |Build Time|Description| +|------|----------|-----------| +|group1| Short | RHEL 9.6 layer with MicroShift `y-2` Brew packages +|group2| Short | RHEL 9.6 layer with MicroShift `y-1` Brew packages +|group3| Average | Brew RPM blueprints for release testing (EC, RC, z-stream, nightly, tuned) +|group4| Average | Image installers for release testing (EC, RC, z-stream) + +> Note: Total build times are up to 15 minutes.