diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fab937bd2..980dc7e15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,6 +180,21 @@ jobs: + debian-12: + name: Debian 12 + if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' + uses: ./.github/workflows/test-linux.yml + needs: + - lint + - generate-actions-workflow + with: + distro-slug: debian-12 + display-name: Debian 12 + container-slug: systemd-debian-12 + timeout: 20 + instances: '["stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' + + photon-5: name: Photon OS 5 if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' @@ -237,7 +252,7 @@ jobs: display-name: Ubuntu 22.04 container-slug: systemd-ubuntu-22.04 timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' + instances: '["stable-3006", "git-3006", "onedir-3006", "stable-3006-8", "stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' set-pipeline-exit-status: @@ -252,6 +267,7 @@ jobs: - macos-13 - macos-14 - windows-2022 + - debian-12 - photon-5 - rockylinux-8 - rockylinux-9 diff --git a/.github/workflows/templates/generate.py b/.github/workflows/templates/generate.py index 8a312c5af..0207d9888 100755 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -18,6 +18,7 @@ # "ubuntu-2004", # "ubuntu-2404", LINUX_DISTROS = [ + "debian-12", "photon-5", "rockylinux-8", "rockylinux-9", @@ -38,15 +39,14 @@ # will add these when they become available with systemd # "amazonlinux-2", # "amazonlinux-2023", -# "centos-stream9", # "debian-11", -# "debian-12", # "debian-13", # "fedora-40", # "photon-4", # "ubuntu-2004", # "ubuntu-2404", STABLE_DISTROS = [ + "debian-12", "photon-5", "rockylinux-8", "rockylinux-9", @@ -58,13 +58,13 @@ # "amazonlinux-2", # "amazonlinux-2023", # "debian-11", -# "debian-12", # "debian-13", # "fedora-40", # "photon-4", # "ubuntu-2004", # "ubuntu-2404", ONEDIR_DISTROS = [ + "debian-12", "photon-5", "rockylinux-8", "rockylinux-9", @@ -75,12 +75,12 @@ # will add these when they become available with systemd # "amazonlinux-2", # "amazonlinux-2023", -# "debian-12", # "photon-4", # "photon-5", -# "rockylinux-9", +# "rockylinux-8", # "ubuntu-2404", ONEDIR_RC_DISTROS = [ + "debian-12", "photon-5", "rockylinux-9", "ubuntu-2204", @@ -97,6 +97,7 @@ "photon-5", ] +# "ubuntu-2204", BLACKLIST_GIT_3006 = [ "amazonlinux-2", "amazonlinux-2023", @@ -107,10 +108,10 @@ "photon-5", "rockylinux-9", "ubuntu-2004", - "ubuntu-2204", "ubuntu-2404", ] +# "ubuntu-2204", BLACKLIST_GIT_3007 = [ "amazonlinux-2", "amazonlinux-2023", @@ -122,13 +123,16 @@ "photon-5", "rockylinux-9", "ubuntu-2004", - "ubuntu-2204", "ubuntu-2404", ] BLACKLIST_GIT_MASTER = [ "amazonlinux-2", "amazonlinux-2023", + "debian-11", + "debian-12", + "debian-13", + "fedora-40", "photon-4", "photon-5", "rockylinux-9", diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a70b9fa1..a4d9ac944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v2024.11.26 + +## What's Changed + +- Updated URLs in README, and fix deps download issue on RedHat family by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2052 +- Update README script help output and scriptversions by @ScriptAutomate in https://github.com/saltstack/salt-bootstrap/pull/2056 + +**Full Changelog**: https://github.com/saltstack/salt-bootstrap/compare/v2024.11.21...v2024.11.26 + # v2024.11.21 ## What's Changed diff --git a/README.rst b/README.rst index 7c524e3a7..db15cc47a 100644 --- a/README.rst +++ b/README.rst @@ -37,6 +37,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file. The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is: +- 2024.11.21: ``ddf624c3a94d721da3f7629402a6c7ecc9dd96d13c1ead2a626314e97cee982a`` - 2024.11.07: ``70a9783649e129985563d1a86cf28b8984499643e62ae1dc47dc008bd204fcbb`` - 2024.09.24: ``88e4e4cad4b115a7b721dd9c21d5ee5df390b5b73b63de48f99399146f43f371`` - 2024.07.23: ``7212b6b497b5c3d2bf15bfe5301625ec7bc1bf3e2949cd47d8e2073614935bf8`` @@ -58,8 +59,9 @@ If you're looking for a *one-liner* to install Salt, please scroll to the bottom instructions for `Installing via an Insecure One-Liner`_. There are also .sha256 files for verifying against in the repo for the stable branch. You can also -get the correct sha256 sum for the stable release from https://bootstrap.saltproject.io/sha256 and -https://winbootstrap.saltproject.io/sha256 +get the correct sha256 sum for the stable release from +https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh.sha256 and +https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.ps1.sha256 Contributing ------------ @@ -82,112 +84,123 @@ To view the latest options and descriptions for ``salt-bootstrap``, use ``-h`` a Usage : bootstrap-salt.sh [options] <install-type> [install-type-args] Installation types: - - stable Install latest stable release. This is the default - install type - - stable [branch] Install latest version on a branch. Only supported - for packages available at repo.saltproject.io - - 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 - - testing RHEL-family specific: configure EPEL testing repo - - git Install from the head of the master branch - - git [ref] Install from any git ref (such as a branch, tag, or - commit) + - stable Install latest stable release. This is the default + install type + - stable [branch] Install latest version on a branch. Only supported + for packages available at packages.broadcom.com + - stable [version] Install a specific version. Only supported for + packages available at packages.broadcom.com + To pin a 3xxx minor version, specify it as 3xxx.0 + - testing RHEL-family specific: configure EPEL testing repo + - git Install from the head of the master branch + - git [ref] Install from any git ref (such as a branch, tag, or + commit) + - onedir Install latest onedir release. + - onedir [version] Install a specific version. Only supported for + onedir packages available at packages.broadcom.com + + - onedir_rc Install latest onedir RC release. + - onedir_rc [version] Install a specific version. Only supported for + onedir RC packages available at packages.broadcom.com Examples: - bootstrap-salt.sh - bootstrap-salt.sh stable - - bootstrap-salt.sh stable 3006.7 - - bootstrap-salt.sh stable v3006.8 + - bootstrap-salt.sh stable 3006 + - bootstrap-salt.sh stable 3006.1 - bootstrap-salt.sh testing - bootstrap-salt.sh git + - bootstrap-salt.sh git 3006.7 + - bootstrap-salt.sh git v3006.8 - bootstrap-salt.sh git 3007.1 - bootstrap-salt.sh git v3007.1 - bootstrap-salt.sh git 06f249901a2e2f1ed310d58ea3921a129f214358 + - bootstrap-salt.sh onedir + - bootstrap-salt.sh onedir 3006 + - bootstrap-salt.sh onedir_rc + - bootstrap-salt.sh onedir_rc 3008 + Options: - -h Display this message - -v Display script version - -n No colours - -D Show debug output + -a Pip install all Python pkg dependencies for Salt. Requires -V to install + all pip pkgs into the virtualenv. + (Only available for Ubuntu based distributions) + -A Pass the salt-master DNS name or IP. This will be stored under + \${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf + -b Assume that dependencies are already installed and software sources are + set up. If git is selected, git tree is still checked out as dependency + step. -c Temporary configuration directory - -g Salt Git repository URL. Default: https://github.com/saltstack/salt.git - -w Install packages from downstream package repository rather than - upstream, saltstack package repository. This is currently only - implemented for SUSE. - -k Temporary directory holding the minion keys which will pre-seed - the master. - -s Sleep time used when waiting for daemons to start, restart and when - checking for the services running. Default: 3 - -L Also install salt-cloud and required python-libcloud package - -M Also install salt-master - -S Also install salt-syndic - -W Also install salt-api - -N Do not install salt-minion - -X Do not start daemons after installation + -C Only run the configuration function. Implies -F (forced overwrite). + To overwrite Master, Syndic or Api configs, -M,-S or -W, respectively, must + also be specified. Salt installation will be ommitted, but some of the + dependencies could be installed to write configuration with -j or -J. -d Disables checking if Salt services are enabled to start on system boot. You can also do this by touching /tmp/disable_salt_checks on the target - host. Default: ${BS_FALSE} - -P Allow pip based installations. On some distributions the required salt - packages or its dependencies are not available as a package for that - distribution. Using this flag allows the script to use pip as a last - resort method. NOTE: This only works for functions which actually - implement pip based installations. - -U If set, fully upgrade the system prior to bootstrapping Salt + host. Default: \${BS_FALSE} + -D Show debug output + -f Force shallow cloning for git installations. + This may result in an "n/a" in the version number. + -F Allow copied files to overwrite existing (config, init.d, etc) + -g Salt Git repository URL. Default: https://github.com/saltstack/salt.git + -h Display this message + -H Use the specified HTTP proxy for all download URLs (including https://). + For example: http://myproxy.example.com:3128 + -i Pass the salt-minion id. This will be stored under + \${BS_SALT_ETC_DIR}/minion_id -I If set, allow insecure connections while downloading any files. For example, pass '--no-check-certificate' to 'wget' or '--insecure' to 'curl'. On Debian and Ubuntu, using this option with -U allows obtaining GnuPG archive keys insecurely if distro has changed release signatures. - -F Allow copied files to overwrite existing (config, init.d, etc) - -K If set, keep the temporary files in the temporary directories specified - with -c and -k - -C Only run the configuration function. Implies -F (forced overwrite). - To overwrite Master or Syndic configs, -M or -S, respectively, must - also be specified. Salt installation will be ommitted, but some of the - dependencies could be installed to write configuration with -j or -J. - -A Pass the salt-master DNS name or IP. This will be stored under - ${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf - -i Pass the salt-minion id. This will be stored under - ${BS_SALT_ETC_DIR}/minion_id - -p Extra-package to install while installing Salt dependencies. One package - per -p flag. You are responsible for providing the proper package name. - -H Use the specified HTTP proxy for all download URLs (including https://). - For example: http://myproxy.example.com:3128 - -b Assume that dependencies are already installed and software sources are - set up. If git is selected, git tree is still checked out as dependency - step. - -f Force shallow cloning for git installations. - This may result in an "n/a" in the version number. - -l Disable ssl checks. When passed, switches "https" calls to "http" where - possible. - -V Install Salt into virtualenv - (only available for Ubuntu based distributions) - -a Pip install all Python pkg dependencies for Salt. Requires -V to install - all pip pkgs into the virtualenv. - (Only available for Ubuntu based distributions) - -r Disable all repository configuration performed by this script. This - option assumes all necessary repository configuration is already present - on the system. - -R Specify a custom repository URL. Assumes the custom repository URL - points to a repository that mirrors Salt packages located at - repo.saltproject.io. The option passed with -R replaces the - "repo.saltproject.io". If -R is passed, -r is also set. Currently only - works on CentOS/RHEL and Debian based distributions. - -J Replace the Master config file with data passed in as a JSON string. If - a Master config file is found, a reasonable effort will be made to save + -j Replace the Minion config file with data passed in as a JSON string. If + a Minion config file is found, a reasonable effort will be made to save the file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" file will be created as either of those options will force a complete overwrite of the file. - -j Replace the Minion config file with data passed in as a JSON string. If - a Minion config file is found, a reasonable effort will be made to save + -J Replace the Master config file with data passed in as a JSON string. If + a Master config file is found, a reasonable effort will be made to save the file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" file will be created as either of those options will force a complete overwrite of the file. + -k Temporary directory holding the minion keys which will pre-seed + the master. + -K If set, keep the temporary files in the temporary directories specified + with -c and -k + -l Disable ssl checks. When passed, switches "https" calls to "http" where + possible. + -L Also install salt-cloud and required python-libcloud package + -M Also install salt-master + -n No colours + -N Do not install salt-minion + -p Extra-package to install while installing Salt dependencies. One package + per -p flag. You are responsible for providing the proper package name. + -P Allow pip based installations. On some distributions the required salt + packages or its dependencies are not available as a package for that + distribution. Using this flag allows the script to use pip as a last + resort method. NOTE: This only works for functions which actually + implement pip based installations. -q Quiet salt installation from git (setup.py install -q) - -x Changes the Python version used to install Salt (default: Python 3) - Python 2.7 is not longer supported. -Q Quickstart, install the Salt master and the Salt minion. And automatically accept the minion key. + -R Specify a custom repository URL. Assumes the custom repository URL + points to a repository that mirrors Salt packages located at + packages.broadcom.com. The option passed with -R replaces the + "packages.broadcom.com". If -R is passed, -r is also set. Currently only + works on CentOS/RHEL and Debian based distributions and macOS. + -s Sleep time used when waiting for daemons to start, restart and when + checking for the services running. Default: 3 + -S Also install salt-syndic + -r Disable all repository configuration performed by this script. This + option assumes all necessary repository configuration is already present + on the system. + -U If set, fully upgrade the system prior to bootstrapping Salt + -v Display script version + -V Install Salt into virtualenv + (only available for Ubuntu based distributions) + -W Also install salt-api + -x Changes the Python version used to install Salt (default: Python 3). + Python 2.7 is no longer supported. + -X Do not start daemons after installation The Salt Bootstrap script has a wide variety of options that can be passed as well as several ways of obtaining the bootstrap script itself. Note that the use of ``sudo`` @@ -207,35 +220,35 @@ If you want to install a package of a specific release version, from the Salt Pr .. code:: console - curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh -P stable 3006.1 If you want to install a specific release version, based on the Git tags: .. code:: console - curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh git v3006.1 Using ``curl`` to install latest development version from GitHub: .. code:: console - curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh git master To install a specific branch from a Git fork: .. code:: console - curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh -g https://github.com/myuser/salt.git git mybranch If all you want is to install a ``salt-master`` using latest Git: .. code:: console - curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh -M -N git master If your host has Internet access only via HTTP proxy, from the Salt Project repo: @@ -243,7 +256,7 @@ If your host has Internet access only via HTTP proxy, from the Salt Project repo .. code:: console PROXY='http://user:password@myproxy.example.com:3128' - curl -o bootstrap-salt.sh -L -x "$PROXY" https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L -x "$PROXY" https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh -P -H "$PROXY" stable If your host has Internet access only via HTTP proxy, installing via Git: @@ -251,7 +264,7 @@ If your host has Internet access only via HTTP proxy, installing via Git: .. code:: console PROXY='http://user:password@myproxy.example.com:3128' - curl -o bootstrap-salt.sh -L -x "$PROXY" https://bootstrap.saltproject.io + curl -o bootstrap-salt.sh -L -x "$PROXY" https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh -H "$PROXY" git @@ -262,22 +275,22 @@ Using ``wget`` to install your distribution's stable packages: .. code:: console - wget -O bootstrap-salt.sh https://bootstrap.saltproject.io + wget -O bootstrap-salt.sh https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh sudo sh bootstrap-salt.sh Installing a specific version from git using ``wget``: .. code:: console - wget -O bootstrap-salt.sh https://bootstrap.saltproject.io - sudo sh bootstrap-salt.sh git v3004.1 + wget -O bootstrap-salt.sh https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh + sudo sh bootstrap-salt.sh git v3006.8 Installing a specific version package from the Salt Project repo using ``wget``: .. code:: console - wget -O bootstrap-salt.sh https://bootstrap.saltproject.io - sudo sh bootstrap-salt.sh -P stable 3006.1 + wget -O bootstrap-salt.sh https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh + sudo sh bootstrap-salt.sh -P stable 3006.8 **NOTE** @@ -292,14 +305,14 @@ If you already have Python installed, ``python 3.10``, then it's as easy as: .. code:: console - python -m urllib "https://bootstrap.saltproject.io" > bootstrap-salt.sh + python -m urllib "https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh" > bootstrap-salt.sh sudo sh bootstrap-salt.sh -P stable 3006.1 With python version 3: .. code:: console - python3 -c 'import urllib.request; print(urllib.request.urlopen("https://bootstrap.saltproject.io").read().decode("ascii"))' > bootstrap-salt.sh + python3 -c 'import urllib.request; print(urllib.request.urlopen("https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh").read().decode("ascii"))' > bootstrap-salt.sh sudo sh bootstrap-salt.sh git v3006.1 Note: Python 2.x is no longer supported given it reached it's End-Of-Life Jan. 1st, 2020 @@ -322,25 +335,25 @@ Installing the latest stable release of Salt (default): .. code:: console - curl -L https://bootstrap.saltproject.io | sudo sh + curl -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh | sudo sh Using ``wget`` to install your distribution's stable packages: .. code:: console - wget -O - https://bootstrap.saltproject.io | sudo sh + wget -O - https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh | sudo sh Installing a target version package of Salt from the Salt Project repo: .. code:: console - curl -L https://bootstrap.saltproject.io | sudo sh -s -- stable 3006.8 + curl -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh | sudo sh -s -- stable 3006.8 Installing the latest master branch of Salt from git: .. code:: console - curl -L https://bootstrap.saltproject.io | sudo sh -s -- git master + curl -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh | sudo sh -s -- git master Note: use of git is recommended for development environments, for example: testing new features of Salt which have not yet been released. @@ -355,9 +368,8 @@ Using ``PowerShell`` to install latest stable version: .. code:: powershell [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12' - Invoke-WebRequest -Uri https://winbootstrap.saltproject.io -OutFile "$env:TEMP\bootstrap-salt.ps1" - Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - & "$env:TEMP\bootstrap-salt.ps1" + Invoke-WebRequest -Uri https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.ps1 -OutFile "$env:TEMP\bootstrap-salt.ps1" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser & "$env:TEMP\bootstrap-salt.ps1" Display information about the install script parameters: @@ -369,7 +381,7 @@ Using ``cygwin`` to install latest stable version: .. code:: console - curl -o bootstrap-salt.ps1 -L https://winbootstrap.saltproject.io + curl -o bootstrap-salt.ps1 -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.ps1 "/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ./bootstrap-salt.ps1" @@ -379,13 +391,13 @@ Supported Operating Systems The salt-bootstrap script officially supports the distributions outlined in `Salt's Supported Operating Systems <https://docs.saltproject.io/salt/install-guide/en/latest/topics/salt-supported-operating-systems.html>`_ -document, (BSD-based OSs, Solaris and AIX are no longer -supported). The operating systems listed below should reflect this document but may become out of -date. If an operating system is listed below, but is not listed on the official supported operating +document, (BSD-based OSs, Solaris and AIX are no longer supported). +The operating systems listed below should reflect this document but may become out of date. +If an operating system is listed below, but is not listed on the official supported operating systems document, the level of support is "best-effort". Since Salt is written in Python, the packages available from the `Salt Project's repository -<https://repo.saltproject.io/salt/py3>`_ are +<packages.broadcom.com>`_ are CPU architecture independent and could be installed on any hardware supported by Linux kernel. However, the Salt Project does package Salt's binary dependencies only for ``x86_64`` (``amd64``) and ``AArch64`` (``arm64``). diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 815a0eb74..cd70eebad 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -39,7 +39,8 @@ Salt Bootstrap GitHub Project (script home) - https://github.com/saltstack/salt-bootstrap Original Vagrant Provisioner Project - https://github.com/saltstack/salty-vagrant Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant - Salt Download Location - https://repo.saltproject.io/salt/py3/windows + Salt Download Location - https://packages.broadcom.com/artifactory/saltproject-generic/windows/ + Salt Manual Install Directions (Windows) - https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/windows.html #> #=============================================================================== @@ -107,7 +108,7 @@ if ($help) { exit 0 } -$__ScriptVersion = "2024.11.21" +$__ScriptVersion = "2024.11.26" $ScriptName = $myInvocation.MyCommand.Name # We'll check for the Version next, because it also has no requirements diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 390ee7b5c..ea0f9f391 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -26,7 +26,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2024.11.21" +__ScriptVersion="2024.11.26" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -544,8 +544,8 @@ __exit_cleanup() { echodebug "Cleaning up the Salt Temporary Git Repository" # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" - rm -rf "${_SALT_GIT_CHECKOUT_DIR}" - #rm -rf "${_SALT_GIT_CHECKOUT_DIR}/deps" + rm -fR "${_SALT_GIT_CHECKOUT_DIR}" + #rm -fR "${_SALT_GIT_CHECKOUT_DIR}/deps" else echowarn "Not cleaning up the Salt Temporary git repository on request" echowarn "Note that if you intend to re-run this script using the git approach, you might encounter some issues" @@ -2093,6 +2093,7 @@ __tdnf_install_noinput() { # DESCRIPTION: (DRY) Helper function to clone and checkout salt to a # specific revision. #---------------------------------------------------------------------------------------------------------------------- +# shellcheck disable=SC2120 __git_clone_and_checkout() { echodebug "Installed git version: $(git --version | awk '{ print $3 }')" @@ -2101,6 +2102,12 @@ __git_clone_and_checkout() { export GIT_SSL_NO_VERIFY=1 fi + if [ "$(echo "$GIT_REV" | grep -E '^(3006|3007)$')" != "" ]; then + GIT_REV_ADJ="$GIT_REV.x" # branches are 3006.x or 3007.x + else + GIT_REV_ADJ="$GIT_REV" + fi + __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${_SALT_GIT_CHECKOUT_DIR}" 2>/dev/null) __SALT_GIT_CHECKOUT_PARENT_DIR="${__SALT_GIT_CHECKOUT_PARENT_DIR:-/tmp/git}" __SALT_CHECKOUT_REPONAME="$(basename "${_SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)" @@ -2129,15 +2136,15 @@ __git_clone_and_checkout() { git fetch --tags upstream fi - echodebug "Hard reseting the cloned repository to ${GIT_REV}" - git reset --hard "$GIT_REV" || return 1 + echodebug "Hard reseting the cloned repository to ${GIT_REV_ADJ}" + git reset --hard "$GIT_REV_ADJ" || return 1 - # Just calling `git reset --hard $GIT_REV` on a branch name that has + # Just calling `git reset --hard $GIT_REV_ADJ` on a branch name that has # already been checked out will not update that branch to the upstream # HEAD; instead it will simply reset to itself. Check the ref to see # if it is a branch name, check out the branch, and pull in the # changes. - if git branch -a | grep -q "${GIT_REV}"; then + if git branch -a | grep -q "${GIT_REV_ADJ}"; then echodebug "Rebasing the cloned repository branch" git pull --rebase || return 1 fi @@ -2159,16 +2166,16 @@ __git_clone_and_checkout() { # cloning we need actually works if [ "$(git clone 2>&1 | grep 'single-branch')" != "" ]; then # The "--single-branch" option is supported, attempt shallow cloning - echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" + echoinfo "Attempting to shallow clone $GIT_REV_ADJ from Salt's repository ${_SALT_REPO_URL}" ## Shallow cloning is resulting in the wrong version of Salt, even with a depth of 5 ## getting 3007.0+0na.246d066 when it should be 3007.1+410.g246d066457, disabling for now - ## if git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then - echodebug "git command, git clone --branch $GIT_REV $_SALT_REPO_URL $__SALT_CHECKOUT_REPONAME" - if git clone --branch "$GIT_REV" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then + ## if git clone --depth 1 --branch "$GIT_REV_ADJ" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then + echodebug "git command, git clone --branch $GIT_REV_ADJ $_SALT_REPO_URL $__SALT_CHECKOUT_REPONAME" + if git clone --branch "$GIT_REV_ADJ" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then # shellcheck disable=SC2164 cd "${_SALT_GIT_CHECKOUT_DIR}" __SHALLOW_CLONE=$BS_TRUE - echoinfo "shallow path (disabled shallow) git cloned $GIT_REV, version $(python3 salt/version.py)" + echoinfo "shallow path (disabled shallow) git cloned $GIT_REV_ADJ, version $(python3 salt/version.py)" else # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. echowarn "Failed to shallow clone." @@ -2187,7 +2194,7 @@ __git_clone_and_checkout() { # shellcheck disable=SC2164 cd "${_SALT_GIT_CHECKOUT_DIR}" - echoinfo "git cloned $GIT_REV, version $(python3 salt/version.py)" + echoinfo "git cloned $GIT_REV_ADJ, version $(python3 salt/version.py)" if ! echo "$_SALT_REPO_URL" | grep -q -F -w "${_SALTSTACK_REPO_URL#*://}"; then # We need to add the saltstack repository as a remote and fetch tags for proper versioning @@ -2197,14 +2204,14 @@ __git_clone_and_checkout() { echodebug "Fetching upstream (SaltStack's Salt repository) git tags" git fetch --tags upstream || return 1 - # Check if GIT_REV is a remote branch or just a commit hash - if git branch -r | grep -q -F -w "origin/$GIT_REV"; then - GIT_REV="origin/$GIT_REV" + # Check if GIT_REV_ADJ is a remote branch or just a commit hash + if git branch -r | grep -q -F -w "origin/$GIT_REV_ADJ"; then + GIT_REV_ADJ="origin/$GIT_REV_ADJ" fi fi - echodebug "Checking out $GIT_REV" - git checkout "$GIT_REV" || return 1 + echodebug "Checking out $GIT_REV_ADJ" + git checkout "$GIT_REV_ADJ" || return 1 fi fi @@ -2800,12 +2807,23 @@ EOM if [ ${DISTRO_NAME_L} = "ubuntu" ] && [ "$DISTRO_MAJOR_VERSION" -eq 22 ]; then echodebug "Ubuntu 22.04 has problem with base.txt requirements file, not parsing sys_platform == 'win32', upgrading from default pip works" echodebug "${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --upgrade pip" - ${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --upgrade pip || (echo "Failed to upgrade pip" && return 1) + ${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --upgrade pip + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to upgrade pip" + return 1 + fi fi echoinfo "Downloading Salt Dependencies from PyPi" echodebug "Running '${_pip_cmd} download -d /tmp/git/deps ${_PIP_DOWNLOAD_ARGS} .'" - ${_pip_cmd} download -d /tmp/git/deps ${_PIP_DOWNLOAD_ARGS} . || (echo "Failed to download salt dependencies" && return 1) + ${_pip_cmd} download -d /tmp/git/deps ${_PIP_DOWNLOAD_ARGS} . + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to download salt dependencies" + return 1 + fi + echoinfo "Installing Downloaded Salt Dependencies" echodebug "Running '${_pip_cmd} install ${_USE_BREAK_SYSTEM_PACKAGES} --ignore-installed ${_PIP_INSTALL_ARGS} /tmp/git/deps/*'" @@ -3119,7 +3137,7 @@ install_ubuntu_deps() { # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" - # ensure sudo installed + # ensure sudo, ps installed __PACKAGES="${__PACKAGES} sudo" ## include hwclock if not part of base OS (23.10 and up) @@ -3188,6 +3206,7 @@ install_ubuntu_git_deps() { __apt_get_install_noinput ca-certificates fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -ne 3 ]; then @@ -3205,6 +3224,9 @@ install_ubuntu_git_deps() { __PACKAGES="${__PACKAGES} util-linux-extra" fi + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 + __PACKAGES="${__PACKAGES} procps pciutils" + # ensure sudo installed __PACKAGES="${__PACKAGES} sudo" @@ -3642,6 +3664,7 @@ install_debian_git_deps() { __apt_get_install_noinput ca-certificates fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -ne 3 ]; then @@ -3652,6 +3675,9 @@ install_debian_git_deps() { __PACKAGES="python${PY_PKG_VER}-dev python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc" echodebug "install_debian_git_deps() Installing ${__PACKAGES}" + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 + __PACKAGES="${__PACKAGES} procps pciutils" + # ensure sudo installed __PACKAGES="${__PACKAGES} sudo" @@ -3987,6 +4013,7 @@ install_fedora_git_deps() { __PACKAGES="" fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 __PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc gcc-c++" @@ -4397,6 +4424,7 @@ install_centos_git_deps() { __yum_install_noinput git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 __PACKAGES="" @@ -5442,6 +5470,7 @@ install_alpine_linux_git_deps() { apk -U add git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 apk -U add python3 python3-dev py3-pip py3-setuptools g++ linux-headers zeromq-dev openrc || return 1 @@ -5608,6 +5637,7 @@ install_amazon_linux_ami_2_git_deps() { __yum_install_noinput git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 __PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc" @@ -5827,6 +5857,7 @@ install_amazon_linux_ami_2023_git_deps() { __yum_install_noinput git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 __PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc" @@ -6014,6 +6045,7 @@ install_arch_linux_git_deps() { pacman -Sy --noconfirm --needed git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 2 ]; then @@ -6397,6 +6429,7 @@ install_photon_git_deps() { __PACKAGES="" fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 __PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc glibc-devel linux-devel.x86_64 cython${PY_PKG_VER}" @@ -6756,6 +6789,7 @@ install_opensuse_git_deps() { __zypper_install git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 # Check for Tumbleweed @@ -6990,6 +7024,7 @@ install_opensuse_15_git_deps() { __zypper_install git || return 1 fi + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -ne 3 ]; then @@ -7245,6 +7280,7 @@ install_gentoo_git_deps() { echoinfo "Running emerge -v1 setuptools" __emerge -v1 setuptools || return 1 + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 __gentoo_post_dep || return 1 } @@ -7613,6 +7649,7 @@ install_macosx_git_deps() { # Install PIP $_PYEXE /tmp/get-pip.py || return 1 + # shellcheck disable=SC2119 __git_clone_and_checkout || return 1 return 0 @@ -8149,6 +8186,7 @@ fi if [ "${ITYPE}" = "git" ] && [ ${_NO_DEPS} -eq ${BS_TRUE} ]; then + # shellcheck disable=SC2119 if ! __git_clone_and_checkout; then echo "Failed to clone and checkout git repository." exit 1 diff --git a/tests/integration/test_installation.py b/tests/integration/test_installation.py index 714b8e166..38e6e814a 100644 --- a/tests/integration/test_installation.py +++ b/tests/integration/test_installation.py @@ -29,10 +29,6 @@ def run_salt_call(cmd): if platform.system() == "Windows": cmd.append("--out=json") result = subprocess.run(cmd, capture_output=True, text=True) - print( - f"DGM run_salt_call, cmd '{cmd}', result '{result}', stdout '{result.stdout}'", - flush=True, - ) if 0 == result.returncode: json_data = json.loads(result.stdout) else: @@ -43,10 +39,6 @@ def run_salt_call(cmd): cmdl.extend(cmd) cmdl.append("--out=json") result = subprocess.run(cmdl, capture_output=True, text=True) - print( - f"DGM run_salt_call, cmdl '{cmdl}', result '{result}', stdout '{result.stdout}'", - flush=True, - ) if 0 == result.returncode: json_data = json.loads(result.stdout) else: @@ -74,10 +66,6 @@ def test_target_salt_version(path, target_salt_version): pytest.skip(f"No target version specified") cmd = ["salt-call", "--local", "grains.item", "saltversion", "--timeout=120"] result = run_salt_call(cmd) - dgm_saltversion = result["saltversion"] - print( - f"DGM test_target_salt_version, target_salt_version '{target_salt_version}', result saltversion '{dgm_saltversion }', result '{result}'", - flush=True, - ) # Returns: {'saltversion': '3006.9+217.g53cfa53040'} - assert result["saltversion"] == target_salt_version + adj_saltversion = result["saltversion"].split("+")[0] + assert adj_saltversion == target_salt_version