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
7 changes: 5 additions & 2 deletions test/bin/ci_phase_boot_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPTDIR}/common.sh"
# Directory to crawl for scenarios when creating/running in batch mode.
# The CI system will override this depending on the job its running.
SCENARIO_SOURCES="${SCENARIO_SOURCES:-${TESTDIR}/scenarios}"
SCENARIO_SOURCES="${SCENARIO_SOURCES:-${TESTDIR}/scenarios-ostree}"
# Directory where all the scenarios will be copied for execution, preserving
# the original scenario type derived from its directory name.
SCENARIOS_TO_RUN="${OUTPUTDIR}/scenarios-$(get_scenario_type_from_path "${SCENARIO_SOURCES}")"
Expand Down Expand Up @@ -53,7 +53,10 @@ bash -x ./bin/manage_hypervisor_config.sh create

# Setup a container registry and mirror images.
# Release jobs need to also mirror the images from the brew RPMs.
if [[ "${SCENARIO_SOURCES:-}" =~ .*releases.* ]]; then
# RPM-only presubmits skip the mirror registry — scenarios pull images directly.
if [[ "${SCENARIO_SOURCES:-}" =~ .*scenarios-rpm.* ]]; then
export SKIP_MIRROR_REGISTRY=true
elif [[ "${SCENARIO_SOURCES:-}" =~ .*releases.* ]]; then
Comment thread
coderabbitai[bot] marked this conversation as resolved.
bash -x ./bin/mirror_registry.sh -ri "${BREW_RPM_SOURCE}"
else
bash -x ./bin/mirror_registry.sh
Expand Down
33 changes: 31 additions & 2 deletions test/bin/ci_phase_iso_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ COMPOSER_CLI_BUILDS=true
if [ -v CI_JOB_NAME ] && [[ "${CI_JOB_NAME}" =~ .*bootc.* ]]; then
COMPOSER_CLI_BUILDS=false
fi
if [ $# -gt 0 ] && [ "$1" = "-rpm_only" ]; then
COMPOSER_CLI_BUILDS=false
fi

# Allow for a dry-run option to save on testing time
BUILD_DRY_RUN=${BUILD_DRY_RUN:-false}
Expand All @@ -36,6 +39,19 @@ dry_run() {

# Try downloading the 'last' build cache.
# Return 0 on success or 1 otherwise.
download_build_cache_isos() {
local -r cache_last="$(\
./bin/manage_build_cache.sh getlast \
-b "${SCENARIO_BUILD_BRANCH}" -t "${SCENARIO_BUILD_TAG}" | \
awk '/LAST:/ {print $NF}' \
)"
if [[ -z "${cache_last}" ]]; then
echo "ERROR: Could not determine the 'last' build cache tag for branch '${SCENARIO_BUILD_BRANCH}'"
return 1
fi
./bin/manage_build_cache.sh download_isos -b "${SCENARIO_BUILD_BRANCH}" -t "${cache_last}"
}

download_build_cache() {
local -r cache_last="$(\
./bin/manage_build_cache.sh getlast \
Expand Down Expand Up @@ -123,7 +139,7 @@ run_bootc_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(-arm)?(-el(9|10))?$ ]]; then
if [[ "${CI_JOB_NAME}" =~ -release- ]] && [[ ! "${CI_JOB_NAME}" =~ -periodic ]]; then
$(dry_run) bash -x ./bin/build_bootc_images.sh -X
return
fi
Expand All @@ -135,7 +151,11 @@ run_bootc_image_build() {
return
fi

local -r os="${CI_JOB_NAME##*-}"
# Extract RHEL version from job name (works regardless of arch/category suffix position)
local os=""
if [[ "${CI_JOB_NAME}" =~ -(el(9|10))(-|$) ]]; then
os="${BASH_REMATCH[1]}"
fi

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

Expand Down Expand Up @@ -215,6 +235,15 @@ if [ $# -gt 0 ] && [ "$1" = "-update_cache" ] ; then
echo "ERROR: Access to the build cache is not available"
exit 1
fi
elif [ $# -gt 0 ] && [ "$1" = "-rpm_only" ] ; then
mkdir -p "${VM_DISK_BASEDIR}"
if ${HAS_CACHE_ACCESS} ; then
download_build_cache_isos
else
echo "ERROR: RPM-only mode requires installer ISOs from the build cache, but cache access is not available"
exit 1
fi
$(dry_run) bash -x ./bin/build_rpms.sh
else
GOT_CACHED_DATA=false
if ${HAS_CACHE_ACCESS} ; then
Expand Down
5 changes: 4 additions & 1 deletion test/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ get_scenario_type_from_path() {
local type

case "${1}" in
*/scenarios/*|*/scenarios-ostree/*)
*/scenarios-ostree/*)
type="ostree"
;;
*/scenarios-bootc/*)
Expand All @@ -274,6 +274,9 @@ get_scenario_type_from_path() {
*/scenarios-bootc-containers/*)
type="bootc-containers"
;;
*/scenarios-rpm/*)
type="rpm"
;;
*)
type="unknown"
;;
Expand Down
18 changes: 17 additions & 1 deletion test/bin/manage_build_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ action_download() {
done
}

action_download_isos() {
local -r dst_base="${IMAGEDIR}"
local -r iso_dest="${dst_base}/${VM_POOL_BASENAME}"

mkdir -p "${iso_dest}"

local -r src_base="s3://${AWS_BUCKET_NAME}/${BCH_SUBDIR}/${ARCH_SUBDIR}/${TAG_SUBDIR}"
local -r iso_src="${src_base}/${VM_POOL_BASENAME}"

echo "Downloading installer ISOs from '${iso_src}'"
run_aws_cli s3 sync --quiet --exclude '*' --include '*-installer.iso' "${iso_src}" "${iso_dest}"

local -r iso_size="$(du -csh "${iso_dest}" | awk 'END{print $1}')"
echo "Downloaded ${iso_size} of installer ISOs"
}

action_verify() {
if check_contents ; then
echo OK
Expand Down Expand Up @@ -304,7 +320,7 @@ fi

# Run actions
case "${action}" in
upload|download|verify|setlast|getlast|dellast|keep)
upload|download|download_isos|verify|setlast|getlast|dellast|keep)
"action_${action}" "$@"
;;
-h|help)
Expand Down
39 changes: 36 additions & 3 deletions test/bin/scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1602,8 +1602,10 @@ check_dependencies() {
"${TESTDIR}/bin/manage_webserver.sh" "start"
fi

if ! sudo podman ps --format '{{.Names}}' | grep -q ^microshift-quay ; then
"${TESTDIR}/bin/mirror_registry.sh"
if [ "${SKIP_MIRROR_REGISTRY:-false}" != "true" ] ; then
if ! sudo podman ps --format '{{.Names}}' | grep -q ^microshift-quay ; then
"${TESTDIR}/bin/mirror_registry.sh"
fi
fi
}

Expand Down Expand Up @@ -1672,6 +1674,35 @@ action_login() {
fi
}

action_setup() {
start_junit
trap "close_junit" EXIT

if ! load_global_settings; then
record_junit "setup" "load_global_settings" "FAILED"
return 1
fi
record_junit "setup" "load_global_settings" "OK"

if ! load_scenario_script; then
record_junit "setup" "load_scenario_script" "FAILED"
return 1
fi
record_junit "setup" "load_scenario_script" "OK"

# shellcheck disable=SC2154
trap 'rc=$? ; \
[ "${rc}" -ne 0 ] && record_junit "setup" "scenario_setup_vms" "FAILED" ; \
collect_pcp_reports || true ; \
sos_report true || rc=1 ; \
close_junit ; exit "${rc}"' EXIT

if type scenario_setup_vms &>/dev/null; then
scenario_setup_vms
record_junit "setup" "scenario_setup_vms" "OK"
fi
}

action_run() {
start_junit
trap "close_junit" EXIT
Expand Down Expand Up @@ -1754,7 +1785,7 @@ JUNIT_OUTPUT_FILE="${SCENARIO_INFO_DIR}/${SCENARIO}/phase_${action}/junit.xml"
cd "${SCRIPTDIR}/.."

case "${action}" in
create|run|cleanup|login)
create|setup|run|cleanup|login)
"action_${action}" "$@"
;;
boot)
Expand All @@ -1767,10 +1798,12 @@ case "${action}" in
rerun)
action_cleanup "$@"
action_create "$@"
action_setup "$@"
action_run "$@"
;;
create-and-run)
action_create "$@"
action_setup "$@"
action_run "$@"
;;
*)
Expand Down
Loading