diff --git a/scripts/devenv-builder/configure-composer.sh b/scripts/devenv-builder/configure-composer.sh index 4de872e592..d6e0f22f6a 100755 --- a/scripts/devenv-builder/configure-composer.sh +++ b/scripts/devenv-builder/configure-composer.sh @@ -9,11 +9,22 @@ install_and_configure_composer() { local -r version_id_major="$(awk -F. '{print $1}' <<< "${version_id}")" "${DNF_RETRY}" "install" "osbuild osbuild-composer" - "${DNF_RETRY}" "install" \ - "git composer-cli ostree rpm-ostree \ - cockpit-composer bash-completion podman runc genisoimage \ + local packages="git composer-cli ostree rpm-ostree \ + cockpit-composer bash-completion podman python3-psutil \ createrepo yum-utils selinux-policy-devel jq wget lorax rpm-build \ - containernetworking-plugins expect httpd-tools vim-common" + expect httpd-tools vim-common" + + # genisoimage and containernetworking-plugins were removed in RHEL 10. + # Use xorriso (provides a genisoimage-compatible CLI) instead. + # containernetworking-plugins (CNI) has no replacement — Podman uses + # Netavark on RHEL 10, and MicroShift ships its own CNI plugins RPM. + if [[ "${version_id_major}" -ge 10 ]]; then + packages+=" crun xorriso" + else + packages+=" runc genisoimage containernetworking-plugins" + fi + + "${DNF_RETRY}" "install" "${packages}" # The mock utility comes from the EPEL repository "${DNF_RETRY}" "install" "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${version_id_major}.noarch.rpm" diff --git a/scripts/devenv-builder/configure-vm.sh b/scripts/devenv-builder/configure-vm.sh index 5f162bbf40..6c47ee29d7 100755 --- a/scripts/devenv-builder/configure-vm.sh +++ b/scripts/devenv-builder/configure-vm.sh @@ -152,10 +152,7 @@ function configure_rhel_subscription() { fi sudo subscription-manager config --rhsm.manage_repos=1 - # Parse the OS versions and determine if EUS - source /etc/os-release - VERSION_ID_MAJOR="$(awk -F. '{print $1}' <<< "${VERSION_ID}")" - VERSION_ID_MINOR="$(awk -F. '{print $2}' <<< "${VERSION_ID}")" + # Determine if EUS VERSION_ID_EUS="" if (( "${VERSION_ID_MINOR}" % 2 == 0 )) ; then VERSION_ID_EUS="-eus" @@ -212,14 +209,14 @@ function configure_rhel_repositories() { RHOCP=$("${RHOCP_REPO}") if [[ "${RHOCP}" =~ ^[0-9]+\.[0-9]+$ ]]; then - sudo subscription-manager repos --enable "rhocp-${RHOCP}-for-rhel-9-$(uname -m)-rpms" + sudo subscription-manager repos --enable "rhocp-${RHOCP}-for-rhel-${VERSION_ID_MAJOR}-$(uname -m)-rpms" elif [[ "${RHOCP}" =~ ^http ]]; then url=$(echo "${RHOCP}" | cut -d, -f1) ver=$(echo "${RHOCP}" | cut -d, -f2) - OCP_REPO_NAME="rhocp-${ver}-for-rhel-9-mirrorbeta-$(uname -m)-rpms" + OCP_REPO_NAME="rhocp-${ver}-for-rhel-${VERSION_ID_MAJOR}-mirrorbeta-$(uname -m)-rpms" sudo tee "/etc/yum.repos.d/${OCP_REPO_NAME}.repo" >/dev/null <&/dev/null; then exit 1 fi +# Detect RHEL major version for repo name construction +source /etc/os-release +RHEL_MAJOR="${VERSION_ID%%.*}" + # Get version of currently checked out branch. # It's based on values stored in Makefile.version.$ARCH.var. make_version="${REPOROOT}/Makefile.version.$(uname -m).var" @@ -80,13 +84,13 @@ fi check_major="${current_major}" check_minor="${current_minor}" for (( step=0; step < max_steps; step++ )); do - repository="rhocp-${check_major}.${check_minor}-for-rhel-9-$(uname -m)-rpms" + repository="rhocp-${check_major}.${check_minor}-for-rhel-${RHEL_MAJOR}-$(uname -m)-rpms" if sudo dnf repository-packages --showduplicates "${repository}" info cri-o 1>&2; then echo "${check_major}.${check_minor}" exit 0 fi - rhocp_beta_url="https://mirror.openshift.com/pub/openshift-v${check_major}/$(uname -m)/dependencies/rpms/${check_major}.${check_minor}-el9-beta/" + rhocp_beta_url="https://mirror.openshift.com/pub/openshift-v${check_major}/$(uname -m)/dependencies/rpms/${check_major}.${check_minor}-el${RHEL_MAJOR}-beta/" if sudo dnf repository-packages --showduplicates --disablerepo '*' --repofrompath "this,${rhocp_beta_url}" this info cri-o 1>&2; then echo "${rhocp_beta_url},${check_major}.${check_minor}" exit 0 diff --git a/test/bin/pyutils/build_bootc_images.py b/test/bin/pyutils/build_bootc_images.py index d432db2bf3..8cab260120 100644 --- a/test/bin/pyutils/build_bootc_images.py +++ b/test/bin/pyutils/build_bootc_images.py @@ -40,6 +40,17 @@ FORCE_REBUILD = False +def _get_rhel_major(): + with open('/etc/os-release') as f: + for line in f: + if line.startswith('VERSION_ID='): + return line.strip().split('=')[1].strip('"').split('.')[0] + return '9' + + +RHEL_MAJOR = _get_rhel_major() + + def cleanup_atexit(dry_run): common.print_msg("Running atexit cleanup") # Terminating any running subprocesses @@ -83,7 +94,7 @@ def is_rhocp_available(major, minor): """ # Equivalent to `uname -m` architecture = platform.machine() - repository = f"rhocp-{major}.{minor}-for-rhel-9-{architecture}-rpms" + repository = f"rhocp-{major}.{minor}-for-rhel-{RHEL_MAJOR}-{architecture}-rpms" try: # Run the dnf command to check for cri-o in the specified repository @@ -105,8 +116,8 @@ def get_rhocp_beta_url_if_available(major, minor): Returns: str: The beta URL if available, otherwise empty string. """ - url_amd = f"https://mirror.openshift.com/pub/openshift-v{major}/x86_64/dependencies/rpms/{major}.{minor}-el9-beta/" - url_arm = f"https://mirror.openshift.com/pub/openshift-v{major}/aarch64/dependencies/rpms/{major}.{minor}-el9-beta/" + url_amd = f"https://mirror.openshift.com/pub/openshift-v{major}/x86_64/dependencies/rpms/{major}.{minor}-el{RHEL_MAJOR}-beta/" + url_arm = f"https://mirror.openshift.com/pub/openshift-v{major}/aarch64/dependencies/rpms/{major}.{minor}-el{RHEL_MAJOR}-beta/" try: # Run the dnf command to check for cri-o in the specified repository @@ -118,7 +129,7 @@ def get_rhocp_beta_url_if_available(major, minor): # Use specific minor version RHOCP mirror only if both arches are available. architecture = platform.machine() - return f"https://mirror.openshift.com/pub/openshift-v{major}/{architecture}/dependencies/rpms/{major}.{minor}-el9-beta/" + return f"https://mirror.openshift.com/pub/openshift-v{major}/{architecture}/dependencies/rpms/{major}.{minor}-el{RHEL_MAJOR}-beta/" except Exception: return "" @@ -739,8 +750,10 @@ def main(): extract_container_images(SOURCE_VERSION, LOCAL_REPO, CONTAINER_LIST, args.dry_run) # The following images are specific to layers that use fake rpms built from source extract_container_images(f"{FAKE_NEXT_MAJOR_VERSION}.{FAKE_NEXT_MINOR_VERSION}.*", NEXT_REPO, CONTAINER_LIST, args.dry_run) - extract_container_images(PREVIOUS_RELEASE_VERSION, PREVIOUS_RELEASE_REPO, CONTAINER_LIST, args.dry_run) - extract_container_images(YMINUS2_RELEASE_VERSION, YMINUS2_RELEASE_REPO, CONTAINER_LIST, args.dry_run) + if PREVIOUS_RELEASE_VERSION: + extract_container_images(PREVIOUS_RELEASE_VERSION, PREVIOUS_RELEASE_REPO, CONTAINER_LIST, args.dry_run) + if YMINUS2_RELEASE_VERSION: + extract_container_images(YMINUS2_RELEASE_VERSION, YMINUS2_RELEASE_REPO, CONTAINER_LIST, args.dry_run) # The following images are specific to the brew release versions if BREW_Y0_RELEASE_VERSION: extract_container_images(BREW_Y0_RELEASE_VERSION, BREW_REPO, CONTAINER_LIST, args.dry_run) diff --git a/test/bin/pyutils/generate_common_versions.py b/test/bin/pyutils/generate_common_versions.py index fea77b1532..3f534efeaf 100755 --- a/test/bin/pyutils/generate_common_versions.py +++ b/test/bin/pyutils/generate_common_versions.py @@ -18,6 +18,17 @@ ARCH = os.uname().machine + +def _get_rhel_major(): + with open('/etc/os-release') as f: + for line in f: + if line.startswith('VERSION_ID='): + return line.strip().split('=')[1].strip('"').split('.')[0] + return '9' + + +RHEL_MAJOR = _get_rhel_major() + # Version map defining the last minor version for each major version. # Used for cross-major Y-1/Y-2 calculations (e.g., 5.0's Y-1 is 4.22). # Authoritative source: lastMinorForMajor in pkg/admin/prerun/version.go @@ -80,7 +91,7 @@ def get_candidate_repo_url(major, minor, dev_preview=False): Returns: str: The URL of the candidate repository. """ - return f"https://mirror.openshift.com/pub/openshift-v{major}/{ARCH}/microshift/ocp{'-dev-preview' if dev_preview else ''}/latest-{major}.{minor}/el9/os" + return f"https://mirror.openshift.com/pub/openshift-v{major}/{ARCH}/microshift/ocp{'-dev-preview' if dev_preview else ''}/latest-{major}.{minor}/el{RHEL_MAJOR}/os" def get_dependencies_repo_url(major, minor, steps_back=0): @@ -106,7 +117,7 @@ def get_dependencies_repo_url(major, minor, steps_back=0): current_major, current_minor = major, minor for _ in range(steps_back + 1): - url = f"https://mirror.openshift.com/pub/openshift-v{current_major}/{ARCH}/dependencies/rpms/{current_major}.{current_minor}-el9-beta" + url = f"https://mirror.openshift.com/pub/openshift-v{current_major}/{ARCH}/dependencies/rpms/{current_major}.{current_minor}-el{RHEL_MAJOR}-beta" if mirror_exists(url) and repo_provides_pkg(url, "cri-o"): logging.info(f"Beta dependencies repository found for {current_major}.{current_minor}") return url @@ -180,7 +191,7 @@ def get_subscription_repo_name_if_exists(major, minor): Returns: str or None: The name of the subscription repository, or None if not available. """ - repo = f"rhocp-{major}.{minor}-for-rhel-9-{ARCH}-rpms" + repo = f"rhocp-{major}.{minor}-for-rhel-{RHEL_MAJOR}-{ARCH}-rpms" if repo_provides_pkg(repo, "microshift"): return repo @@ -286,7 +297,7 @@ def get_gitops_version(major_version, minor_version): gitops_version_ocp_compatibility = gitops_version_from_api_docs.get("openshift_compatibility") or "" gitops_version_number = gitops_version_from_api_docs.get("name") if f"{current_major}.{current_minor}" in gitops_version_ocp_compatibility: - gitops_repo = f"gitops-{gitops_version_number}-for-rhel-9-{ARCH}-rpms" + gitops_repo = f"gitops-{gitops_version_number}-for-rhel-{RHEL_MAJOR}-{ARCH}-rpms" if repo_provides_pkg(gitops_repo, "microshift-gitops"): logging.info(f"Found GitOps version: {gitops_version_number} which is compatible with OCP {gitops_version_ocp_compatibility} on {gitops_repo} repository") return gitops_version_number @@ -321,7 +332,7 @@ def generate_common_versions(major_version, minor_version): # The 'rhocp_minor_y' variable should be the minor version number, if the # current release is available through the 'rhocp' stream, otherwise empty. - rhocp_minor_y = minor_version if repo_provides_pkg(f"rhocp-{major_version}.{minor_version}-for-rhel-9-{ARCH}-rpms", "cri-o") else '""' + rhocp_minor_y = minor_version if repo_provides_pkg(f"rhocp-{major_version}.{minor_version}-for-rhel-{RHEL_MAJOR}-{ARCH}-rpms", "cri-o") else '""' rhocp_major_y = major_version if rhocp_minor_y != '""' else '""' # The beta repository, containing dependencies, should point to the @@ -332,7 +343,7 @@ def generate_common_versions(major_version, minor_version): # The 'rhocp_minor_y1' variable should be the previous minor version number, if # the previous release is available through the 'rhocp' stream, otherwise empty. - rhocp_minor_y1 = previous_minor_version if repo_provides_pkg(f"rhocp-{previous_major_version}.{previous_minor_version}-for-rhel-9-{ARCH}-rpms", "cri-o") else '""' + rhocp_minor_y1 = previous_minor_version if repo_provides_pkg(f"rhocp-{previous_major_version}.{previous_minor_version}-for-rhel-{RHEL_MAJOR}-{ARCH}-rpms", "cri-o") else '""' rhocp_major_y1 = previous_major_version if rhocp_minor_y1 != '""' else '""' # The beta repository, containing dependencies, should point to the diff --git a/test/bin/scenario.sh b/test/bin/scenario.sh index 0d1c0885a1..47768a759b 100755 --- a/test/bin/scenario.sh +++ b/test/bin/scenario.sh @@ -615,7 +615,9 @@ exit_if_image_not_set() { # Exit the script if microshift previous Z-stream version does not exist in rhocp repository exit_if_zprel_not_exist() { - local -r rhocp_repo="rhocp-${MAJOR_VERSION}.${MINOR_VERSION}-for-rhel-9-${UNAME_M}-rpms" + source /etc/os-release + local -r rhel_major="${VERSION_ID%%.*}" + local -r rhocp_repo="rhocp-${MAJOR_VERSION}.${MINOR_VERSION}-for-rhel-${rhel_major}-${UNAME_M}-rpms" local microshift_zprel if ! microshift_zprel="$(dnf repoquery -q --repo "${rhocp_repo}" --latest-limit 1 --nvr microshift 2>&1)"; then record_junit "repo ${rhocp_repo} does not exist or is not available: ${microshift_zprel}" "exit_if_zprel_not_exist" "SKIPPED" diff --git a/test/image-blueprints-bootc/el10/layer1-base/group2/rhel102-installer.image-installer b/test/image-blueprints-bootc/el10/layer1-base/group2/rhel102-installer.image-installer index 2210caeccf..c5271c9e1d 100644 --- a/test/image-blueprints-bootc/el10/layer1-base/group2/rhel102-installer.image-installer +++ b/test/image-blueprints-bootc/el10/layer1-base/group2/rhel102-installer.image-installer @@ -1,4 +1,2 @@ -# TODO: Replace this by a RHEL 10.2 image when its RPM repositories are released. -# rhel-10.2 -rhel-10.1 +rhel-10.2 diff --git a/test/scenarios-bootc/el10/releases/el102@rpm-standard1.sh b/test/scenarios-bootc/el10/releases/el102@rpm-standard1.sh new file mode 100644 index 0000000000..253136bcfd --- /dev/null +++ b/test/scenarios-bootc/el10/releases/el102@rpm-standard1.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +# Sourced from scenario.sh and uses functions defined there. + +# The RPM-based image used to create the VM for this test does not +# include MicroShift or greenboot, so tell the framework not to wait +# for greenboot to finish when creating the VM. +export SKIP_GREENBOOT=true + +# NOTE: Unlike most suites, these tests rely on being run IN ORDER to +# ensure the host is in a good state at the start of each test. We +# could have separated them and run them as separate scenarios, but +# did not want to spend the resources on a new VM. +export TEST_RANDOMIZATION=none + +# On RHEL 10, rhocp and fast-datapath repos are not available via +# subscription-manager. Create repo files pointing to the RHEL 9 CDN +# using entitlement certificates as a workaround. +configure_cdn_repo() { + local -r repo_id=$1 + local -r repo_name=$2 + local -r baseurl=$3 + + local -r cert=$(run_command_on_vm host1 "ls /etc/pki/entitlement/[0-9]*.pem | grep -v '\-key.pem' | head -n1") + local -r key=$(run_command_on_vm host1 "ls /etc/pki/entitlement/[0-9]*-key.pem | head -n1") + local -r tmp_file=$(mktemp) + + tee "${tmp_file}" >/dev/null </dev/null </dev/null </dev/null <