From 7867723e2f35b75af1217ef171be1276e19284c8 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Sun, 25 Jun 2023 11:07:38 -0700 Subject: [PATCH] Add old_stable type (#1934) * add an old_stable install type to avoid cluttering up stable with older non-onedir installs * removing note about default install type. * update kitchen file. * updating github workflows to tests with old_stable type * blacklist versions 3003 and 3004 for stable, those are now in old_stable. * fix script to include old_stable during the installation type check. * make sure old-stable is consistent. * use install_centos_onedir_deps when installing via git on centos like distros * Handle stable install of 3005 version without a minor version * block git-master on amazon-2 and debian-10 * need seperate blacklists for Mac, since stable 3005 is not available as a onedir package. * update kitchen.macos.yml to ensure 3003, 3004, and 3005 are old-stable. * need to include the salt_bootstrap_options to ensure we get the right install type. * ensure ITYPE is set to stable when minor version is included. * git master installs failing on freebsd --- .github/workflows/ci.yml | 34 ++++++------- .github/workflows/templates/generate.py | 67 +++++++++++++++++++++++-- bootstrap-salt.sh | 52 ++++++++++++++----- kitchen.macos.yml | 9 ++-- kitchen.yml | 27 +++++++--- 5 files changed, 144 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85f4380..940b319 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,7 +127,7 @@ jobs: display-name: FreeBSD 13.1 timeout: 20 runs-on: macos-12 - instances: '["git-master", "latest"]' + instances: '["latest"]' freebsd-123: @@ -142,7 +142,7 @@ jobs: display-name: FreeBSD 12.3 timeout: 20 runs-on: macos-12 - instances: '["git-master", "latest"]' + instances: '["latest"]' openbsd-7: @@ -173,7 +173,7 @@ jobs: display-name: macOS 11 timeout: 20 runs-on: macos-11 - instances: '["stable-3003", "stable-3004", "stable-3005", "stable-3006", "latest"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3006", "latest"]' macos-12: @@ -188,7 +188,7 @@ jobs: display-name: macOS 12 timeout: 20 runs-on: macos-12 - instances: '["stable-3003", "stable-3004", "stable-3005", "stable-3006", "latest"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3006", "latest"]' @@ -204,7 +204,7 @@ jobs: display-name: Windows 2019 timeout: 20 runs-on: windows-2019 - instances: '["stable-3003", "stable-3004", "stable-3005", "stable-3006", "latest"]' + instances: '["stable-3005", "stable-3006", "latest"]' windows-2022: @@ -219,7 +219,7 @@ jobs: display-name: Windows 2022 timeout: 20 runs-on: windows-2022 - instances: '["stable-3003", "stable-3004", "stable-3005", "stable-3006", "latest"]' + instances: '["stable-3005", "stable-3006", "latest"]' @@ -234,7 +234,7 @@ jobs: distro-slug: almalinux-8 display-name: AlmaLinux 8 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' almalinux-9: @@ -262,7 +262,7 @@ jobs: distro-slug: amazon-2 display-name: Amazon 2 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' arch: @@ -290,7 +290,7 @@ jobs: distro-slug: centos-7 display-name: CentOS 7 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' centos-stream8: @@ -304,7 +304,7 @@ jobs: distro-slug: centos-stream8 display-name: CentOS Stream 8 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' centos-stream9: @@ -332,7 +332,7 @@ jobs: distro-slug: debian-10 display-name: Debian 10 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' debian-11: @@ -346,7 +346,7 @@ jobs: distro-slug: debian-11 display-name: Debian 11 timeout: 20 - instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' + instances: '["old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' fedora-36: @@ -458,7 +458,7 @@ jobs: distro-slug: oraclelinux-7 display-name: Oracle Linux 7 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' oraclelinux-8: @@ -472,7 +472,7 @@ jobs: distro-slug: oraclelinux-8 display-name: Oracle Linux 8 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' photon-3: @@ -514,7 +514,7 @@ jobs: distro-slug: rockylinux-8 display-name: Rocky Linux 8 timeout: 20 - instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + instances: '["old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' rockylinux-9: @@ -542,7 +542,7 @@ jobs: distro-slug: ubuntu-2004 display-name: Ubuntu 20.04 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' + instances: '["old-stable-3003", "old-stable-3004", "old-stable-3005", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' ubuntu-2204: @@ -556,7 +556,7 @@ jobs: distro-slug: ubuntu-2204 display-name: Ubuntu 22.04 timeout: 20 - instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' + instances: '["stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' set-pipeline-exit-status: diff --git a/.github/workflows/templates/generate.py b/.github/workflows/templates/generate.py index 61cf640..1a9cf1c 100755 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -47,6 +47,24 @@ BSD = [ "openbsd-7", ] +OLD_STABLE_DISTROS = [ + "almalinux-8", + "amazon-2", + "arch", + "centos-7", + "centos-stream8", + "debian-10", + "debian-11", + "gentoo", + "gentoo-systemd", + "opensuse-15", + "opensuse-tumbleweed", + "oraclelinux-7", + "oraclelinux-8", + "rockylinux-8", + "ubuntu-2004", +] + STABLE_DISTROS = [ "almalinux-8", "almalinux-9", @@ -258,7 +276,7 @@ BLACKLIST_GIT_3006 = [ "ubuntu-2204", ] -BLACKLIST_GIT_MASTER = [] +BLACKLIST_GIT_MASTER = ["amazon-2", "debian-10", "freebsd-131", "freebsd-123"] SALT_VERSIONS = [ "3003", @@ -288,7 +306,29 @@ VERSION_DISPLAY_NAMES = { "nightly": "Nightly", } +OLD_STABLE_VERSION_BLACKLIST = [ + "3006", + "master", + "nightly", +] + STABLE_VERSION_BLACKLIST = [ + "3003", + "3004", + "master", + "nightly", +] + +MAC_OLD_STABLE_VERSION_BLACKLIST = [ + "3006", + "master", + "nightly", +] + +MAC_STABLE_VERSION_BLACKLIST = [ + "3003", + "3004", + "3005", "master", "nightly", ] @@ -427,6 +467,7 @@ def generate_test_jobs(): BLACKLIST = { "3003": BLACKLIST_GIT_3003, "3004": BLACKLIST_GIT_3004, + "master": BLACKLIST_GIT_MASTER, } # .0 versions are a virtual version for pinning to the first @@ -436,7 +477,7 @@ def generate_test_jobs(): continue if ( - salt_version in ("3003", "3004") + salt_version in ("3003", "3004", "master") and distro in BLACKLIST[salt_version] ): continue @@ -480,9 +521,13 @@ def generate_test_jobs(): instances.append(salt_version) continue - for bootstrap_type in ("stable",): + for bootstrap_type in ("stable", "old-stable"): if bootstrap_type == "stable": - if salt_version in STABLE_VERSION_BLACKLIST: + if salt_version in MAC_STABLE_VERSION_BLACKLIST: + continue + + if bootstrap_type == "old-stable": + if salt_version in MAC_OLD_STABLE_VERSION_BLACKLIST: continue kitchen_target = f"{bootstrap_type}-{salt_version}" @@ -574,7 +619,13 @@ def generate_test_jobs(): instances.append(salt_version) continue - for bootstrap_type in ("stable", "git", "onedir", "onedir-rc"): + for bootstrap_type in ( + "old-stable", + "stable", + "git", + "onedir", + "onedir-rc", + ): if bootstrap_type == "onedir": if salt_version not in ONEDIR_SALT_VERSIONS: continue @@ -587,6 +638,12 @@ def generate_test_jobs(): if distro not in ONEDIR_RC_DISTROS: continue + if bootstrap_type == "old-stable": + if salt_version in OLD_STABLE_VERSION_BLACKLIST: + continue + if distro not in OLD_STABLE_DISTROS: + continue + if bootstrap_type == "stable": if salt_version in STABLE_VERSION_BLACKLIST: continue diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 2b42739..06c682f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -310,21 +310,31 @@ __usage() { - onedir_rc Install latest onedir RC release. - onedir_rc [version] Install a specific version. Only supported for onedir RC packages available at repo.saltproject.io + - old-stable Install latest old stable release. + - old-stable [branch] Install latest version on a branch. Only supported + for packages available at repo.saltproject.io + - old-stable [version] Install a specific version. Only supported for + packages available at repo.saltproject.io + To pin a 3xxx minor version, specify it as 3xxx.0 Examples: - ${__ScriptName} - ${__ScriptName} stable - - ${__ScriptName} stable 2017.7 - - ${__ScriptName} stable 2017.7.2 + - ${__ScriptName} stable 3006 + - ${__ScriptName} stable 3006.1 - ${__ScriptName} testing - ${__ScriptName} git - ${__ScriptName} git 2017.7 - ${__ScriptName} git v2017.7.2 - ${__ScriptName} git 06f249901a2e2f1ed310d58ea3921a129f214358 - ${__ScriptName} onedir - - ${__ScriptName} onedir 3005 + - ${__ScriptName} onedir 3006 - ${__ScriptName} onedir_rc - - ${__ScriptName} onedir_rc 3005 + - ${__ScriptName} onedir_rc 3006 + - ${__ScriptName} old-stable + - ${__ScriptName} old-stable 3005 + - ${__ScriptName} old-stable 3005.1 + Options: -a Pip install all Python pkg dependencies for Salt. Requires -V to install @@ -591,7 +601,7 @@ if [ "$#" -gt 0 ];then fi # Check installation type -if [ "$(echo "$ITYPE" | grep -E '(stable|testing|git|onedir|onedir_rc)')" = "" ]; then +if [ "$(echo "$ITYPE" | grep -E '(stable|testing|git|onedir|onedir_rc|old-stable)')" = "" ]; then echoerror "Installation type \"$ITYPE\" is not known..." exit 1 fi @@ -615,28 +625,41 @@ elif [ "$ITYPE" = "stable" ]; then _ONEDIR_REV="latest" ITYPE="onedir" else - if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then + if [ "$(echo "$1" | grep -E '^(nightly|latest|3005|3006)$')" != "" ]; then ONEDIR_REV="$1" _ONEDIR_REV="$1" ITYPE="onedir" shift - elif [ "$(echo "$1" | grep -E '^(3003|3004|3005)$')" != "" ]; then - STABLE_REV="$1" - shift - elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{2}[5-9](\.[0-9]*)?)')" != "" ]; then ONEDIR_REV="minor/$1" _ONEDIR_REV="$1" ITYPE="onedir" shift + else + echo "Unknown stable version: $1 (valid: 3005, 3006, latest)" + exit 1 + fi + fi + +# If doing old-stable install, check if version specified +elif [ "$ITYPE" = "old-stable" ]; then + if [ "$#" -eq 0 ];then + ITYPE="stable" + else + if [ "$(echo "$1" | grep -E '^(3003|3004|3005)$')" != "" ]; then + STABLE_REV="$1" + ITYPE="stable" + shift elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{3}(\.[0-9]*)?)$')" != "" ]; then # Handle the 3xxx.0 version as 3xxx archive (pin to minor) and strip the fake ".0" suffix + ITYPE="stable" STABLE_REV=$(echo "$1" | sed -E 's/^([3-9][0-9]{3})\.0$/\1/') if [ "$(uname)" != "Darwin" ]; then STABLE_REV="archive/$STABLE_REV" fi shift else - echo "Unknown stable version: $1 (valid: 3003, 3004, 3005, 3006, latest)" + echo "Unknown old stable version: $1 (valid: 3003, 3004, 3005)" exit 1 fi fi @@ -4569,6 +4592,12 @@ install_fedora_onedir_post() { # CentOS Install Functions # __install_saltstack_rhel_repository() { + if [ "${DISTRO_MAJOR_VERSION}" -ge 9 ]; then + echoerror "Old stable repository unavailable on RH variants greater than or equal to 9" + echoerror "Use the stable install type." + exit 1 + fi + if [ "$ITYPE" = "stable" ]; then repo_rev="$STABLE_REV" else @@ -4823,7 +4852,6 @@ install_centos_git_deps() { # Set ONEDIR_REV to STABLE_REV in case we # end up calling install_centos_onedir_deps ONEDIR_REV=${STABLE_REV} - install_centos_stable_deps || \ install_centos_onedir_deps || \ return 1 diff --git a/kitchen.macos.yml b/kitchen.macos.yml index f6cd2dc..5635d70 100644 --- a/kitchen.macos.yml +++ b/kitchen.macos.yml @@ -18,16 +18,19 @@ platforms: - name: macos-1015 suites: - - name: stable-3003 + - name: old-stable-3003 provisioner: + salt_bootstrap_options: -MP old-stable %s salt_version: 3003.4 salt_call_command: /opt/salt/bin/salt-call - - name: stable-3004 + - name: old-stable-3004 provisioner: + salt_bootstrap_options: -MP old-stable %s salt_version: 3004.1 salt_call_command: /opt/salt/bin/salt-call - - name: stable-3005 + - name: old-stable-3005 provisioner: + salt_bootstrap_options: -MP old-stable %s salt_version: 3005.1 salt_call_command: /opt/salt/bin/salt-call - name: stable-3006 diff --git a/kitchen.yml b/kitchen.yml index 21fecc5..9f073a7 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -224,10 +224,10 @@ suites: - freebsd-131 - freebsd-123 - openbsd-6 - - name: stable-3003-0 + - name: old-stable-3003-0 provisioner: salt_version: 3003 - salt_bootstrap_options: -x python3 -MP stable 3003.0 + salt_bootstrap_options: -x python3 -MP old-stable 3003.0 excludes: - opensuse-15 - opensuse-tumbleweed @@ -244,10 +244,10 @@ suites: - freebsd-131 - freebsd-123 - openbsd-6 - - name: stable-3003 + - name: old-stable-3003 provisioner: salt_version: 3003 - salt_bootstrap_options: -x python3 -MP stable %s + salt_bootstrap_options: -x python3 -MP old-stable %s excludes: - opensuse-15 - opensuse-tumbleweed @@ -255,10 +255,10 @@ suites: - freebsd-131 - freebsd-123 - openbsd-6 - - name: stable-3004-0 + - name: old-stable-3004-0 provisioner: salt_version: 3004 - salt_bootstrap_options: -x python3 -MP stable 3004.0 + salt_bootstrap_options: -x python3 -MP old-stable 3004.0 excludes: - opensuse-15 - opensuse-tumbleweed @@ -268,10 +268,21 @@ suites: - freebsd-131 - freebsd-123 - openbsd-6 - - name: stable-3004 + - name: old-stable-3004 provisioner: salt_version: 3004 - salt_bootstrap_options: -x python3 -MP stable %s + salt_bootstrap_options: -x python3 -MP old-stable %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - arch + - freebsd-131 + - freebsd-123 + - openbsd-6 + - name: old-stable-3005 + provisioner: + salt_version: 3005 + salt_bootstrap_options: -x python3 -MP old-stable %s excludes: - opensuse-15 - opensuse-tumbleweed