From 00a0e6c2942b2ea303d933da799eb1048c70fa14 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Sat, 13 May 2023 17:37:14 -0400 Subject: [PATCH] USHIFT-1259: update configure-vm.sh to lock RHEL minor release When setting up a system with a subscription, lock it to the current minor release. This prevents the system from being upgraded beyond that minor release so we can be sure that we are testing on the version we install. Add a flag to disable this behavior for systems where we want to test upgrading past the installed version. Signed-off-by: Doug Hellmann --- scripts/devenv-builder/configure-vm.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/devenv-builder/configure-vm.sh b/scripts/devenv-builder/configure-vm.sh index ba377dbb00..f090ef2cf5 100755 --- a/scripts/devenv-builder/configure-vm.sh +++ b/scripts/devenv-builder/configure-vm.sh @@ -9,15 +9,17 @@ BUILD_AND_RUN=true INSTALL_BUILD_DEPS=true FORCE_FIREWALL=false RHEL_SUBSCRIPTION=false +SET_RHEL_RELEASE=true start=$(date +%s) function usage() { - echo "Usage: $(basename "$0") [--no-build] [--no-build-deps] [--force-firewall] " + echo "Usage: $(basename "$0") [--no-build] [--no-build-deps] [--force-firewall] [--no-set-release-version] " echo "" - echo " --no-build Do not build, install and start MicroShift" - echo " --no-build-deps Do not install dependencies for building binaries and RPMs (implies --no-build)" - echo " --force-firewall Install and configure firewalld regardless of other options" + echo " --no-build Do not build, install and start MicroShift" + echo " --no-build-deps Do not install dependencies for building binaries and RPMs (implies --no-build)" + echo " --force-firewall Install and configure firewalld regardless of other options" + echo " --no-set-release-version Do NOT set the release subscription to the current release version" [ -n "$1" ] && echo -e "\nERROR: $1" exit 1 @@ -38,6 +40,10 @@ while [ $# -gt 1 ]; do FORCE_FIREWALL=true shift ;; + --no-set-release-version) + SET_RHEL_RELEASE=false + shift + ;; *) usage ;; esac done @@ -65,6 +71,14 @@ if ${RHEL_SUBSCRIPTION}; then if ! sudo subscription-manager status >&/dev/null; then sudo subscription-manager register fi + + if ${SET_RHEL_RELEASE}; then + # https://access.redhat.com/solutions/238533 + source /etc/os-release + sudo subscription-manager release --set ${VERSION_ID} + sudo subscription-manager release --show + sudo dnf clean all -y + fi fi # FIXME: Temporarily disable selinux until we update the version of