diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eebfa5191..fab937bd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,6 +124,7 @@ jobs: with: distro-slug: macos-12 display-name: macOS 12 + container-slug: macos-12 timeout: 20 runs-on: macos-12 instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' @@ -139,194 +140,44 @@ jobs: with: distro-slug: macos-13 display-name: macOS 13 + container-slug: macos-13 timeout: 20 runs-on: macos-13 instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' - - windows-2022: - name: Windows 2022 + macos-14: + name: macOS 14 if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' - uses: ./.github/workflows/test-windows.yml + uses: ./.github/workflows/test-macos.yml needs: - lint - generate-actions-workflow with: - distro-slug: windows-2022 - display-name: Windows 2022 + distro-slug: macos-14 + display-name: macOS 14 + container-slug: macOS 14 timeout: 20 - runs-on: windows-2022 + runs-on: macos-14 instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' - almalinux-8: - name: AlmaLinux 8 - 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: almalinux-8 - display-name: AlmaLinux 8 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' - - - almalinux-9: - name: AlmaLinux 9 - 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: almalinux-9 - display-name: AlmaLinux 9 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - - amazon-2: - name: Amazon 2 - 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: amazon-2 - display-name: Amazon 2 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' - - - centos-stream9: - name: CentOS Stream 9 - 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: centos-stream9 - display-name: CentOS Stream 9 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - - debian-11: - name: Debian 11 - 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-11 - display-name: Debian 11 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - - 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 - timeout: 20 - instances: '["stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - - fedora-39: - name: Fedora 39 - 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: fedora-39 - display-name: Fedora 39 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "latest", "default"]' - - - fedora-40: - name: Fedora 40 - 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: fedora-40 - display-name: Fedora 40 - timeout: 20 - instances: '["stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - - opensuse-15: - name: Opensuse 15 - 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: opensuse-15 - display-name: Opensuse 15 - timeout: 20 - instances: '["latest", "default"]' - - - oraclelinux-8: - name: Oracle Linux 8 - 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: oraclelinux-8 - display-name: Oracle Linux 8 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' - - - oraclelinux-9: - name: Oracle Linux 9 + windows-2022: + name: Windows 2022 if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' - uses: ./.github/workflows/test-linux.yml + uses: ./.github/workflows/test-windows.yml needs: - lint - generate-actions-workflow with: - distro-slug: oraclelinux-9 - display-name: Oracle Linux 9 + distro-slug: windows-2022 + display-name: Windows 2022 + container-slug: windows-2022 timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - + runs-on: windows-2022 + instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' - photon-4: - name: Photon OS 4 - 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: photon-4 - display-name: Photon OS 4 - timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "latest", "default"]' photon-5: @@ -339,6 +190,7 @@ jobs: with: distro-slug: photon-5 display-name: Photon OS 5 + container-slug: systemd-photon-5 timeout: 20 instances: '["stable-3006", "onedir-3006", "stable-3006-8", "latest", "default"]' @@ -353,6 +205,7 @@ jobs: with: distro-slug: rockylinux-8 display-name: Rocky Linux 8 + container-slug: systemd-rockylinux-8 timeout: 20 instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' @@ -367,22 +220,9 @@ jobs: with: distro-slug: rockylinux-9 display-name: Rocky Linux 9 + container-slug: systemd-rockylinux-9 timeout: 20 - instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - - ubuntu-2004: - name: Ubuntu 20.04 - 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: ubuntu-2004 - display-name: Ubuntu 20.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", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' ubuntu-2204: @@ -395,24 +235,11 @@ jobs: with: distro-slug: ubuntu-2204 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"]' - ubuntu-2404: - name: Ubuntu 24.04 - 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: ubuntu-2404 - display-name: Ubuntu 24.04 - timeout: 20 - instances: '["stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' - - set-pipeline-exit-status: # This step is just so we can make github require this step, to pass checks # on a pull request instead of requiring all @@ -423,25 +250,12 @@ jobs: - generate-actions-workflow - macos-12 - macos-13 + - macos-14 - windows-2022 - - almalinux-8 - - almalinux-9 - - amazon-2 - - centos-stream9 - - debian-11 - - debian-12 - - fedora-39 - - fedora-40 - - opensuse-15 - - oraclelinux-8 - - oraclelinux-9 - - photon-4 - photon-5 - rockylinux-8 - rockylinux-9 - - ubuntu-2004 - ubuntu-2204 - - ubuntu-2404 if: always() steps: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bfdb47b13..c776a44cc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,61 +41,3 @@ jobs: echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" echo "requirements-met=true" >> "${GITHUB_OUTPUT}" fi - - update-s3-bucket: - name: Update S3 Bucket - if: ${{ fromJSON(needs.workflow-requirements.outputs.requirements-met) }} - runs-on: - - self-hosted - - linux - - repo-release - needs: - - workflow-requirements - environment: release - - steps: - - uses: actions/checkout@v4 - - - name: Get Salt Project GitHub Actions Bot Environment - run: | - TOKEN=$(curl -sS -f -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 30") - SPB_ENVIRONMENT=$(curl -sS -f -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/tags/instance/spb:environment) - echo "SPB_ENVIRONMENT=$SPB_ENVIRONMENT" >> "$GITHUB_ENV" - - - name: Setup GnuPG - run: | - sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/gpg - GNUPGHOME="$(mktemp -d -p /run/gpg)" - echo "GNUPGHOME=${GNUPGHOME}" >> "$GITHUB_ENV" - cat < "${GNUPGHOME}/gpg.conf" - batch - no-tty - pinentry-mode loopback - EOF - - - name: Get Secrets - id: get-secrets - env: - SECRETS_KEY: ${{ secrets.SECRETS_KEY }} - run: | - SECRETS_KEY_FILE=$(mktemp /tmp/output.XXXXXXXXXX) - echo "$SECRETS_KEY" > "$SECRETS_KEY_FILE" - aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - --query SecretString --output text | jq .default_key -r | base64 -d \ - | gpg --passphrase-file "${SECRETS_KEY_FILE}" -d - \ - | gpg --import - - sync - aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - --query SecretString --output text| jq .default_passphrase -r | base64 -d \ - | gpg --passphrase-file "${SECRETS_KEY_FILE}" -o "${GNUPGHOME}/passphrase" -d - - sync - rm "$SECRETS_KEY_FILE" - echo "passphrase-file ${GNUPGHOME}/passphrase" >> "${GNUPGHOME}/gpg.conf" - - - name: Install Requirements - run: | - python3 -m pip install -r requirements/release.txt - - - name: Upload Develop to S3 - run: | - tools release s3-publish --key-id 64CBBC8173D76B3F develop diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 935b0f70f..f31d6c470 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,11 +51,7 @@ jobs: update-develop: name: Update CHANGELOG.md and bootstrap-salt.sh - runs-on: - - ubuntu-latest - ## - self-hosted - ## - linux - ## - repo-release + runs-on: ubuntu-latest permissions: contents: write # To be able to publish the release environment: release @@ -75,36 +71,6 @@ jobs: python3 -m pip install -r requirements/release.txt pre-commit install --install-hooks - ## - name: Setup GnuPG - ## run: | - ## sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/gpg - ## GNUPGHOME="$(mktemp -d -p /run/gpg)" - ## echo "GNUPGHOME=${GNUPGHOME}" >> "$GITHUB_ENV" - ## cat < "${GNUPGHOME}/gpg.conf" - ## batch - ## no-tty - ## pinentry-mode loopback - ## EOF - - ## - name: Get Secrets - ## id: get-secrets - ## env: - ## SECRETS_KEY: ${{ secrets.SECRETS_KEY }} - ## run: | - ## SECRETS_KEY_FILE=$(mktemp /tmp/output.XXXXXXXXXX) - ## echo "$SECRETS_KEY" > "$SECRETS_KEY_FILE" - ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## --query SecretString --output text | jq .default_key -r | base64 -d \ - ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -d - \ - ## | gpg --import - - ## sync - ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## --query SecretString --output text| jq .default_passphrase -r | base64 -d \ - ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -o "${GNUPGHOME}/passphrase" -d - - ## sync - ## rm "$SECRETS_KEY_FILE" - ## echo "passphrase-file ${GNUPGHOME}/passphrase" >> "${GNUPGHOME}/gpg.conf" - - name: Configure Git shell: bash run: | @@ -112,8 +78,6 @@ jobs: git config --global user.name "Salt Project Packaging" git config --global user.email saltproject-packaging@vmware.com git config --global commit.gpgsign false - ## git config --global user.signingkey 64CBBC8173D76B3F - ## git config --global commit.gpgsign true - name: Update Repository id: update-repo @@ -151,11 +115,7 @@ jobs: merge-develop-into-stable: name: Merge develop into stable - runs-on: - - ubuntu-latest - ## - self-hosted - ## - linux - ## - repo-release + runs-on: ubuntu-latest needs: - update-develop environment: release @@ -169,36 +129,6 @@ jobs: ssh-key: ${{ secrets.SALT_BOOTSTRAP_RELEASE_KEY }} fetch-depth: 0 - ## - name: Setup GnuPG - ## run: | - ## sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/gpg - ## GNUPGHOME="$(mktemp -d -p /run/gpg)" - ## echo "GNUPGHOME=${GNUPGHOME}" >> "$GITHUB_ENV" - ## cat < "${GNUPGHOME}/gpg.conf" - ## batch - ## no-tty - ## pinentry-mode loopback - ## EOF - - ## - name: Get Secrets - ## id: get-secrets - ## env: - ## SECRETS_KEY: ${{ secrets.SECRETS_KEY }} - ## run: | - ## SECRETS_KEY_FILE=$(mktemp /tmp/output.XXXXXXXXXX) - ## echo "$SECRETS_KEY" > "$SECRETS_KEY_FILE" - ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## --query SecretString --output text | jq .default_key -r | base64 -d \ - ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -d - \ - ## | gpg --import - - ## sync - ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## --query SecretString --output text| jq .default_passphrase -r | base64 -d \ - ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -o "${GNUPGHOME}/passphrase" -d - - ## sync - ## rm "$SECRETS_KEY_FILE" - ## echo "passphrase-file ${GNUPGHOME}/passphrase" >> "${GNUPGHOME}/gpg.conf" - - name: Configure Git shell: bash run: | @@ -206,8 +136,6 @@ jobs: git config --global user.name "Salt Project Packaging" git config --global user.email saltproject-packaging@vmware.com git config --global commit.gpgsign false - ## git config --global user.signingkey 64CBBC8173D76B3F - ## git config --global commit.gpgsign true - name: Download Release Details uses: actions/download-artifact@v4 @@ -250,10 +178,7 @@ jobs: publish-release: name: Create GitHub Release - runs-on: - - ubuntu-latest - ## - self-hosted - ## - linux + runs-on: ubuntu-latest needs: - merge-develop-into-stable environment: release @@ -299,75 +224,9 @@ jobs: name: release-details failOnError: false - ## update-s3-bucket: - ## name: Update S3 Bucket - ## runs-on: - ## - ubuntu-latest - ## ## - self-hosted - ## ## - linux - ## ## - repo-release - ## needs: - ## - publish-release - ## environment: release - - ## steps: - ## - uses: actions/checkout@v4 - ## with: - ## ref: stable - ## repository: ${{ github.repository }} - ## ssh-key: ${{ secrets.SALT_BOOTSTRAP_RELEASE_KEY }} - - ## - name: Get Salt Project GitHub Actions Bot Environment - ## run: | - ## TOKEN=$(curl -sS -f -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 30") - ## SPB_ENVIRONMENT=$(curl -sS -f -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/tags/instance/spb:environment) - ## echo "SPB_ENVIRONMENT=$SPB_ENVIRONMENT" >> "$GITHUB_ENV" - - ## ## - name: Setup GnuPG - ## ## run: | - ## ## sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/gpg - ## ## GNUPGHOME="$(mktemp -d -p /run/gpg)" - ## ## echo "GNUPGHOME=${GNUPGHOME}" >> "$GITHUB_ENV" - ## ## cat < "${GNUPGHOME}/gpg.conf" - ## ## batch - ## ## no-tty - ## ## pinentry-mode loopback - ## ## EOF - - ## ## - name: Get Secrets - ## ## id: get-secrets - ## ## env: - ## ## SECRETS_KEY: ${{ secrets.SECRETS_KEY }} - ## ## run: | - ## ## SECRETS_KEY_FILE=$(mktemp /tmp/output.XXXXXXXXXX) - ## ## echo "$SECRETS_KEY" > "$SECRETS_KEY_FILE" - ## ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## ## --query SecretString --output text | jq .default_key -r | base64 -d \ - ## ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -d - \ - ## ## | gpg --import - - ## ## sync - ## ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## ## --query SecretString --output text| jq .default_passphrase -r | base64 -d \ - ## ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -o "${GNUPGHOME}/passphrase" -d - - ## ## sync - ## ## rm "$SECRETS_KEY_FILE" - ## ## echo "passphrase-file ${GNUPGHOME}/passphrase" >> "${GNUPGHOME}/gpg.conf" - - ## ## - name: Install Requirements - ## ## run: | - ## ## python3 -m pip install -r requirements/release.txt - - ## ## - name: Upload Stable Release to S3 - ## ## run: | - ## ## tools release s3-publish --key-id 64CBBC8173D76B3F stable - update-develop-checksums: name: Update Release Checksums on Develop - runs-on: - - ubuntu-latest - ## - self-hosted - ## - linux - ## - repo-release + runs-on: ubuntu-latest needs: - publish-release environment: release @@ -393,36 +252,6 @@ jobs: repository: ${{ github.repository }} ssh-key: ${{ secrets.SALT_BOOTSTRAP_RELEASE_KEY }} - ## - name: Setup GnuPG - ## run: | - ## sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/gpg - ## GNUPGHOME="$(mktemp -d -p /run/gpg)" - ## echo "GNUPGHOME=${GNUPGHOME}" >> "$GITHUB_ENV" - ## cat < "${GNUPGHOME}/gpg.conf" - ## batch - ## no-tty - ## pinentry-mode loopback - ## EOF - - ## - name: Get Secrets - ## id: get-secrets - ## env: - ## SECRETS_KEY: ${{ secrets.SECRETS_KEY }} - ## run: | - ## SECRETS_KEY_FILE=$(mktemp /tmp/output.XXXXXXXXXX) - ## echo "$SECRETS_KEY" > "$SECRETS_KEY_FILE" - ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## --query SecretString --output text | jq .default_key -r | base64 -d \ - ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -d - \ - ## | gpg --import - - ## sync - ## aws --region us-west-2 secretsmanager get-secret-value --secret-id /cmbu-saltstack/signing/repo-signing-keys-sha256-2023 \ - ## --query SecretString --output text| jq .default_passphrase -r | base64 -d \ - ## | gpg --passphrase-file "${SECRETS_KEY_FILE}" -o "${GNUPGHOME}/passphrase" -d - - ## sync - ## rm "$SECRETS_KEY_FILE" - ## echo "passphrase-file ${GNUPGHOME}/passphrase" >> "${GNUPGHOME}/gpg.conf" - - name: Configure Git shell: bash run: | @@ -430,8 +259,6 @@ jobs: git config --global user.name "Salt Project Packaging" git config --global user.email saltproject-packaging@vmware.com git config --global commit.gpgsign false - ## git config --global user.signingkey 64CBBC8173D76B3F - ## git config --global commit.gpgsign true - name: Update Latest Release on README run: | diff --git a/.github/workflows/templates/generate.py b/.github/workflows/templates/generate.py index 537d1da5e..8a312c5af 100755 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -6,25 +6,22 @@ os.chdir(os.path.abspath(os.path.dirname(__file__))) +# only test against current containers with systemd +# will add these when they become available with systemd +# "amazonlinux-2", +# "amazonlinux-2023", +# "debian-11", +# "debian-12", +# "debian-13", +# "fedora-40", +# "photon-4", +# "ubuntu-2004", +# "ubuntu-2404", LINUX_DISTROS = [ - "almalinux-8", - "almalinux-9", - "amazon-2", - "centos-stream9", - "debian-11", - "debian-12", - "fedora-39", - "fedora-40", - "opensuse-15", - "oraclelinux-8", - "oraclelinux-9", - "photon-4", "photon-5", "rockylinux-8", "rockylinux-9", - "ubuntu-2004", "ubuntu-2204", - "ubuntu-2404", ] WINDOWS = [ @@ -34,84 +31,78 @@ OSX = [ "macos-12", "macos-13", + "macos-14", ] +# only test against current containers with systemd +# 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 = [ - "almalinux-8", - "almalinux-9", - "amazon-2", - "centos-stream9", - "debian-11", - "debian-12", - "fedora-39", - "fedora-40", - "opensuse-15", - "oraclelinux-8", - "oraclelinux-9", - "photon-4", "photon-5", "rockylinux-8", "rockylinux-9", - "ubuntu-2004", "ubuntu-2204", - "ubuntu-2404", ] +# only test against current containers with systemd +# will add these when they become available with systemd +# "amazonlinux-2", +# "amazonlinux-2023", +# "debian-11", +# "debian-12", +# "debian-13", +# "fedora-40", +# "photon-4", +# "ubuntu-2004", +# "ubuntu-2404", ONEDIR_DISTROS = [ - "almalinux-8", - "almalinux-9", - "amazon-2", - "centos-stream9", - "debian-11", - "debian-12", - "fedora-39", - "fedora-40", - "oraclelinux-8", - "oraclelinux-9", - "photon-4", "photon-5", "rockylinux-8", "rockylinux-9", - "ubuntu-2004", "ubuntu-2204", - "ubuntu-2404", ] +# only test against current containers with systemd +# will add these when they become available with systemd +# "amazonlinux-2", +# "amazonlinux-2023", +# "debian-12", +# "photon-4", +# "photon-5", +# "rockylinux-9", +# "ubuntu-2404", ONEDIR_RC_DISTROS = [ - "almalinux-9", - "amazon-2", - "centos-stream9", - "debian-12", - "oraclelinux-9", - "photon-4", "photon-5", "rockylinux-9", - "ubuntu-2404", + "ubuntu-2204", ] BLACKLIST_3006 = [ "debian-12", "fedora-40", - "opensuse-15", "ubuntu-2404", ] BLACKLIST_3007 = [ - "fedora-39", - "opensuse-15", "photon-4", "photon-5", ] BLACKLIST_GIT_3006 = [ - "almalinux-9", - "amazon-2", - "centos-stream9", + "amazonlinux-2", + "amazonlinux-2023", "debian-11", "debian-12", "fedora-40", - "opensuse-15", - "oraclelinux-9", "photon-4", "photon-5", "rockylinux-9", @@ -121,15 +112,12 @@ ] BLACKLIST_GIT_3007 = [ - "almalinux-9", - "amazon-2", - "centos-stream9", + "amazonlinux-2", + "amazonlinux-2023", "debian-11", "debian-12", - "fedora-39", + "debian-13", "fedora-40", - "opensuse-15", - "oraclelinux-9", "photon-4", "photon-5", "rockylinux-9", @@ -139,10 +127,11 @@ ] BLACKLIST_GIT_MASTER = [ - "amazon-2", - "fedora-39", + "amazonlinux-2", + "amazonlinux-2023", "photon-4", "photon-5", + "rockylinux-9", ] SALT_VERSIONS = [ @@ -199,27 +188,18 @@ # Use build and pip and other standards-based tools. # GIT_DISTRO_BLACKLIST = [ - "almalinux-8", - "fedora-39", - "opensuse-15", - "oraclelinux-8", "rockylinux-8", ] LATEST_PKG_BLACKLIST = [] DISTRO_DISPLAY_NAMES = { - "almalinux-8": "AlmaLinux 8", - "almalinux-9": "AlmaLinux 9", - "amazon-2": "Amazon 2", - "centos-stream9": "CentOS Stream 9", + "amazonlinux-2": "Amazon 2", + "amazonlinux-2023": "Amazon 2023", "debian-11": "Debian 11", "debian-12": "Debian 12", - "fedora-39": "Fedora 39", + "debian-13": "Debian 13", "fedora-40": "Fedora 40", - "opensuse-15": "Opensuse 15", - "oraclelinux-8": "Oracle Linux 8", - "oraclelinux-9": "Oracle Linux 9", "photon-4": "Photon OS 4", "photon-5": "Photon OS 5", "rockylinux-8": "Rocky Linux 8", @@ -229,9 +209,30 @@ "ubuntu-2404": "Ubuntu 24.04", "macos-12": "macOS 12", "macos-13": "macOS 13", + "macos-14": "macOS 14", "windows-2022": "Windows 2022", } +CONTAINER_SLUG_NAMES = { + "amazonlinux-2": "systemd-amazonlinux-2", + "amazonlinux-2023": "systemd-amazonlinux-2023", + "debian-11": "systemd-debian-11", + "debian-12": "systemd-debian-12", + "debian-13": "systemd-debian-13", + "fedora-40": "systemd-fedora-40", + "photon-4": "systemd-photon-4", + "photon-5": "systemd-photon-5", + "rockylinux-8": "systemd-rockylinux-8", + "rockylinux-9": "systemd-rockylinux-9", + "ubuntu-2004": "systemd-ubuntu-20.04", + "ubuntu-2204": "systemd-ubuntu-22.04", + "ubuntu-2404": "systemd-ubuntu-24.04", + "macos-12": "macos-12", + "macos-13": "macos-13", + "macos-14": "macOS 14", + "windows-2022": "windows-2022", +} + TIMEOUT_DEFAULT = 20 TIMEOUT_OVERRIDES = {} VERSION_ONLY_OVERRIDES = [] @@ -246,6 +247,7 @@ with: distro-slug: {distro} display-name: {display_name} + container-slug: {container_name} timeout: {timeout_minutes}{runs_on} instances: '{instances}' """ @@ -296,6 +298,7 @@ def generate_test_jobs(): ifcheck=ifcheck, instances=json.dumps(instances), display_name=DISTRO_DISPLAY_NAMES[distro], + container_name=CONTAINER_SLUG_NAMES[distro], timeout_minutes=timeout_minutes, ) @@ -341,6 +344,7 @@ def generate_test_jobs(): ifcheck=ifcheck, instances=json.dumps(instances), display_name=DISTRO_DISPLAY_NAMES[distro], + container_name=CONTAINER_SLUG_NAMES[distro], timeout_minutes=timeout_minutes, ) @@ -440,6 +444,7 @@ def generate_test_jobs(): ifcheck=ifcheck, instances=json.dumps(instances), display_name=DISTRO_DISPLAY_NAMES[distro], + container_name=CONTAINER_SLUG_NAMES[distro], timeout_minutes=timeout_minutes, ) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index d31ef758f..120f23eca 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -17,6 +17,11 @@ on: required: true description: The Instances To Test + container-slug: + type: string + required: true + description: The Container Slug + timeout: type: number required: false @@ -26,10 +31,10 @@ on: jobs: Test: name: ${{ matrix.instance }} - ## runs-on: ubuntu-20.04 runs-on: ubuntu-latest container: - image: ghcr.io/saltstack/salt-ci-containers/packaging:ubuntu-22.04 + image: ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }} + options: --privileged timeout-minutes: ${{ inputs.timeout }} strategy: @@ -41,18 +46,36 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Pytest + - name: Install Python Dependencies with pip breakage + if: ${{ ( inputs.distro-slug == 'debian-11' ) || ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }} run: | - pip install -U pytest + python3 -m pip install --break-system-packages -r tests/requirements.txt - ## TBD Disabled until CI/CD is functional - ## - name: Bootstrap Salt - ## run: | - ## sh -x ./bootstrap-salt.sh + - name: Install Python Dependencies without pip breakage + if: ${{ ( inputs.distro-slug != 'debian-11' ) && ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }} + run: | + python3 -m pip install -r tests/requirements.txt - ## - name: Test Bootstrap - ## run: | - ## pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/ + - name: Get Version + run: | + # We need to get the version here and make it an environment variable + # It is used to install via bootstrap and in the test + # The version is in the instance name + # sed 1st - becomes space, 2nd - becomes dot + vt_parm_ver=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}') + echo "SaltVersion=$vt_parm_ver" >> $GITHUB_ENV + + - name: Bootstrap Salt + run: | + # sed 1st - becomes space, 2nd - becomes dot + bt_arg1=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $1}') + bt_arg2=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}') + echo "bt parms ,$bt_parms, bt_arg1 ,$bt_arg1, bt_arg2 ,$bt_arg2," + sh -x ./bootstrap-salt.sh "$bt_arg1" "$bt_arg2" + + - name: Test Bootstrap + run: | + pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/ - name: Set Exit Status if: always() diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 504f8b3e7..870fb5965 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -22,6 +22,11 @@ on: required: true description: The Instances To Test + container-slug: + type: string + required: true + description: The Container Slug + timeout: type: number required: false @@ -31,8 +36,8 @@ on: jobs: Test: name: ${{ matrix.instance }} - ## runs-on: ${{ inputs.runs-on }} - runs-on: macos-13 + runs-on: ${{ inputs.runs-on }} + ## runs-on: macos-13 timeout-minutes: ${{ inputs.timeout }} strategy: fail-fast: false @@ -42,18 +47,37 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Pytest + - name: Install Python Dependencies with pip breakage + if: ${{ ( inputs.distro-slug != 'macos-12' ) && ( inputs.distro-slug != 'macos-13' ) }} + run: | + python3 -m pip install --break-system-packages -r tests/requirements.txt + + - name: Install Python Dependencies without pip breakage + if: ${{ ( inputs.distro-slug == 'macos-12' ) || ( inputs.distro-slug == 'macos-13' ) }} + run: | + python3 -m pip install -r tests/requirements.txt + + - name: Get Version run: | - pip install -U pytest + # We need to get the version here and make it an environment variable + # It is used to install via bootstrap and in the test + # The version is in the instance name + # sed 1st - becomes space, 2nd - becomes dot + vt_parms=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./') + vt_parm_ver=$(echo "$vt_parms" | awk -F ' ' '{print $2}') + echo "SaltVersion=$vt_parm_ver" >> $GITHUB_ENV - name: Bootstrap Salt run: | - sudo sh -x ./bootstrap-salt.sh + # sed 1st - becomes space, 2nd - becomes dot + bt_parms=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./') + bt_arg1=$(echo "$bt_parms" | awk -F ' ' '{print $1}') + bt_arg2=$(echo "$bt_parms" | awk -F ' ' '{print $2}') + sudo sh ./bootstrap-salt.sh "$bt_arg1" "$bt_arg2" - ## TBD Disabled until CI/CD is functional - ## - name: Test Bootstrap - ## run: | - ## pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/ + - name: Test Bootstrap + run: | + pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/ - name: Set Exit Status if: always() diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index e4d4dde34..9515dae8d 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -22,6 +22,11 @@ on: required: true description: The Instances To Test + container-slug: + type: string + required: true + description: The Container Slug + timeout: type: number required: false @@ -46,9 +51,9 @@ jobs: with: python-version: "3.10" - - name: Install Pytest + - name: Install Python Dependencies run: | - pip install -r tests\requirements.txt + python3 -m pip install -r tests/requirements.txt - name: Get Version run: | diff --git a/README.rst b/README.rst index 2e896305b..7c524e3a7 100644 --- a/README.rst +++ b/README.rst @@ -414,21 +414,19 @@ Debian and derivatives - Devuan GNU/Linux 1/2/3/4/5 - Kali Linux 1.0 (based on Debian 7) - Linux Mint Debian Edition 1 (based on Debian 8) -- Raspbian 8 (``armhf`` packages) and 9 (using ``git`` installation mode only) Red Hat family ~~~~~~~~~~~~~~ -- Amazon Linux 2012.3 and later - Amazon Linux 2 - Amazon Linux 2023 -- CentOS 7/8/9 +- CentOS 8/9 - Cloud Linux 6/7 -- Fedora 38/39/40 (install latest stable from standard repositories) -- Oracle Linux 7/8/9 -- Red Hat Enterprise Linux 7/8/9 -- Scientific Linux 7/8/9 +- Fedora 40 (install latest stable from standard repositories) +- Oracle Linux 8/9 +- Red Hat Enterprise Linux 8/9 +- Scientific Linux 8/9 SUSE family @@ -461,8 +459,8 @@ repositories are not provided on the `Salt Project's Ubuntu repository`_ for the the bootstrap script will attempt to install the packages for the most closely related LTS Ubuntu release instead. -For example, when installing Salt on Ubuntu 21.10, the bootstrap script will setup the repository -for Ubuntu 20.04 from the `Salt Project's Ubuntu repository`_ and install the 20.04 packages. +For example, when installing Salt on Ubuntu 24.10, the bootstrap script will setup the repository +for Ubuntu 24.04 from the `Salt Project's Ubuntu repository`_ and install the 24.04 packages. Non-LTS Ubuntu releases are not supported once the release reaches End-of-Life as defined by `Ubuntu's release schedule`_. diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f2d6816c..da3c2a5e9 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.07" +__ScriptVersion="2024.11.21" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -221,6 +221,7 @@ __check_config_dir() { # DESCRIPTION: Checks the placed after the install arguments #---------------------------------------------------------------------------------------------------------------------- __check_unparsed_options() { + shellopts="$1" # grep alternative for SunOS if [ -f /usr/xpg4/bin/grep ]; then @@ -619,13 +620,24 @@ 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 '(latest|default|stable|testing|git|onedir|onedir_rc)')" = "" ]; then echoerror "Installation type \"$ITYPE\" is not known..." exit 1 fi +## allows GitHub Actions CI/CD easier handling of latest and default +if [ "$ITYPE" = "latest" ] || [ "$ITYPE" = "default" ]; then + STABLE_REV="latest" + ONEDIR_REV="latest" + _ONEDIR_REV="latest" + ITYPE="onedir" + if [ "$#" -gt 0 ];then + shift + fi + echodebug "using ITYPE onedir for input 'latest' or 'default', cmd args left ,$#," + # If doing a git install, check what branch/tag/sha will be checked out -if [ "$ITYPE" = "git" ]; then +elif [ "$ITYPE" = "git" ]; then if [ "$#" -eq 0 ];then GIT_REV="master" else @@ -650,7 +662,7 @@ elif [ "$ITYPE" = "stable" ]; then _ONEDIR_REV="$1" ITYPE="onedir" shift - elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{2}[5-9](\.[0-9]*)?)')" != "" ]; then + elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then STABLE_REV="$1" ONEDIR_REV="$1" _ONEDIR_REV="$1" @@ -850,7 +862,7 @@ if [ "$ITYPE" != "git" ]; then fi fi -# Set the _REPO_URL value based on if -R was passed or not. Defaults to packages.broadcom.com +# Set the _REPO_URL value based on if -R was passed or not. Defaults to packages.broadcom.com/artifactory if [ "$_CUSTOM_REPO_URL" != "null" ]; then _REPO_URL="$_CUSTOM_REPO_URL" @@ -921,6 +933,7 @@ fi # DESCRIPTION: Retrieves a URL and writes it to a given path #---------------------------------------------------------------------------------------------------------------------- __fetch_url() { + # shellcheck disable=SC2086 curl $_CURL_ARGS -L -s -f -o "$1" "$2" >/dev/null 2>&1 || wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 || @@ -1925,6 +1938,7 @@ __function_defined() { # process is finished so the script doesn't exit on a locked proc. #---------------------------------------------------------------------------------------------------------------------- __wait_for_apt(){ + # Timeout set at 15 minutes WAIT_TIMEOUT=900 @@ -2004,7 +2018,6 @@ __temp_gpg_pub() { #---------------------------------------------------------------------------------------------------------------------- __apt_key_fetch() { - url=$1 tempfile="$(__temp_gpg_pub)" @@ -2438,10 +2451,12 @@ __check_services_systemd() { _SYSTEMD_ACTIVE=$(/bin/systemctl daemon-reload 2>&1 | grep 'System has not been booted with systemd') echodebug "__check_services_systemd _SYSTEMD_ACTIVE result ,$_SYSTEMD_ACTIVE," - if [ "$_SYSTEMD_ACTIVE" != "" ]; then + if [ -n "$_SYSTEMD_ACTIVE" ]; then _SYSTEMD_FUNCTIONAL=$BS_FALSE echodebug "systemd is not functional, despite systemctl being present, setting _SYSTEMD_FUNCTIONAL false, $_SYSTEMD_FUNCTIONAL" return 1 + else + echodebug "systemd is functional, _SYSTEMD_FUNCTIONAL true, $_SYSTEMD_FUNCTIONAL" fi servicename=$1 @@ -2612,6 +2627,7 @@ __activate_virtualenv() { #---------------------------------------------------------------------------------------------------------------------- __install_pip_pkgs() { + _pip_pkgs="$1" _py_exe="$2" _py_pkg=$(echo "$_py_exe" | sed -E "s/\\.//g") @@ -2633,8 +2649,10 @@ __install_pip_pkgs() { else __PACKAGES="${__PACKAGES} ${_py_pkg}-devel" if [ "$DISTRO_NAME_L" = "fedora" ];then + dnf makecache || return 1 __dnf_install_noinput ${__PACKAGES} || return 1 else + yum makecache || return 1 __yum_install_noinput ${__PACKAGES} || return 1 fi fi @@ -2653,6 +2671,7 @@ __install_pip_pkgs() { # PARAMETERS: requirements_file #---------------------------------------------------------------------------------------------------------------------- __install_pip_deps() { + # Install virtualenv to system pip before activating virtualenv if thats going to be used # We assume pip pkg is installed since that is distro specific if [ "$_VIRTUALENV_DIR" != "null" ]; then @@ -2795,7 +2814,6 @@ EOM rm -f /tmp/git/deps/* echoinfo "Building Salt Python Wheel" - if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then SETUP_PY_INSTALL_ARGS="-v" fi @@ -2938,6 +2956,8 @@ fi # __enable_universe_repository() { + echodebug "__enable_universe_repository() entry" + if [ "$(grep -R universe /etc/apt/sources.list /etc/apt/sources.list.d/ | grep -v '#')" != "" ]; then # The universe repository is already enabled return 0 @@ -2951,6 +2971,7 @@ __enable_universe_repository() { } __install_saltstack_ubuntu_repository() { + # Workaround for latest non-LTS Ubuntu echodebug "__install_saltstack_ubuntu_repository() entry" @@ -2994,14 +3015,13 @@ __install_saltstack_ubuntu_repository() { if [ "$STABLE_REV" != "latest" ]; then # latest is default - STABLE_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1) - if [ "$STABLE_REV_MAJOR" -eq "3006" ]; then + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3006.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $STABLE_REV.*" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 - elif [ "$STABLE_REV_MAJOR" -eq "3007" ]; then + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3007.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $STABLE_REV" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 fi fi @@ -3011,6 +3031,7 @@ __install_saltstack_ubuntu_repository() { __install_saltstack_ubuntu_onedir_repository() { echodebug "__install_saltstack_ubuntu_onedir_repository() entry" + # Workaround for latest non-LTS Ubuntu if { [ "$DISTRO_MAJOR_VERSION" -eq 20 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]; } || \ { [ "$DISTRO_MAJOR_VERSION" -eq 22 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]; } || \ @@ -3046,14 +3067,13 @@ __install_saltstack_ubuntu_onedir_repository() { if [ "$ONEDIR_REV" != "latest" ]; then # latest is default - ONEDIR_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$ONEDIR_REV_MAJOR" -eq "3006" ]; then + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3006.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $ONEDIR_REV.*" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 - elif [ "$ONEDIR_REV_MAJOR" -eq "3007" ]; then + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3007.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $ONEDIR_REV" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 fi fi @@ -3100,6 +3120,9 @@ install_ubuntu_deps() { # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + ## include hwclock if not part of base OS (23.10 and up) if [ ! -f /usr/sbin/hwclock ]; then __PACKAGES="${__PACKAGES} util-linux-extra" @@ -3183,6 +3206,9 @@ install_ubuntu_git_deps() { __PACKAGES="${__PACKAGES} util-linux-extra" fi + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -3230,6 +3256,8 @@ install_ubuntu_onedir_deps() { install_ubuntu_stable() { + __wait_for_apt apt-get update || return 1 + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then @@ -3287,6 +3315,8 @@ install_ubuntu_git() { install_ubuntu_onedir() { + __wait_for_apt apt-get update || return 1 + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then @@ -3323,7 +3353,6 @@ install_ubuntu_stable_post() { [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - ## if [ -f /bin/systemctl ]; then if [ "$_SYSTEMD_FUNCTIONAL" -eq $BS_TRUE ]; then # Using systemd /bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || ( @@ -3481,25 +3510,19 @@ __install_saltstack_debian_repository() { # shellcheck disable=SC2086,SC2090 __apt_get_install_noinput ${__PACKAGES} || return 1 - ## SALTSTACK_DEBIAN_URL="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/debian/${DEBIAN_RELEASE}/${__REPO_ARCH}/${STABLE_REV}" - ## echo "$__REPO_ARCH_DEB $SALTSTACK_DEBIAN_URL $DEBIAN_CODENAME main" > "/etc/apt/sources.list.d/salt.list" - ## __apt_key_fetch "$SALTSTACK_DEBIAN_URL/SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 - ## __wait_for_apt apt-get update || return 1 - __fetch_url "/etc/apt/sources.list.d/salt.sources" "https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.sources" __apt_key_fetch "${HTTP_VAL}://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" || return 1 __wait_for_apt apt-get update || return 1 if [ "$STABLE_REV" != "latest" ]; then # latest is default - STABLE_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1) - if [ "$STABLE_REV_MAJOR" -eq "3006" ]; then + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3006.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $STABLE_REV.*" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 - elif [ "$STABLE_REV_MAJOR" -eq "3007" ]; then + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3007.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $STABLE_REV" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 fi fi @@ -3536,14 +3559,13 @@ __install_saltstack_debian_onedir_repository() { if [ "$ONEDIR_REV" != "latest" ]; then # latest is default - ONEDIR_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$ONEDIR_REV_MAJOR" -eq "3006" ]; then + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3006.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $ONEDIR_REV.*" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 - elif [ "$ONEDIR_REV_MAJOR" -eq "3007" ]; then + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001 - echo "Pin: version 3007.*" >> /etc/apt/preferences.d/salt-pin-1001 + echo "Pin: version $ONEDIR_REV" >> /etc/apt/preferences.d/salt-pin-1001 echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001 fi fi @@ -3587,6 +3609,9 @@ install_debian_onedir_deps() { # YAML module is used for generating custom master/minion configs __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-yaml" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -3628,6 +3653,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}" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -3642,6 +3670,8 @@ install_debian_git_deps() { install_debian_stable() { + __wait_for_apt apt-get update || return 1 + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then @@ -3721,6 +3751,8 @@ install_debian_12_git() { install_debian_onedir() { + __wait_for_apt apt-get update || return 1 + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then @@ -3863,12 +3895,27 @@ __install_saltstack_fedora_onedir_repository() { FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo" __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}" if [ "$ONEDIR_REV" != "latest" ]; then - # 3006.x is default - REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$REPO_REV_MAJOR" -eq "3007" ]; then - # Enable the Salt 3007 STS repo - dnf config-manager --set-disable salt-repo-* - dnf config-manager --set-enabled salt-repo-3007-sts + # 3006.x is default, and latest for 3006.x branch + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # latest version for branch 3006 | 3007 + REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) + if [ "$REPO_REV_MAJOR" -eq "3007" ]; then + # Enable the Salt 3007 STS repo + dnf config-manager --set-disable salt-repo-* + dnf config-manager --set-enabled salt-repo-3007-sts + fi + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # using minor version + echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}" + # shellcheck disable=SC2129 + echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi else # Enable the Salt LATEST repo @@ -3876,6 +3923,7 @@ __install_saltstack_fedora_onedir_repository() { dnf config-manager --set-enabled salt-repo-latest fi dnf clean expire-cache || return 1 + dnf makecache || return 1 elif [ "$ONEDIR_REV" != "latest" ]; then echowarn "salt.repo already exists, ignoring salt version argument." @@ -3910,6 +3958,9 @@ install_fedora_deps() { echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" fi + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __dnf_install_noinput ${__PACKAGES} ${_EXTRA_PACKAGES} || return 1 @@ -3940,6 +3991,10 @@ install_fedora_git_deps() { __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++" + + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __dnf_install_noinput ${__PACKAGES} || return 1 @@ -4069,6 +4124,9 @@ install_fedora_onedir_deps() { __PACKAGES="dnf-utils chkconfig procps-ng" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -4087,27 +4145,37 @@ install_fedora_onedir() { STABLE_REV=$ONEDIR_REV #install_fedora_stable || return 1 + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # Major version Salt, config and repo already setup + MINOR_VER_STRG="" + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # Minor version Salt, need to add specific minor version + MINOR_VER_STRG="-$STABLE_REV" + else + MINOR_VER_STRG="" + fi __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-cloud" + __PACKAGES="${__PACKAGES} salt-cloud$MINOR_VER_STRG" fi if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-master" + __PACKAGES="${__PACKAGES} salt-master$MINOR_VER_STRG" fi if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-minion" + __PACKAGES="${__PACKAGES} salt-minion$MINOR_VER_STRG" fi if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-syndic" + __PACKAGES="${__PACKAGES} salt-syndic$MINOR_VER_STRG" fi if [ "$_INSTALL_SALT_API" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-api" + __PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG" fi # shellcheck disable=SC2086 + dnf makecache || return 1 __yum_install_noinput ${__PACKAGES} || return 1 return 0 @@ -4154,12 +4222,27 @@ __install_saltstack_rhel_onedir_repository() { FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo" __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}" if [ "$ONEDIR_REV" != "latest" ]; then - # 3006.x is default - REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$REPO_REV_MAJOR" -eq "3007" ]; then - # Enable the Salt 3007 STS repo - dnf config-manager --set-disable salt-repo-* - dnf config-manager --set-enabled salt-repo-3007-sts + # 3006.x is default, and latest for 3006.x branch + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # latest version for branch 3006 | 3007 + REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) + if [ "$REPO_REV_MAJOR" -eq "3007" ]; then + # Enable the Salt 3007 STS repo + dnf config-manager --set-disable salt-repo-* + dnf config-manager --set-enabled salt-repo-3007-sts + fi + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # using minor version + echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}" + # shellcheck disable=SC2129 + echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi else # Enable the Salt LATEST repo @@ -4167,6 +4250,7 @@ __install_saltstack_rhel_onedir_repository() { dnf config-manager --set-enabled salt-repo-latest fi dnf clean expire-cache || return 1 + dnf makecache || return 1 elif [ "$ONEDIR_REV" != "latest" ]; then echowarn "salt.repo already exists, ignoring salt version argument." echowarn "Use -F (forced overwrite) to install $ONEDIR_REV." @@ -4201,6 +4285,9 @@ install_centos_stable_deps() { __PACKAGES="yum-utils chkconfig procps-ng findutils" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -4215,26 +4302,40 @@ install_centos_stable_deps() { install_centos_stable() { + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # Major version Salt, config and repo already setup + MINOR_VER_STRG="" + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # Minor version Salt, need to add specific minor version + MINOR_VER_STRG="-$STABLE_REV" + else + MINOR_VER_STRG="" + fi + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-cloud" + __PACKAGES="${__PACKAGES} salt-cloud$MINOR_VER_STRG" fi if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-master" + __PACKAGES="${__PACKAGES} salt-master$MINOR_VER_STRG" fi if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-minion" + __PACKAGES="${__PACKAGES} salt-minion$MINOR_VER_STRG" fi if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-syndic" + __PACKAGES="${__PACKAGES} salt-syndic$MINOR_VER_STRG" fi if [ "$_INSTALL_SALT_API" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-api" + __PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG" fi + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 + yum makecache || return 1 __yum_install_noinput ${__PACKAGES} || return 1 # Workaround for 3.11 broken on CentOS Stream 8.x @@ -4312,6 +4413,9 @@ install_centos_git_deps() { __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -4408,6 +4512,9 @@ install_centos_onedir_deps() { __PACKAGES="yum-utils chkconfig procps-ng findutils" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -4422,26 +4529,38 @@ install_centos_onedir_deps() { install_centos_onedir() { + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # Major version Salt, config and repo already setup + MINOR_VER_STRG="" + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # Minor version Salt, need to add specific minor version + MINOR_VER_STRG="-$ONEDIR_REV" + else + MINOR_VER_STRG="" + fi + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-cloud" + __PACKAGES="${__PACKAGES} salt-cloud$MINOR_VER_STRG" fi if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-master" + __PACKAGES="${__PACKAGES} salt-master$MINOR_VER_STRG" fi if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-minion" + __PACKAGES="${__PACKAGES} salt-minion$MINOR_VER_STRG" fi if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-syndic" + __PACKAGES="${__PACKAGES} salt-syndic$MINOR_VER_STRG" fi if [ "$_INSTALL_SALT_API" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-api" + __PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG" fi # shellcheck disable=SC2086 + dnf makecache || return 1 + dnf list salt-minion || return 1 __yum_install_noinput ${__PACKAGES} || return 1 return 0 @@ -4993,79 +5112,79 @@ install_oracle_linux_check_services() { ####################################################################################################################### # -# AlmaLinux Install Functions +# RockyLinux Install Functions # -install_almalinux_stable_deps() { +install_rockylinux_stable_deps() { install_centos_stable_deps || return 1 return 0 } -install_almalinux_git_deps() { +install_rockylinux_git_deps() { install_centos_git_deps || return 1 return 0 } -install_almalinux_onedir_deps() { +install_rockylinux_onedir_deps() { install_centos_onedir_deps || return 1 return 0 } -install_almalinux_testing_deps() { +install_rockylinux_testing_deps() { install_centos_testing_deps || return 1 return 0 } -install_almalinux_stable() { +install_rockylinux_stable() { install_centos_stable || return 1 return 0 } -install_almalinux_git() { +install_rockylinux_git() { install_centos_git || return 1 return 0 } -install_almalinux_onedir() { +install_rockylinux_onedir() { install_centos_onedir || return 1 return 0 } -install_almalinux_testing() { +install_rockylinux_testing() { install_centos_testing || return 1 return 0 } -install_almalinux_stable_post() { +install_rockylinux_stable_post() { install_centos_stable_post || return 1 return 0 } -install_almalinux_git_post() { +install_rockylinux_git_post() { install_centos_git_post || return 1 return 0 } -install_almalinux_onedir_post() { +install_rockylinux_onedir_post() { install_centos_onedir_post || return 1 return 0 } -install_almalinux_testing_post() { +install_rockylinux_testing_post() { install_centos_testing_post || return 1 return 0 } -install_almalinux_restart_daemons() { +install_rockylinux_restart_daemons() { install_centos_restart_daemons || return 1 return 0 } -install_almalinux_check_services() { +install_rockylinux_check_services() { install_centos_check_services || return 1 return 0 } # -# Ended AlmaLinux Install Functions +# Ended RockyLinux Install Functions # ####################################################################################################################### @@ -5494,6 +5613,9 @@ install_amazon_linux_ami_2_git_deps() { __PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -5514,7 +5636,12 @@ install_amazon_linux_ami_2_deps() { # We need to install yum-utils before doing anything else when installing on # Amazon Linux ECS-optimized images. See issue #974. - __yum_install_noinput yum-utils + __PACKAGES="yum-utils" + + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + + __yum_install_noinput ${__PACKAGES} # Do upgrade early if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then @@ -5526,12 +5653,27 @@ install_amazon_linux_ami_2_deps() { FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo" __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}" if [ "$STABLE_REV" != "latest" ]; then - # 3006.x is default - REPO_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1) - if [ "$REPO_REV_MAJOR" -eq "3007" ]; then - # Enable the Salt 3007 STS repo - dnf config-manager --set-disable salt-repo-* - dnf config-manager --set-enabled salt-repo-3007-sts + # 3006.x is default, and latest for 3006.x branch + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # latest version for branch 3006 | 3007 + REPO_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1) + if [ "$REPO_REV_MAJOR" -eq "3007" ]; then + # Enable the Salt 3007 STS repo + dnf config-manager --set-disable salt-repo-* + dnf config-manager --set-enabled salt-repo-3007-sts + fi + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # using minor version + echo "[salt-repo-${STABLE_REV}-lts]" > "${YUM_REPO_FILE}" + # shellcheck disable=SC2129 + echo "name=Salt Repo for Salt v${STABLE_REV} LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi else # Enable the Salt LATEST repo @@ -5539,6 +5681,7 @@ install_amazon_linux_ami_2_deps() { dnf config-manager --set-enabled salt-repo-latest fi dnf clean expire-cache || return 1 + dnf makecache || return 1 fi fi @@ -5557,7 +5700,12 @@ install_amazon_linux_ami_2_onedir_deps() { # We need to install yum-utils before doing anything else when installing on # Amazon Linux ECS-optimized images. See issue #974. - __yum_install_noinput yum-utils + __PACKAGES="yum-utils" + + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + + __yum_install_noinput ${__PACKAGES} # Do upgrade early if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then @@ -5569,12 +5717,27 @@ install_amazon_linux_ami_2_onedir_deps() { FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo" __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}" if [ "$ONEDIR_REV" != "latest" ]; then - # 3006.x is default - REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$REPO_REV_MAJOR" -eq "3007" ]; then - # Enable the Salt 3007 STS repo - dnf config-manager --set-disable salt-repo-* - dnf config-manager --set-enabled salt-repo-3007-sts + # 3006.x is default, and latest for 3006.x branch + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # latest version for branch 3006 | 3007 + REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) + if [ "$REPO_REV_MAJOR" -eq "3007" ]; then + # Enable the Salt 3007 STS repo + dnf config-manager --set-disable salt-repo-* + dnf config-manager --set-enabled salt-repo-3007-sts + fi + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # using minor version + echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}" + # shellcheck disable=SC2129 + echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi else # Enable the Salt LATEST repo @@ -5582,6 +5745,7 @@ install_amazon_linux_ami_2_onedir_deps() { dnf config-manager --set-enabled salt-repo-latest fi dnf clean expire-cache || return 1 + dnf makecache || return 1 fi fi @@ -5668,6 +5832,9 @@ install_amazon_linux_ami_2023_git_deps() { __PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc" + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 @@ -5684,7 +5851,12 @@ install_amazon_linux_ami_2023_onedir_deps() { # We need to install yum-utils before doing anything else when installing on # Amazon Linux ECS-optimized images. See issue #974. - __yum_install_noinput yum-utils + __PACKAGES="yum-utils" + + # ensure sudo installed + __PACKAGES="${__PACKAGES} sudo" + + __yum_install_noinput ${__PACKAGES} # Do upgrade early if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then @@ -5696,12 +5868,27 @@ install_amazon_linux_ami_2023_onedir_deps() { FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo" __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}" if [ "$ONEDIR_REV" != "latest" ]; then - # 3006.x is default - REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$REPO_REV_MAJOR" -eq "3007" ]; then - # Enable the Salt 3007 STS repo - dnf config-manager --set-disable salt-repo-* - dnf config-manager --set-enabled salt-repo-3007-sts + # 3006.x is default, and latest for 3006.x branch + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # latest version for branch 3006 | 3007 + REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) + if [ "$REPO_REV_MAJOR" -eq "3007" ]; then + # Enable the Salt 3007 STS repo + dnf config-manager --set-disable salt-repo-* + dnf config-manager --set-enabled salt-repo-3007-sts + fi + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # using minor version + echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}" + # shellcheck disable=SC2129 + echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi else # Enable the Salt LATEST repo @@ -5709,6 +5896,7 @@ install_amazon_linux_ami_2023_onedir_deps() { dnf config-manager --set-enabled salt-repo-latest fi dnf clean expire-cache || return 1 + dnf makecache || return 1 fi fi @@ -6025,6 +6213,37 @@ install_arch_linux_onedir_post() { # Photon OS Install Functions # +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __rpm_get_packagesite_onedir_latest +# DESCRIPTION: Set _GENERIC_PKG_VERSION to the latest for RPM or latest for major version input +#---------------------------------------------------------------------------------------------------------------------- +__get_packagesite_onedir_latest() { + + echodebug "Find latest rpm release from repository" + + # get dir listing from url, sort and pick highest + generic_versions_tmpdir=$(mktemp -d) + curr_pwd=$(pwd) + cd ${generic_versions_tmpdir} || return 1 + + # leverage the windows directories since release Windows and Linux + wget -q -r -np -nH --exclude-directories=onedir,relenv,macos -x -l 1 "https://${_REPO_URL}/saltproject-generic/windows/" + if [ "$#" -gt 0 ] && [ -n "$1" ]; then + MAJOR_VER="$1" + # shellcheck disable=SC2010 + _GENERIC_PKG_VERSION=$(ls artifactory/saltproject-generic/windows/ | grep -v 'index.html' | sort -V -u | grep -E "$MAJOR_VER" | tail -n 1) + else + # shellcheck disable=SC2010 + _GENERIC_PKG_VERSION=$(ls artifactory/saltproject-generic/windows/ | grep -v 'index.html' | sort -V -u | tail -n 1) + fi + cd ${curr_pwd} || return "${_GENERIC_PKG_VERSION}" + rm -fR ${generic_versions_tmpdir} + + echodebug "latest rpm release from repository found ${_GENERIC_PKG_VERSION}" + +} + + __install_saltstack_photon_onedir_repository() { echodebug "__install_saltstack_photon_onedir_repository() entry" @@ -6039,34 +6258,48 @@ __install_saltstack_photon_onedir_repository() { ## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}" # shellcheck disable=SC2129 if [ "$ONEDIR_REV" != "latest" ]; then - # 3006.x is default - REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) - if [ "$REPO_REV_MAJOR" -eq "3007" ]; then - # Enable the Salt 3007 STS repo - ## tdnf config-manager --set-disable salt-repo-* - ## tdnf config-manager --set-enabled salt-repo-3007-sts - echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}" - echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}" - echo "baseurl=https://packages.broadcom.com/artifactory/saltproject-rpm/" >> "${YUM_REPO_FILE}" - echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" - echo "priority=10" >> "${YUM_REPO_FILE}" - echo "enabled=1" >> "${YUM_REPO_FILE}" - echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" - echo "gpgcheck=1" >> "${YUM_REPO_FILE}" - echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}" - echo "gpgkey=https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" - else - # Salt 3006 repo - echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}" - echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}" - echo "baseurl=https://packages.broadcom.com/artifactory/saltproject-rpm/" >> "${YUM_REPO_FILE}" + # 3006.x is default, and latest for 3006.x branch + if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # latest version for branch 3006 | 3007 + REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1) + if [ "$REPO_REV_MAJOR" -eq "3007" ]; then + # Enable the Salt 3007 STS repo + ## tdnf config-manager --set-disable salt-repo-* + ## tdnf config-manager --set-enabled salt-repo-3007-sts + echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}" + echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" + else + # Salt 3006 repo + echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}" + echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" + echo "priority=10" >> "${YUM_REPO_FILE}" + echo "enabled=1" >> "${YUM_REPO_FILE}" + echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" + echo "gpgcheck=1" >> "${YUM_REPO_FILE}" + echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" + fi + elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # using minor version + echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}" + echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" echo "priority=10" >> "${YUM_REPO_FILE}" echo "enabled=1" >> "${YUM_REPO_FILE}" echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" echo "gpgcheck=1" >> "${YUM_REPO_FILE}" - echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}" - echo "gpgkey=https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi else # Enable the Salt LATEST repo @@ -6074,13 +6307,13 @@ __install_saltstack_photon_onedir_repository() { ## tdnf config-manager --set-enabled salt-repo-latest echo "[salt-repo-latest]" > "${YUM_REPO_FILE}" echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}" - echo "baseurl=https://packages.broadcom.com/artifactory/saltproject-rpm/" >> "${YUM_REPO_FILE}" + echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}" echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}" echo "priority=10" >> "${YUM_REPO_FILE}" echo "enabled=1" >> "${YUM_REPO_FILE}" echo "enabled_metadata=1" >> "${YUM_REPO_FILE}" echo "gpgcheck=1" >> "${YUM_REPO_FILE}" - echo "gpgkey=https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" + echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}" fi tdnf makecache || return 1 elif [ "$ONEDIR_REV" != "latest" ]; then @@ -6331,27 +6564,42 @@ install_photon_onedir_deps() { install_photon_onedir() { + echodebug "install_photon_onedir() entry" STABLE_REV=$ONEDIR_REV + _GENERIC_PKG_VERSION="" + + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # Major version Salt, config and repo already setup + __get_packagesite_onedir_latest "$STABLE_REV" + MINOR_VER_STRG="-$_GENERIC_PKG_VERSION" + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # Minor version Salt, need to add specific minor version + MINOR_VER_STRG="-$STABLE_REV" + else + # default to latest version Salt, config and repo already setup + __get_packagesite_onedir_latest + MINOR_VER_STRG="-$_GENERIC_PKG_VERSION" + fi __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-cloud" + __PACKAGES="${__PACKAGES} salt-cloud$MINOR_VER_STRG" fi if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-master" + __PACKAGES="${__PACKAGES} salt-master$MINOR_VER_STRG" fi if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-minion" + __PACKAGES="${__PACKAGES} salt-minion$MINOR_VER_STRG" fi if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-syndic" + __PACKAGES="${__PACKAGES} salt-syndic$MINOR_VER_STRG" fi if [ "$_INSTALL_SALT_API" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-api" + __PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG" fi # shellcheck disable=SC2086 @@ -6535,23 +6783,33 @@ install_opensuse_onedir_deps() { } install_opensuse_stable() { + if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # Major version Salt, config and repo already setup + MINOR_VER_STRG="" + elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then + # Minor version Salt, need to add specific minor version + MINOR_VER_STRG="-$STABLE_REV" + else + MINOR_VER_STRG="" + fi + __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then - __PACKAGES="${__PACKAGES} salt-cloud" + __PACKAGES="${__PACKAGES} salt-cloud$MINOR_VER_STRG" fi if [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-master" + __PACKAGES="${__PACKAGES} salt-master$MINOR_VER_STRG" fi if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-minion" + __PACKAGES="${__PACKAGES} salt-minion$MINOR_VER_STRG" fi if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-syndic" + __PACKAGES="${__PACKAGES} salt-syndic$MINOR_VER_STRG" fi if [ "$_INSTALL_SALT_API" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} salt-api" + __PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG" fi # shellcheck disable=SC2086 @@ -7258,7 +7516,7 @@ daemons_running_voidlinux() { #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __macosx_get_packagesite_onedir_latest -# DESCRIPTION: Set _PKG_VERSION to the latest for MacOS +# DESCRIPTION: Set _PKG_VERSION to the latest for MacOS or latest for major version input #---------------------------------------------------------------------------------------------------------------------- __macosx_get_packagesite_onedir_latest() { @@ -7268,9 +7526,15 @@ __macosx_get_packagesite_onedir_latest() { macos_versions_tmpdir=$(mktemp -d) curr_pwd=$(pwd) cd ${macos_versions_tmpdir} || return 1 - wget -r -np -nH --exclude-directories=onedir,relenv,windows -x -l 1 "$SALT_MACOS_PKGDIR_URL/" - # shellcheck disable=SC2010 - _PKG_VERSION=$(ls artifactory/saltproject-generic/macos/ | grep -v 'index.html' | sort -V -u | tail -n 1) + wget -q -r -np -nH --exclude-directories=onedir,relenv,windows -x -l 1 "$SALT_MACOS_PKGDIR_URL/" + if [ "$#" -gt 0 ] && [ -n "$1" ]; then + MAJOR_VER="$1" + # shellcheck disable=SC2010 + _PKG_VERSION=$(ls artifactory/saltproject-generic/macos/ | grep -v 'index.html' | sort -V -u | grep -E "$MAJOR_VER" | tail -n 1) + else + # shellcheck disable=SC2010 + _PKG_VERSION=$(ls artifactory/saltproject-generic/macos/ | grep -v 'index.html' | sort -V -u | tail -n 1) + fi cd ${curr_pwd} || return "${_PKG_VERSION}" rm -fR ${macos_versions_tmpdir} @@ -7294,11 +7558,15 @@ __macosx_get_packagesite_onedir() { _ONEDIR_TYPE="saltproject-generic" SALT_MACOS_PKGDIR_URL="https://${_REPO_URL}/${_ONEDIR_TYPE}/macos" if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then - __macosx_get_packagesite_onedir_latest - elif [ "$(echo "$_ONEDIR_REV" | grep -E '^([3-9][0-9]{3}(\.[0-9]*))')" != "" ]; then - _PKG_VERSION=$_ONEDIR_REV + __macosx_get_packagesite_onedir_latest + elif [ "$(echo "$_ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then + # need to get latest for major version + __macosx_get_packagesite_onedir_latest "$_ONEDIR_REV" + elif [ "$(echo "$_ONEDIR_REV" | grep -E '^([3-9][0-9]{3}(\.[0-9]*)?)')" != "" ]; then + _PKG_VERSION=$_ONEDIR_REV else - __macosx_get_packagesite_onedir_latest + # default to getting latest + __macosx_get_packagesite_onedir_latest fi PKG="salt-${_PKG_VERSION}-py3-${DARWIN_ARCH}.pkg" diff --git a/tests/conftest.py b/tests/conftest.py index 154b257c0..5d5702c12 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,7 +18,6 @@ def target_python_version(): def target_salt_version(): target_salt = os.environ.get("SaltVersion", "") - html_response = requests.get(API_URL) content = json.loads(html_response.text) folders = content["children"] @@ -36,6 +35,14 @@ def target_salt_version(): target_salt = target_salt[1:] if target_salt not in versions: pytest.skip(f"Invalid testing version: {target_salt}") - if target_salt in ("default", "latest", "master", "nightly"): + if target_salt in ( + "default", + "latest", + "master", + "nightly", + "stable", + "onedir", + "git", + ): pytest.skip("Don't have a specific salt version to test against") return versions[target_salt] diff --git a/tests/integration/test_installation.py b/tests/integration/test_installation.py index f8427b675..714b8e166 100644 --- a/tests/integration/test_installation.py +++ b/tests/integration/test_installation.py @@ -15,7 +15,9 @@ def path(): salt_path = "C:\\Program Files\\Salt Project\\Salt" if salt_path not in os.environ["path"]: os.environ["path"] = f'{os.environ["path"]};{salt_path}' - yield os.environ["path"] + yield os.environ["path"] + else: + yield "" def run_salt_call(cmd): @@ -23,9 +25,33 @@ def run_salt_call(cmd): Runs salt call command and returns a dictionary Accepts cmd as a list """ - cmd.append("--out=json") - result = subprocess.run(cmd, capture_output=True, text=True) - json_data = json.loads(result.stdout) + json_data = {"local": {}} + 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: + log.error(f"failed to produce output result, '{result}'") + + else: + cmdl = ["sudo"] + 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: + log.error(f"failed to produce output result, '{result}'") + return json_data["local"] @@ -48,5 +74,10 @@ 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 \ No newline at end of file + assert result["saltversion"] == target_salt_version