From d80448511b1d5641a5f5c3001b0f9e54d44e6a8f Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 26 Jan 2024 12:17:47 -0500 Subject: [PATCH 1/9] remove the test scenario and suite that prevents updating 2 versions at a time --- .../el92-prel@upgrade-block-2minor.sh | 20 ----- .../upgrade/upgrade-block-2-minor.robot | 74 ------------------- 2 files changed, 94 deletions(-) delete mode 100644 test/scenarios/el92-prel@upgrade-block-2minor.sh delete mode 100644 test/suites/upgrade/upgrade-block-2-minor.robot diff --git a/test/scenarios/el92-prel@upgrade-block-2minor.sh b/test/scenarios/el92-prel@upgrade-block-2minor.sh deleted file mode 100644 index 8436bf96e9..0000000000 --- a/test/scenarios/el92-prel@upgrade-block-2minor.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Sourced from scenario.sh and uses functions defined there. - -scenario_create_vms() { - local start_image - start_image="rhel-9.2-microshift-4.$(previous_minor_version)" - prepare_kickstart host1 kickstart.ks.template "${start_image}" - launch_vm host1 -} - -scenario_remove_vms() { - remove_vm host1 -} - -scenario_run_tests() { - run_tests host1 \ - --variable "TOO_NEW_MICROSHIFT_REF:rhel-9.2-microshift-source-fake-next-minor" \ - suites/upgrade/upgrade-block-2-minor.robot -} diff --git a/test/suites/upgrade/upgrade-block-2-minor.robot b/test/suites/upgrade/upgrade-block-2-minor.robot deleted file mode 100644 index 48ded726e7..0000000000 --- a/test/suites/upgrade/upgrade-block-2-minor.robot +++ /dev/null @@ -1,74 +0,0 @@ -*** Settings *** -Documentation Tests related to upgrading MicroShift - -Resource ../../resources/common.resource -Resource ../../resources/ostree.resource -Library Collections - -Suite Setup Setup -Suite Teardown Teardown - -Test Tags ostree - - -*** Variables *** -${USHIFT_HOST} ${EMPTY} -${USHIFT_USER} ${EMPTY} - -${TOO_NEW_MICROSHIFT_REF} ${EMPTY} - -${EXPECTED_LOG} Current active deployment ID and deployment ID -... in version file are the same - not restoring, -... continuing startup with current data. - - -*** Test Cases *** -Upgrading MicroShift By Two Minor Versions Is Blocked - [Documentation] Test verifies if attempt to upgrade MicroShift - ... by two minor versions is blocked. - - Wait Until Greenboot Health Check Exited - ${initial_deploy_backup}= Get Future Backup Name For Current Boot - - Deploy Commit Expecting A Rollback ${TOO_NEW_MICROSHIFT_REF} - - Wait Until Greenboot Health Check Exited - Backup Should Exist ${initial_deploy_backup} - Journal Should Have Information About Failed Version Comparison - Journal Should Have Information That MicroShift Skipped Restoring - - -*** Keywords *** -Setup - [Documentation] Test suite setup - Check Required Env Variables - Should Not Be Empty ${TOO_NEW_MICROSHIFT_REF} TOO_NEW_MICROSHIFT_REF variable is required - Login MicroShift Host - -Teardown - [Documentation] Test suite teardown - Logout MicroShift Host - -Journal Should Have Information That MicroShift Skipped Restoring - [Documentation] TODO - - ${stdout} ${rc}= Execute Command - ... journalctl --unit=microshift --grep "Starting restore" --case-sensitive=true - ... sudo=True - ... return_stdout=True - ... return_rc=True - - # String should not be found - Should Be Equal As Integers 1 ${rc} - - ${version}= MicroShift Version - IF ${version.minor} == 13 RETURN - - ${stdout} ${rc}= Execute Command - ... journalctl --unit=microshift --grep "${EXPECTED_LOG}" --case-sensitive=true - ... sudo=True - ... return_stdout=True - ... return_rc=True - - Log Many ${stdout} ${rc} - Should Be Equal As Integers 0 ${rc} From ba2039fdf54562f11ef87c1c7f370994b5f743cb Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 31 Jan 2024 10:52:10 -0500 Subject: [PATCH 2/9] remove fake-yplus2 rpm and image build --- test/Makefile | 9 ---- test/bin/build_images.sh | 4 -- test/bin/build_rpms.sh | 3 -- test/bin/common.sh | 10 +--- test/bin/create_local_repo.sh | 1 - .../rhel92-source-fake-yplus2-minor.toml | 47 ------------------- .../microshift-fake-yplus2-minor.toml | 7 --- .../el92-src@upgrade-block-to-fake-y2.sh | 18 ------- 8 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 test/image-blueprints/layer2-presubmit/group1/rhel92-source-fake-yplus2-minor.toml delete mode 100644 test/package-sources/microshift-fake-yplus2-minor.toml delete mode 100644 test/scenarios/el92-src@upgrade-block-to-fake-y2.sh diff --git a/test/Makefile b/test/Makefile index 0712918655..41b88fe85f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,7 +2,6 @@ REPO := $(shell git rev-parse --show-toplevel) include $(REPO)/Makefile NEXT_MINOR = $(shell expr $(MINOR) + 1) -YPLUS2_MINOR = $(shell expr $(MINOR) + 2) .PHONY: fake-next-minor-rpm fake-next-minor-rpm: RPMBUILD_DIR := $(REPO)/_output/rpmbuild-fake-next-minor/ @@ -12,14 +11,6 @@ fake-next-minor-rpm: RPMBUILD_DIR=$(RPMBUILD_DIR) \ $(MAKE) -C $(REPO) rpm -.PHONY: fake-yplus2-minor-rpm -fake-yplus2-minor-rpm: RPMBUILD_DIR := $(REPO)/_output/rpmbuild-fake-yplus2-minor/ -fake-yplus2-minor-rpm: - rm -rf $(RPMBUILD_DIR) - MICROSHIFT_VERSION="$(MAJOR).$(YPLUS2_MINOR).$(PATCH)_fake_YPLUS2_minor" \ - RPMBUILD_DIR=$(RPMBUILD_DIR) \ - $(MAKE) -C $(REPO) rpm - # build-base-branch # By default, BASE_BRANCH is derived from the microshift/Makefile.version.$(uname -i).var string. # The BASE_BRANCH is pulled from the remote repo. This is because OpenShift-CI fetches only PR commit tree diff --git a/test/bin/build_images.sh b/test/bin/build_images.sh index c14074fc73..7066795a4c 100755 --- a/test/bin/build_images.sh +++ b/test/bin/build_images.sh @@ -56,13 +56,11 @@ configure_package_sources() { export LOCAL_REPO # defined in common.sh export NEXT_REPO # defined in common.sh export BASE_REPO # defined in common.sh - export YPLUS2_REPO # defined in common.sh export CURRENT_RELEASE_REPO export PREVIOUS_RELEASE_REPO export SOURCE_VERSION export FAKE_NEXT_MINOR_VERSION - export FAKE_YPLUS2_MINOR_VERSION export MINOR_VERSION export PREVIOUS_MINOR_VERSION export SOURCE_VERSION_BASE @@ -682,7 +680,6 @@ SOURCE_VERSION=$(rpm -q --queryformat '%{version}' "${release_info_rpm}") MINOR_VERSION=$(echo "${SOURCE_VERSION}" | cut -f2 -d.) PREVIOUS_MINOR_VERSION=$(( "${MINOR_VERSION}" - 1 )) FAKE_NEXT_MINOR_VERSION=$(( "${MINOR_VERSION}" + 1 )) -FAKE_YPLUS2_MINOR_VERSION=$(( "${MINOR_VERSION}" + 2 )) SOURCE_VERSION_BASE=$(rpm -q --queryformat '%{version}' "${release_info_rpm_base}") current_version_repo=$(get_rel_version_repo "${MINOR_VERSION}") @@ -717,7 +714,6 @@ if ${EXTRACT_CONTAINER_IMAGES}; then extract_container_images "${SOURCE_VERSION}" "${LOCAL_REPO}" "${CONTAINER_LIST}" # The following images are specific to layers that use fake rpms built from source. extract_container_images "4.${FAKE_NEXT_MINOR_VERSION}.*" "${NEXT_REPO}" "${CONTAINER_LIST}" - extract_container_images "4.${FAKE_YPLUS2_MINOR_VERSION}.*" "${YPLUS2_REPO}" "${CONTAINER_LIST}" extract_container_images "${PREVIOUS_RELEASE_VERSION}" "${PREVIOUS_RELEASE_REPO}" "${CONTAINER_LIST}" fi diff --git a/test/bin/build_rpms.sh b/test/bin/build_rpms.sh index e1c41ddd63..e997f502a3 100755 --- a/test/bin/build_rpms.sh +++ b/test/bin/build_rpms.sh @@ -25,9 +25,6 @@ BUILD_CMDS+=( # Build RPMs with the version number of the next minor release, # but using the same source code as the normal build. 'make -C test/ fake-next-minor-rpm' \ - # Build RPMs with the version number of the y+2 minor release, - # but using the same source code as the normal build. - 'make -C test/ fake-yplus2-minor-rpm' \ # Build RPMs from release-$MAJOR.$MINOR of this repo. # These RPMs are useful in providing a layer to upgrade from. 'make -C test/ build-base-branch' \ diff --git a/test/bin/common.sh b/test/bin/common.sh index 67e1633c02..9b121b34f4 100644 --- a/test/bin/common.sh +++ b/test/bin/common.sh @@ -46,11 +46,7 @@ NEXT_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-fake-next-minor" # Location of RPMs built from source # shellcheck disable=SC2034 # used elsewhere -YPLUS2_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-fake-yplus2-minor" - -# Location of RPMs built from source -# shellcheck disable=SC2034 # used elsewhere -BASE_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-base" +BASE_RPM_SOURCE="${ROOTDIR}/_output/rpmbuild-base" # Location of local repository used by composer # shellcheck disable=SC2034 # used elsewhere @@ -60,10 +56,6 @@ LOCAL_REPO="${IMAGEDIR}/rpm-repos/microshift-local" # shellcheck disable=SC2034 # used elsewhere NEXT_REPO="${IMAGEDIR}/rpm-repos/microshift-fake-next-minor" -# Location of local repository used by composer -# shellcheck disable=SC2034 # used elsewhere -YPLUS2_REPO="${IMAGEDIR}/rpm-repos/microshift-fake-yplus2-minor" - # Location of local repository used by composer # shellcheck disable=SC2034 # used elsewhere BASE_REPO="${IMAGEDIR}/rpm-repos/microshift-base" diff --git a/test/bin/create_local_repo.sh b/test/bin/create_local_repo.sh index b7d3a93906..00bc1d40e8 100755 --- a/test/bin/create_local_repo.sh +++ b/test/bin/create_local_repo.sh @@ -38,5 +38,4 @@ cd "${IMAGEDIR}" make_repo "${LOCAL_REPO}" "${RPM_SOURCE}" make_repo "${NEXT_REPO}" "${NEXT_RPM_SOURCE}" -make_repo "${YPLUS2_REPO}" "${YPLUS2_RPM_SOURCE}" make_repo "${BASE_REPO}" "${BASE_RPM_SOURCE}" diff --git a/test/image-blueprints/layer2-presubmit/group1/rhel92-source-fake-yplus2-minor.toml b/test/image-blueprints/layer2-presubmit/group1/rhel92-source-fake-yplus2-minor.toml deleted file mode 100644 index be8a7d2e18..0000000000 --- a/test/image-blueprints/layer2-presubmit/group1/rhel92-source-fake-yplus2-minor.toml +++ /dev/null @@ -1,47 +0,0 @@ -name = "rhel-9.2-microshift-source-fake-yplus2-minor" -description = "A RHEL 9.2 image with the RPMs built from source from the current PR but with the _version_ set to the current+2 y-stream." -version = "0.0.1" -modules = [] -groups = [] -distro = "rhel-92" - -[[packages]] -name = "microshift" -version = "4.{{ .Env.FAKE_YPLUS2_MINOR_VERSION }}.*" - -[[packages]] -name = "microshift-greenboot" -version = "4.{{ .Env.FAKE_YPLUS2_MINOR_VERSION }}.*" - -[[packages]] -name = "microshift-networking" -version = "4.{{ .Env.FAKE_YPLUS2_MINOR_VERSION }}.*" - -[[packages]] -name = "microshift-selinux" -version = "4.{{ .Env.FAKE_YPLUS2_MINOR_VERSION }}.*" - -[[packages]] -name = "microshift-test-agent" -version = "*" - -[customizations.services] -enabled = ["microshift", "microshift-test-agent"] - -[customizations.firewall] -ports = [ - "22:tcp", - "80:tcp", - "443:tcp", - "5353:udp", - "6443:tcp", - "30000-32767:tcp", - "30000-32767:udp", -] - -[customizations.firewall.services] -enabled = ["mdns", "ssh", "http", "https"] - -[[customizations.firewall.zones]] -name = "trusted" -sources = ["10.42.0.0/16", "169.254.169.1"] diff --git a/test/package-sources/microshift-fake-yplus2-minor.toml b/test/package-sources/microshift-fake-yplus2-minor.toml deleted file mode 100644 index 72c48d282c..0000000000 --- a/test/package-sources/microshift-fake-yplus2-minor.toml +++ /dev/null @@ -1,7 +0,0 @@ -id = "microshift-fake-yplus2-minor" -name = "MicroShift Fake Y+2 Minor Version Repo" -type = "yum-baseurl" -url = "file://{{ .Env.YPLUS2_REPO }}/" -check_gpg = false -check_ssl = false -system = false diff --git a/test/scenarios/el92-src@upgrade-block-to-fake-y2.sh b/test/scenarios/el92-src@upgrade-block-to-fake-y2.sh deleted file mode 100644 index dec7f0b3cb..0000000000 --- a/test/scenarios/el92-src@upgrade-block-to-fake-y2.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Sourced from scenario.sh and uses functions defined there. - -scenario_create_vms() { - prepare_kickstart host1 kickstart.ks.template rhel-9.2-microshift-source - launch_vm host1 -} - -scenario_remove_vms() { - remove_vm host1 -} - -scenario_run_tests() { - run_tests host1 \ - --variable "TOO_NEW_MICROSHIFT_REF:rhel-9.2-microshift-source-fake-yplus2-minor" \ - suites/upgrade/upgrade-block-2-minor.robot -} From d0f642d5f2f4fc0630853c1b8198dc468e0d9898 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 6 Mar 2024 10:05:12 -0500 Subject: [PATCH 3/9] do not require repo to be enabled to determine microshift versions The `dnf repoquery` command does not require a repository to be enabled in order to check its contents. Since we use the command to look for old versions of MicroShift, in repositories that might not be enabled, we should not require the repo to be enabled before performing the query. --- test/bin/get_rel_version_repo.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/bin/get_rel_version_repo.sh b/test/bin/get_rel_version_repo.sh index ce99301295..66b3dfa0dd 100755 --- a/test/bin/get_rel_version_repo.sh +++ b/test/bin/get_rel_version_repo.sh @@ -52,15 +52,11 @@ get_current_release_from_sub_repos() { local -r minor="${1}" local -r rhsm_repo="rhocp-4.${minor}-for-rhel-9-${UNAME_M}-rpms" - # getting version of RPM within a rhocp repo depends on the repo being enabled, - # which is done in configure_vm.sh - if dnf_repo_is_enabled "${rhsm_repo}"; then - local newest - newest=$(sudo dnf repoquery microshift --quiet --queryformat '%{version}-%{release}' --repo "${rhsm_repo}" | sort --version-sort | tail -n1) - if [ -n "${newest}" ]; then - echo "${newest}" - return - fi + local newest + newest=$(sudo dnf repoquery microshift --quiet --queryformat '%{version}-%{release}' --repo "${rhsm_repo}" | sort --version-sort | tail -n1) + if [ -n "${newest}" ]; then + echo "${newest}" + return fi echo "" } From 0abd401f345a5a8ffb407037507fac9905fb1206 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 26 Jan 2024 12:18:36 -0500 Subject: [PATCH 4/9] update scenario to calculate y-2 version --- test/bin/scenario.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/bin/scenario.sh b/test/bin/scenario.sh index 7be00ff156..2c383492e9 100755 --- a/test/bin/scenario.sh +++ b/test/bin/scenario.sh @@ -668,6 +668,12 @@ previous_minor_version() { echo $(( $(current_minor_version) - 1 )) } +# Function to report the minor version for 2 releases back. If the current +# version is "4.16.0", reports "14". +yminus2_minor_version() { + echo $(( $(current_minor_version) - 2 )) +} + # Function to report the *next* minor version. If the current # version is "4.14.5", reports "15". next_minor_version() { From 90561f1f2ee4dc0723baf2f2930af4e37b3aa512 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 26 Jan 2024 12:18:13 -0500 Subject: [PATCH 5/9] build images for Y-2 version --- test/bin/build_images.sh | 12 ++++++ .../group2/rhel92-microshift-yminus2.toml | 39 +++++++++++++++++++ test/package-sources/rhocp-y2.toml | 10 +++++ 3 files changed, 61 insertions(+) create mode 100644 test/image-blueprints/layer1-base/group2/rhel92-microshift-yminus2.toml create mode 100644 test/package-sources/rhocp-y2.toml diff --git a/test/bin/build_images.sh b/test/bin/build_images.sh index 7066795a4c..3971a758e3 100755 --- a/test/bin/build_images.sh +++ b/test/bin/build_images.sh @@ -63,11 +63,14 @@ configure_package_sources() { export FAKE_NEXT_MINOR_VERSION export MINOR_VERSION export PREVIOUS_MINOR_VERSION + export YMINUS2_MINOR_VERSION export SOURCE_VERSION_BASE export CURRENT_RELEASE_VERSION export PREVIOUS_RELEASE_VERSION + export YMINUS2_RELEASE_VERSION export RHOCP_MINOR_Y export RHOCP_MINOR_Y1 + export RHOCP_MINOR_Y2 # Add our sources. It is OK to run these steps repeatedly, if the # details change they are updated in the service. @@ -679,6 +682,7 @@ fi SOURCE_VERSION=$(rpm -q --queryformat '%{version}' "${release_info_rpm}") MINOR_VERSION=$(echo "${SOURCE_VERSION}" | cut -f2 -d.) PREVIOUS_MINOR_VERSION=$(( "${MINOR_VERSION}" - 1 )) +YMINUS2_MINOR_VERSION=$(( "${MINOR_VERSION}" - 2 )) FAKE_NEXT_MINOR_VERSION=$(( "${MINOR_VERSION}" + 1 )) SOURCE_VERSION_BASE=$(rpm -q --queryformat '%{version}' "${release_info_rpm_base}") @@ -699,6 +703,13 @@ if is_rhocp_available "${PREVIOUS_MINOR_VERSION}"; then RHOCP_MINOR_Y1="${PREVIOUS_MINOR_VERSION}" fi +# For Y-2, there will always be a real repository, so we can always +# set the template variable for enabling that package source. +yminus2_version_repo=$(get_rel_version_repo "${YMINUS2_MINOR_VERSION}") +YMINUS2_RELEASE_VERSION=$(echo "${yminus2_version_repo}" | cut -d, -f1) +YMINUS2_RELEASE_REPO=$(echo "${yminus2_version_repo}" | cut -d, -f1) +RHOCP_MINOR_Y2="${YMINUS2_MINOR_VERSION}" + mkdir -p "${IMAGEDIR}" LOGDIR="${IMAGEDIR}/build-logs" mkdir -p "${LOGDIR}" @@ -715,6 +726,7 @@ if ${EXTRACT_CONTAINER_IMAGES}; then # The following images are specific to layers that use fake rpms built from source. extract_container_images "4.${FAKE_NEXT_MINOR_VERSION}.*" "${NEXT_REPO}" "${CONTAINER_LIST}" extract_container_images "${PREVIOUS_RELEASE_VERSION}" "${PREVIOUS_RELEASE_REPO}" "${CONTAINER_LIST}" + extract_container_images "${YMINUS2_RELEASE_VERSION}" "${YMINUS2_RELEASE_REPO}" "${CONTAINER_LIST}" fi trap 'osbuild_logs' EXIT diff --git a/test/image-blueprints/layer1-base/group2/rhel92-microshift-yminus2.toml b/test/image-blueprints/layer1-base/group2/rhel92-microshift-yminus2.toml new file mode 100644 index 0000000000..b7308ab5e4 --- /dev/null +++ b/test/image-blueprints/layer1-base/group2/rhel92-microshift-yminus2.toml @@ -0,0 +1,39 @@ +name = "rhel-9.2-microshift-4.{{ .Env.YMINUS2_MINOR_VERSION }}" +description = "RHEL 9.2 with MicroShift from two minor versions back installed." +version = "0.0.1" +modules = [] +groups = [] +distro = "rhel-92" + +[[packages]] +name = "microshift" +version = "{{ .Env.YMINUS2_RELEASE_VERSION }}*" + +[[packages]] +name = "microshift-greenboot" +version = "{{ .Env.YMINUS2_RELEASE_VERSION }}*" + +[[packages]] +name = "microshift-networking" +version = "{{ .Env.YMINUS2_RELEASE_VERSION }}*" + +[[packages]] +name = "microshift-selinux" +version = "{{ .Env.YMINUS2_RELEASE_VERSION }}*" + +[[packages]] +name = "microshift-test-agent" +version = "*" + +[customizations.services] +enabled = ["microshift", "microshift-test-agent"] + +[customizations.firewall] +ports = ["22:tcp", "80:tcp", "443:tcp", "5353:udp", "6443:tcp", "30000-32767:tcp", "30000-32767:udp"] + +[customizations.firewall.services] +enabled = ["mdns", "ssh", "http", "https"] + +[[customizations.firewall.zones]] +name = "trusted" +sources = ["10.42.0.0/16", "169.254.169.1"] diff --git a/test/package-sources/rhocp-y2.toml b/test/package-sources/rhocp-y2.toml new file mode 100644 index 0000000000..d4689d19e4 --- /dev/null +++ b/test/package-sources/rhocp-y2.toml @@ -0,0 +1,10 @@ +{{- if env.Getenv "RHOCP_MINOR_Y2" "" -}} +id = "rhocp-y2" +name = "Red Hat OpenShift Container Platform 4.{{ .Env.RHOCP_MINOR_Y2 }} for RHEL 9" +type = "yum-baseurl" +url = "https://cdn.redhat.com/content/dist/layered/rhel9/{{ .Env.UNAME_M }}/rhocp/4.{{ .Env.RHOCP_MINOR_Y2 }}/os" +check_gpg = true +check_ssl = true +system = false +rhsm = true +{{- end -}} From 2cea2644149ce99fc9616223385e036a4a1fa509 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 26 Jan 2024 12:18:54 -0500 Subject: [PATCH 6/9] scenario to test upgrading from Y-2 to current source version --- test/scenarios/el92-yminus2@upgrade-ok.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/scenarios/el92-yminus2@upgrade-ok.sh diff --git a/test/scenarios/el92-yminus2@upgrade-ok.sh b/test/scenarios/el92-yminus2@upgrade-ok.sh new file mode 100644 index 0000000000..d076303c25 --- /dev/null +++ b/test/scenarios/el92-yminus2@upgrade-ok.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Sourced from scenario.sh and uses functions defined there. + +scenario_create_vms() { + # Determine the starting image based on the source tree current + # version, minus one. + local start_image + start_image="rhel-9.2-microshift-4.$(yminus2_minor_version)" + + prepare_kickstart host1 kickstart.ks.template "${start_image}" + launch_vm host1 +} + +scenario_remove_vms() { + remove_vm host1 +} + +scenario_run_tests() { + run_tests host1 \ + --variable "TARGET_REF:rhel-9.2-microshift-source" \ + suites/upgrade/upgrade-successful.robot +} From f16d284ed78c7638134bf3d07960a77f6c0f4381 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 30 Jan 2024 13:34:54 -0500 Subject: [PATCH 7/9] allow version skew to be up to 2 minor versions --- pkg/admin/prerun/version.go | 11 +++++++---- pkg/admin/prerun/version_test.go | 12 +++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pkg/admin/prerun/version.go b/pkg/admin/prerun/version.go index ffcf312866..a064a0cefe 100644 --- a/pkg/admin/prerun/version.go +++ b/pkg/admin/prerun/version.go @@ -28,6 +28,8 @@ type versionFile struct { BootID string `json:"boot_id"` } +const MAX_VERSION_SKEW = 2 + func (hi *versionFile) BackupName() data.BackupName { return data.BackupName(fmt.Sprintf("%s_%s", hi.DeploymentID, hi.BootID)) } @@ -317,12 +319,13 @@ func checkVersionCompatibility(execVer, dataVer versionMetadata) error { } if execVer.Minor > dataVer.Minor { - if execVer.Minor-1 == dataVer.Minor { - klog.InfoS("Executable is newer than data by 1 - continuing") + versionSkew := execVer.Minor - dataVer.Minor + if versionSkew <= MAX_VERSION_SKEW { + klog.Infof("Executable is newer than data by %d minor versions, continuing", versionSkew) return nil } else { - return fmt.Errorf("executable (%s) is too recent compared to existing data (%s): version difference is %d, maximum allowed difference is 1", - execVer.String(), dataVer.String(), execVer.Minor-dataVer.Minor) + return fmt.Errorf("executable (%s) is too recent compared to existing data (%s): minor version difference is %d, maximum allowed difference is %d", + execVer.String(), dataVer.String(), versionSkew, MAX_VERSION_SKEW) } } diff --git a/pkg/admin/prerun/version_test.go b/pkg/admin/prerun/version_test.go index 0a3f3cdb82..a349a67494 100644 --- a/pkg/admin/prerun/version_test.go +++ b/pkg/admin/prerun/version_test.go @@ -33,14 +33,20 @@ func TestCheckVersionDiff(t *testing.T) { errExpected: true, }, { - name: "binary must be newer only by one minor version", + name: "binary may be newer by one minor version", execVer: versionMetadata{Major: 4, Minor: 15}, dataVer: versionMetadata{Major: 4, Minor: 14}, errExpected: false, }, { - name: "binary newer more than one minor version is not supported", - execVer: versionMetadata{Major: 4, Minor: 15}, + name: "binary may be newer by two minor versions", + execVer: versionMetadata{Major: 4, Minor: 16}, + dataVer: versionMetadata{Major: 4, Minor: 14}, + errExpected: false, + }, + { + name: "binary must not be newer by more than 2 minor versions", + execVer: versionMetadata{Major: 4, Minor: 16}, dataVer: versionMetadata{Major: 4, Minor: 13}, errExpected: true, }, From 364432c4167928290517ac79b60cfdeb1fd4d23b Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 6 Mar 2024 14:36:23 -0500 Subject: [PATCH 8/9] support downloading images for releases in repositories that are not active make container extraction more flexible about handling repositories by handling repo names, paths, and URLs --- test/bin/build_images.sh | 27 +++++++++++++++++++-------- test/bin/get_rel_version_repo.sh | 8 +++++++- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/test/bin/build_images.sh b/test/bin/build_images.sh index 3971a758e3..d8db45fedb 100755 --- a/test/bin/build_images.sh +++ b/test/bin/build_images.sh @@ -31,17 +31,27 @@ osbuild_logs() { } extract_container_images() { - local -r version=$1 - local -r repo_url=$2 - local -r outfile=$3 + local -r version=$1 # full version + local -r repo_spec=$2 # repo name, path, or URL + local -r outfile=$3 # destination file echo "Extracting images from ${version}" mkdir -p "${IMAGEDIR}/release-info-rpms" pushd "${IMAGEDIR}/release-info-rpms" dnf_options="" - if [[ -n ${repo_url} ]]; then - local -r repo_name="$(basename "${repo_url}")" - dnf_options="--repofrompath ${repo_name},${repo_url} --repo ${repo_name}" + local -r repo_name="$(basename "${repo_spec}")" + if [[ "${repo_spec}" =~ ^https://.* ]]; then + # If the spec is a URL, set up the arguments to point to that location. + dnf_options="--repofrompath ${repo_name},${repo_spec} --repo ${repo_name}" + elif [[ "${repo_spec}" =~ ^/.* ]]; then + # If the spec is a path, set up the arguments to point to that path. + dnf_options="--repofrompath ${repo_name},${repo_spec} --repo ${repo_name}" + elif [[ -n ${repo_spec} ]]; then + # If the spec is a name, assume it is already known to the + # system through normal configuration. The repo does not need + # to be enabled in order for dnf to download a package from + # it. + dnf_options="--repo ${repo_spec}" fi # shellcheck disable=SC2086 # double quotes sudo dnf download ${dnf_options} microshift-release-info-"${version}" @@ -704,10 +714,11 @@ if is_rhocp_available "${PREVIOUS_MINOR_VERSION}"; then fi # For Y-2, there will always be a real repository, so we can always -# set the template variable for enabling that package source. +# set the template variable for enabling that package source and use +# the well-known name of that repo instead of figuring out the URL. yminus2_version_repo=$(get_rel_version_repo "${YMINUS2_MINOR_VERSION}") YMINUS2_RELEASE_VERSION=$(echo "${yminus2_version_repo}" | cut -d, -f1) -YMINUS2_RELEASE_REPO=$(echo "${yminus2_version_repo}" | cut -d, -f1) +YMINUS2_RELEASE_REPO="$(get_ocp_repo_name_for_version ${YMINUS2_MINOR_VERSION})" RHOCP_MINOR_Y2="${YMINUS2_MINOR_VERSION}" mkdir -p "${IMAGEDIR}" diff --git a/test/bin/get_rel_version_repo.sh b/test/bin/get_rel_version_repo.sh index 66b3dfa0dd..9c9c7c2372 100755 --- a/test/bin/get_rel_version_repo.sh +++ b/test/bin/get_rel_version_repo.sh @@ -50,7 +50,7 @@ dnf_repo_is_enabled() { get_current_release_from_sub_repos() { local -r minor="${1}" - local -r rhsm_repo="rhocp-4.${minor}-for-rhel-9-${UNAME_M}-rpms" + local -r rhsm_repo="$(get_ocp_repo_name_for_version "${minor}")" local newest newest=$(sudo dnf repoquery microshift --quiet --queryformat '%{version}-%{release}' --repo "${rhsm_repo}" | sort --version-sort | tail -n1) @@ -89,3 +89,9 @@ get_rel_version_repo() { echo "${version},${repo}" fi } + +# Build the repository name for a minor version. +get_ocp_repo_name_for_version() { + local -r version="${1}" + echo "rhocp-4.${version}-for-rhel-9-${UNAME_M}-rpms" +} From 9d43c9d697831468ed6d41b7dfc0b8237ee3b14f Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 7 Mar 2024 11:17:29 -0500 Subject: [PATCH 9/9] fix BASE_RPM_SOURCE setting Co-authored-by: Gregory Giguashvili <85498834+ggiguash@users.noreply.github.com> --- test/bin/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bin/common.sh b/test/bin/common.sh index 9b121b34f4..efa775df60 100644 --- a/test/bin/common.sh +++ b/test/bin/common.sh @@ -46,7 +46,7 @@ NEXT_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-fake-next-minor" # Location of RPMs built from source # shellcheck disable=SC2034 # used elsewhere -BASE_RPM_SOURCE="${ROOTDIR}/_output/rpmbuild-base" +BASE_RPM_SOURCE="${OUTPUTDIR}/rpmbuild-base" # Location of local repository used by composer # shellcheck disable=SC2034 # used elsewhere