/
githubmirror
/
salt
Обзор
Документация
Войти
/
githubmirror
/
salt
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
.github/workflows/test-packages-action.yml
575 строк
21 KB
Daniel A. Wozniak
Merge branch '3008.x' into merge/3008.x/master-26-06-24
26 июн 2026, 00:39
26 июн 2026, 00:39
0ab117d
Код
Авторство
О чём код?
--- name: Test Packages on: workflow_call: inputs: salt-version: type: string required: true description: The Salt version of the packages to install and test cache-prefix: required: true type: string description: Seed used to invalidate caches testing-releases: required: true type: string description: A JSON list of releases to test upgrades against nox-version: required: true type: string description: The nox version to install ci-python-version: required: true type: string description: The python version to run tests with nox-session: required: false type: string description: The nox session to run default: ci-test-onedir skip-code-coverage: required: false type: boolean description: Skip code coverage default: false package-name: required: false type: string description: The onedir package name to use default: salt matrix: required: true type: string description: Json job matrix config linux_arm_runner: required: true type: string description: Json job matrix config raise-deprecations-runtime-errors: required: true type: string description: Whether to raise RuntimeError on deprecation warnings ("1" or "0") env: COLUMNS: 190 AWS_MAX_ATTEMPTS: "10" AWS_RETRY_MODE: "adaptive" PIP_INDEX_URL: ${{ vars.PIP_INDEX_URL }} PIP_TRUSTED_HOST: ${{ vars.PIP_TRUSTED_HOST }} PIP_EXTRA_INDEX_URL: ${{ vars.PIP_EXTRA_INDEX_URL }} PIP_DISABLE_PIP_VERSION_CHECK: "1" RAISE_DEPRECATIONS_RUNTIME_ERRORS: ${{ inputs.raise-deprecations-runtime-errors }} USE_S3_CACHE: 'false' jobs: test-linux: name: ${{ matrix.display_name }} ${{ matrix.tests-chunk }} ${{ matrix.version }} runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || inputs.linux_arm_runner }} if: ${{ !cancelled() && toJSON(fromJSON(inputs.matrix)['linux']) != '[]' }} timeout-minutes: 120 # 2 Hours - More than this and something is wrong strategy: fail-fast: false matrix: include: ${{ fromJSON(inputs.matrix)['linux'] }} steps: - name: "Throttle Builds" shell: bash run: | t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(1, 15)))'); echo "Sleeping $t seconds"; sleep "$t" - name: "Set `TIMESTAMP` environment variable" shell: bash run: | echo "TIMESTAMP=$(date +%s)" | tee -a "$GITHUB_ENV" - name: Checkout Source Code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Setup Salt Version shell: bash run: echo "${{ inputs.salt-version }}" > salt/_version.txt - name: Set up Python ${{ inputs.ci-python-version }} uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: "${{ inputs.ci-python-version }}" - name: Setup Python Tools Scripts uses: ./.github/actions/setup-python-tools-scripts with: cache-prefix: ${{ inputs.cache-prefix }} - name: Download Packages uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: ${{ inputs.package-name }}-${{ inputs.salt-version }}-${{ matrix.arch }}-${{ matrix.pkg_type }} path: artifacts/pkg/ - name: Download Onedir Tarball as an Artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ matrix.platform }}-${{ matrix.arch }}.tar.xz path: artifacts/ - name: Decompress Onedir Tarball shell: bash run: | python3 -c "import os; os.makedirs('artifacts', exist_ok=True)" cd artifacts tar xvf ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ matrix.platform }}-${{ matrix.arch }}.tar.xz - name: Install Nox run: | python3 -m pip install 'nox==${{ inputs.nox-version }}' env: PIP_INDEX_URL: https://pypi.org/simple - name: List Packages run: | tree artifacts/pkg/ - name: Download nox.linux.${{ matrix.arch }}.tar.* artifact for session ${{ inputs.nox-session }} uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: nox-linux-${{ matrix.arch }}-${{ inputs.nox-session }} - name: "Ensure docker is running" run: | sudo systemctl start containerd || exit 0 - name: "Pull container ${{ matrix.container }}" run: | docker pull ${{ matrix.container }} - name: "Create container ${{ matrix.container }}" env: FIPS_TESTRUN: ${{ matrix.fips && '1' || '0' }} run: | tools container create ${{ matrix.container }} --name ${{ github.run_id }}_salt-test-pkg - name: "Start container ${{ matrix.container }}" run: | /usr/bin/docker start ${{ github.run_id }}_salt-test-pkg - name: Fix PhotonOS password expiration if: startsWith(matrix.slug, 'photonos-') run: | docker exec ${{ github.run_id }}_salt-test-pkg chage -I -1 -m 0 -M 99999 -E -1 root - name: Fix PhotonOS repository URLs if: startsWith(matrix.slug, 'photonos-') run: | docker exec ${{ github.run_id }}_salt-test-pkg \ sh -c "for f in /etc/yum.repos.d/photon*.repo; do [ -e \"\$f\" ] && sed -i -E 's/packages(-prod)?\.(vmware|broadcom)\.com\/photon/packages.broadcom.com\/photon/g' \"\$f\"; done && tdnf makecache" - name: Install FIPS provider if: ${{ matrix.fips && startsWith(matrix.slug, 'photonos-') }} run: | docker exec ${{ github.run_id }}_salt-test-pkg \ tdnf install -y openssl-fips-provider # openssl-fips-provider <= 3.1.2-3.ph5 disables the OpenSSL default # provider in /etc/ssl/distro.cnf, breaking TLS in curl/git/tdnf. # Re-enable it to mirror the upstream fix in vmware/photon@4610f36756 # (openssl-fips-provider 3.1.2-4.ph5). Idempotent on fixed builds. docker exec ${{ github.run_id }}_salt-test-pkg \ sed -i '/^#\.include \/etc\/ssl\/provider_default.cnf/s/^#//g' /etc/ssl/distro.cnf - name: Decompress .nox Directory run: | docker exec ${{ github.run_id}}_salt-test-pkg python3 -m nox --force-color -e decompress-dependencies -- linux ${{ matrix.arch }} - name: List Free Space run: | df -h || true - name: Show System Info run: | docker exec \ -e SKIP_REQUIREMENTS_INSTALL=1 \ -e PRINT_SYSTEM_INFO_ONLY=1 \ ${{ github.run_id }}_salt-test-pkg python3 -m nox --force-color -e ${{ inputs.nox-session }}-pkgs -- ${{ matrix.tests-chunk }} - name: Run Package Tests if: ${{ !cancelled() }} env: SALT_VERSION: "${{ inputs.salt-version }}" run: | echo "${{ inputs.salt-version }}" > salt/_version.txt docker exec \ -e SALT_VERSION \ ${{ github.run_id }}_salt-test-pkg \ python3 -m nox --force-color -e ${{ inputs.nox-session }}-pkgs -- ${{ matrix.tests-chunk }} \ ${{ matrix.version && format('--prev-version={0}', matrix.version) || ''}} - name: Upload Test Run Log Artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-log-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}${{ matrix.fips && '-fips' || '' }}-${{ matrix.pkg_type }}-${{ matrix.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts/logs include-hidden-files: true - name: Upload Test Run Artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-artifacts-${{ matrix.slug }}${{ matrix.fips && '-fips' || '' }}-${{ matrix.pkg_type }}-${{ matrix.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts/ !artifacts/pkg/* !artifacts/salt/* !artifacts/salt-*.tar.* include-hidden-files: true test-macos: name: ${{ matrix.display_name }} ${{ matrix.tests-chunk }} ${{ matrix.version }} runs-on: ${{ matrix.runner }} if: ${{ !cancelled() && toJSON(fromJSON(inputs.matrix)['macos']) != '[]' }} timeout-minutes: 150 # 2 & 1/2 Hours - More than this and something is wrong (MacOS needs a little more time) strategy: fail-fast: false matrix: include: ${{ fromJSON(inputs.matrix)['macos'] }} steps: - name: "Throttle Builds" shell: bash run: | t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(1, 15)))'); echo "Sleeping $t seconds"; sleep "$t" - name: "Set `TIMESTAMP` environment variable" shell: bash run: | echo "TIMESTAMP=$(date +%s)" | tee -a "$GITHUB_ENV" - name: Checkout Source Code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Setup Salt Version shell: bash run: echo "${{ inputs.salt-version }}" > salt/_version.txt - name: Download Packages uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-macos path: artifacts/pkg/ - name: Install System Dependencies run: | brew install tree - name: List Packages run: | tree artifacts/pkg/ - name: Download Onedir Tarball as an Artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ matrix.platform }}-${{ matrix.arch }}.tar.xz path: artifacts/ - name: Decompress Onedir Tarball shell: bash run: | python3 -c "import os; os.makedirs('artifacts', exist_ok=True)" cd artifacts tar xvf ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ matrix.platform }}-${{ matrix.arch }}.tar.xz - name: Set up Python ${{ inputs.ci-python-version }} uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: "${{ inputs.ci-python-version }}" - name: Install Nox run: | python3 -m pip install 'nox==${{ inputs.nox-version }}' env: PIP_INDEX_URL: https://pypi.org/simple - name: Download nox.macos.${{ matrix.arch }}.tar.* artifact for session ${{ inputs.nox-session }} uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: nox-macos-${{ matrix.arch }}-${{ inputs.nox-session }} - name: Decompress .nox Directory run: | nox --force-color -e decompress-dependencies -- macos ${{ matrix.arch }} - name: Show System Info env: SKIP_REQUIREMENTS_INSTALL: "1" PRINT_SYSTEM_INFO_ONLY: "1" run: | sudo -E nox --force-color -e ${{ inputs.nox-session }}-pkgs -- ${{ matrix.tests-chunk }} - name: Run Package Tests if: ${{ !cancelled() }} env: SKIP_REQUIREMENTS_INSTALL: "1" PRINT_TEST_SELECTION: "0" PRINT_TEST_PLAN_ONLY: "0" PRINT_SYSTEM_INFO: "0" RERUN_FAILURES: "1" GITHUB_ACTIONS_PIPELINE: "1" SKIP_INITIAL_GH_ACTIONS_FAILURES: "1" COVERAGE_CONTEXT: ${{ matrix.slug }} SALT_VERSION: "${{ inputs.salt-version }}" run: | echo "${{ inputs.salt-version }}" > salt/_version.txt sudo -E nox --force-color -e ${{ inputs.nox-session }}-pkgs -- ${{ matrix.tests-chunk }} \ ${{ matrix.version && format('--prev-version={0}', matrix.version) || ''}} - name: Fix file ownership run: | sudo chown -R "$(id -un)" . - name: Prepare Test Run Artifacts id: download-artifacts-from-vm if: always() run: | # Delete the salt onedir, we won't need it anymore and it will prevent # from it showing in the tree command below rm -rf artifacts/salt* tree -a artifacts - name: Upload Test Run Log Artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-log-artifacts-${{ matrix.slug }}-${{ matrix.pkg_type }}-${{ matrix.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts/logs include-hidden-files: true - name: Upload Test Run Artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-artifacts-${{ matrix.slug }}-${{ matrix.pkg_type }}-${{ matrix.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts/ !artifacts/pkg/* !artifacts/salt/* !artifacts/salt-*.tar.* include-hidden-files: true test-windows: name: ${{ matrix.display_name }} ${{ matrix.pkg_type }} ${{ matrix.tests-chunk }} ${{ matrix.version }} runs-on: ${{ matrix.runner }} timeout-minutes: 120 # 2 Hours - More than this and something is wrong if: ${{ !cancelled() && toJSON(fromJSON(inputs.matrix)['windows']) != '[]' }} strategy: fail-fast: false matrix: include: ${{ fromJSON(inputs.matrix)['windows'] }} steps: - name: Set up Python ${{ inputs.ci-python-version }} uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: "${{ inputs.ci-python-version }}" - name: "Throttle Builds" shell: bash run: | t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(1, 15)))'); echo "Sleeping $t seconds"; sleep "$t" - name: "Set `TIMESTAMP` environment variable" shell: bash run: | echo "TIMESTAMP=$(date +%s)" | tee -a "$GITHUB_ENV" - name: Checkout Source Code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Setup Salt Version shell: bash run: echo "${{ inputs.salt-version }}" > salt/_version.txt - name: Download Packages uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: ${{ inputs.package-name }}-${{ inputs.salt-version }}-${{ matrix.arch }}-${{ matrix.pkg_type }} path: ./artifacts/pkg/ - name: Download Onedir Tarball as an Artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ matrix.platform }}-${{ matrix.arch }}.tar.xz path: ./artifacts/ - name: Decompress Onedir Tarball shell: bash run: | python3 -c "import os; os.makedirs('artifacts', exist_ok=True)" cd artifacts tar xvf ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ matrix.platform }}-${{ matrix.arch }}.tar.xz - name: Patch cpython#104135 in onedir Lib/ssl.py # Test sessions create venvs from the onedir Python and run pip in # them; without this patch Python 3.10's _load_windows_store_certs # aborts on the first ASN.1-malformed cert in the Windows root store # under OpenSSL 3.5.x. Needed on Python 3.10 and 3.11 (cpython#104135 # was never backported); self-disables on 3.12+. # DURABLE CLEANUP: drop this step + the matching steps in # build-deps-ci-action.yml and test-action.yml + # cicd/windows-ssl-104135-patch.py + salt/__init__.py + # salt/ext/tornado/netutil.py once relenv ships the cpython#104135 # patch in its cpython build. See salt/__init__.py for the cleanup # pointer. shell: bash run: | python3 cicd/windows-ssl-104135-patch.py artifacts/salt/Lib/ssl.py - name: Install Nox run: | python3 -m pip install 'nox==${{ inputs.nox-version }}' env: PIP_INDEX_URL: https://pypi.org/simple - run: python3 --version - name: Download nox.windows.${{ matrix.arch }}.tar.* artifact for session ${{ inputs.nox-session }} uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: name: nox-windows-${{ matrix.arch }}-${{ inputs.nox-session }} - name: Decompress .nox Directory run: | nox --force-color -e decompress-dependencies -- windows ${{ matrix.arch }} - name: List Important Directories run: | dir . dir artifacts/ dir artifacts/pkg dir .nox/ci-test-onedir/Scripts - name: Check onedir python continue-on-error: true run: | artifacts/salt/Scripts/python.exe --version - name: Check nox python continue-on-error: true run: | .nox/ci-test-onedir/Scripts/python.exe --version - name: Show System Info env: SKIP_REQUIREMENTS_INSTALL: "1" SKIP_CODE_COVERAGE: "1" PRINT_SYSTEM_INFO_ONLY: "1" PYTHONUTF8: "1" run: | nox --force-color -f noxfile.py -e "${{ inputs.nox-session }}-pkgs" -- '${{ matrix.tests-chunk }}' --log-cli-level=debug - name: Run Package Tests if: ${{ !cancelled() }} env: SKIP_REQUIREMENTS_INSTALL: "1" PRINT_TEST_SELECTION: "0" PRINT_TEST_PLAN_ONLY: "0" PRINT_SYSTEM_INFO: "0" RERUN_FAILURES: "1" GITHUB_ACTIONS_PIPELINE: "1" SKIP_INITIAL_ONEDIR_FAILURES: "1" SKIP_INITIAL_GH_ACTIONS_FAILURES: "1" COVERAGE_CONTEXT: ${{ matrix.slug }} OUTPUT_COLUMNS: "190" PYTHONUTF8: "1" run: > nox --force-color -f noxfile.py -e ${{ inputs.nox-session }}-pkgs -- ${{ matrix.tests-chunk }} ${{ matrix.version && format('--prev-version={0}', matrix.version) || ''}} - name: Prepare Test Run Artifacts id: download-artifacts-from-vm if: always() shell: bash run: | # Delete the salt onedir, we won't need it anymore and it will prevent # from it showing in the tree command below rm -rf artifacts/salt* - name: Upload Test Run Log Artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-log-artifacts-${{ matrix.slug }}-${{ matrix.pkg_type }}-${{ matrix.arch }}-${{ matrix.tests-chunk }}-${{ inputs.salt-version }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts/logs include-hidden-files: true - name: Upload Test Run Artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-artifacts-${{ matrix.slug }}-${{ matrix.pkg_type }}-${{ matrix.arch }}-${{ matrix.tests-chunk }}-${{ inputs.salt-version }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts/ !artifacts/pkg/* !artifacts/salt/* !artifacts/salt-*.tar.* include-hidden-files: true report: name: Report runs-on: ubuntu-22.04 if: ${{ false }} needs: - test-linux - test-macos - test-windows strategy: matrix: include: ${{ fromJSON(inputs.matrix)['linux'] }} steps: - name: Checkout Source Code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Setup Salt Version shell: bash run: echo "${{ inputs.salt-version }}" > salt/_version.txt - name: "Throttle Builds" shell: bash run: | t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" - name: Wait For Artifacts run: | sleep 60 - name: Merge Test Run Artifacts continue-on-error: true uses: actions/upload-artifact/merge@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: pkg-testrun-artifacts-${{ matrix.slug }}${{ matrix.fips && '-fips' || '' }}-${{ matrix.pkg_type }} pattern: pkg-testrun-artifacts-${{ matrix.slug }}${{ matrix.fips && '-fips' || '' }}-${{ matrix.pkg_type }}-* separate-directories: true delete-merged: true - name: Wait For Artifacts 2 run: | sleep 60 - name: Download Test Run Artifacts id: download-test-run-artifacts uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: path: artifacts/ pattern: pkg-testrun-artifacts-${{ matrix.slug }}${{ matrix.fips && '-fips' || '' }}-${{ matrix.pkg_type }}* merge-multiple: true - name: Show Test Run Artifacts if: always() run: | tree -a artifacts