diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f3800a04330..22c42c9e5301 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2092,7 +2092,7 @@ jobs: id: merge-coverage-artifacts with: name: all-testrun-coverage-artifacts - pattern: all-testrun-coverage-artifacts-* + pattern: all-testrun-coverage-artifacts* separate-directories: false delete-merged: true diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 21dbfbe3e707..ea65ae1190f9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2157,7 +2157,7 @@ jobs: id: merge-coverage-artifacts with: name: all-testrun-coverage-artifacts - pattern: all-testrun-coverage-artifacts-* + pattern: all-testrun-coverage-artifacts* separate-directories: false delete-merged: true diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 2ccef7efda89..c4dea7b28a2f 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -2139,7 +2139,7 @@ jobs: id: merge-coverage-artifacts with: name: all-testrun-coverage-artifacts - pattern: all-testrun-coverage-artifacts-* + pattern: all-testrun-coverage-artifacts* separate-directories: false delete-merged: true diff --git a/.github/workflows/templates/ci.yml.jinja b/.github/workflows/templates/ci.yml.jinja index 93d534c5d90f..68aabb5e4abf 100644 --- a/.github/workflows/templates/ci.yml.jinja +++ b/.github/workflows/templates/ci.yml.jinja @@ -352,7 +352,7 @@ id: merge-coverage-artifacts with: name: all-testrun-coverage-artifacts - pattern: all-testrun-coverage-artifacts-* + pattern: all-testrun-coverage-artifacts* separate-directories: false delete-merged: true diff --git a/.github/workflows/test-action-linux.yml b/.github/workflows/test-action-linux.yml index bbf77fdc29f2..84d59c3c8284 100644 --- a/.github/workflows/test-action-linux.yml +++ b/.github/workflows/test-action-linux.yml @@ -127,6 +127,11 @@ jobs: 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@v4 @@ -275,7 +280,7 @@ jobs: if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' uses: actions/upload-artifact@v4 with: - name: testrun-coverage-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }} + name: testrun-coverage-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }}-${{ env.TIMESTAMP }} path: | artifacts/coverage/ @@ -283,7 +288,7 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: testrun-junit-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }} + name: testrun-junit-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }}-${{ env.TIMESTAMP }} path: | artifacts/xml-unittests-output/ @@ -291,13 +296,13 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: testrun-log-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }} + name: testrun-log-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }}-${{ env.TIMESTAMP }} path: | artifacts/logs report: name: Test Reports - if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && inputs.skip-code-coverage == false && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && needs.test.result != 'cancelled' && needs.test.result != 'skipped' runs-on: ubuntu-latest needs: - test @@ -314,17 +319,19 @@ jobs: - name: Merge JUnit XML Test Run Artifacts uses: actions/upload-artifact/merge@v4 + if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' with: name: testrun-junit-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }} - pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-* + pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true - name: Merge Log Test Run Artifacts uses: actions/upload-artifact/merge@v4 + if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' with: name: testrun-log-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }} - pattern: testrun-log-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-* + pattern: testrun-log-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true @@ -334,7 +341,7 @@ jobs: id: merge-coverage-artifacts with: name: testrun-coverage-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }} - pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}-* + pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true @@ -347,6 +354,7 @@ jobs: path: artifacts/coverage/ - name: Show Downloaded Test Run Artifacts + if: ${{ inputs.skip-code-coverage == false }} run: | tree -a artifacts diff --git a/.github/workflows/test-action-macos.yml b/.github/workflows/test-action-macos.yml index 5105682d3735..0c3879a2d391 100644 --- a/.github/workflows/test-action-macos.yml +++ b/.github/workflows/test-action-macos.yml @@ -120,6 +120,11 @@ jobs: 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@v4 @@ -303,7 +308,7 @@ jobs: if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' uses: actions/upload-artifact@v4 with: - name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }} + name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ env.TIMESTAMP }} path: | artifacts/coverage/ @@ -311,7 +316,7 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }} + name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ env.TIMESTAMP }} path: | artifacts/xml-unittests-output/ @@ -319,13 +324,13 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }} + name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ env.TIMESTAMP }} path: | artifacts/logs report: name: Test Reports - if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && inputs.skip-code-coverage == false && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && needs.test.result != 'cancelled' && needs.test.result != 'skipped' runs-on: ubuntu-latest needs: - test @@ -342,17 +347,19 @@ jobs: - name: Merge JUnit XML Test Run Artifacts uses: actions/upload-artifact/merge@v4 + if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' with: name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} - pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-* + pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true - name: Merge Log Test Run Artifacts uses: actions/upload-artifact/merge@v4 + if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' with: name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} - pattern: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-* + pattern: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true @@ -362,7 +369,7 @@ jobs: id: merge-coverage-artifacts with: name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} - pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-* + pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true @@ -375,6 +382,7 @@ jobs: path: artifacts/coverage/ - name: Show Downloaded Test Run Artifacts + if: ${{ inputs.skip-code-coverage == false }} run: | tree -a artifacts diff --git a/.github/workflows/test-action-windows.yml b/.github/workflows/test-action-windows.yml index ff4ab30758c3..41ea3269d7ad 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -127,6 +127,11 @@ jobs: 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@v4 @@ -275,7 +280,7 @@ jobs: if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' uses: actions/upload-artifact@v4 with: - name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }} + name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }}-${{ env.TIMESTAMP }} path: | artifacts/coverage/ @@ -283,7 +288,7 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }} + name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }}-${{ env.TIMESTAMP }} path: | artifacts/xml-unittests-output/ @@ -291,14 +296,14 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }} + name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-grp${{ matrix.test-group || '1' }}-${{ env.TIMESTAMP }} path: | artifacts/logs report: name: Test Reports - if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && inputs.skip-code-coverage == false && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && needs.test.result != 'cancelled' && needs.test.result != 'skipped' runs-on: ubuntu-latest needs: - test @@ -315,17 +320,19 @@ jobs: - name: Merge JUnit XML Test Run Artifacts uses: actions/upload-artifact/merge@v4 + if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' with: name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} - pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-* + pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true - name: Merge Log Test Run Artifacts uses: actions/upload-artifact/merge@v4 + if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' with: name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} - pattern: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-* + pattern: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true @@ -335,7 +342,7 @@ jobs: id: merge-coverage-artifacts with: name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} - pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-* + pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* separate-directories: false delete-merged: true @@ -348,6 +355,7 @@ jobs: path: artifacts/coverage/ - name: Show Downloaded Test Run Artifacts + if: ${{ inputs.skip-code-coverage == false }} run: | tree -a artifacts diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index a319f9f262eb..3bef3702cd2d 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -83,6 +83,7 @@ jobs: - x86_64 outputs: pkg-matrix-include: ${{ steps.generate-pkg-matrix.outputs.matrix }} + build-reports: ${{ steps.generate-pkg-matrix.outputs.build-reports }} steps: - name: "Throttle Builds" @@ -126,6 +127,11 @@ jobs: 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@v4 @@ -221,7 +227,7 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: pkg-testrun-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.pkg-type }}-${{ inputs.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}} + name: pkg-testrun-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.pkg-type }}-${{ inputs.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts !artifacts/pkg/* @@ -231,8 +237,9 @@ jobs: report: name: Report runs-on: ubuntu-latest - if: always() && inputs.skip-code-coverage == false && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && needs.test.result != 'cancelled' && needs.test.result != 'skipped' needs: + - generate-matrix - test steps: @@ -248,7 +255,7 @@ jobs: uses: actions/upload-artifact/merge@v4 with: name: pkg-testrun-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.pkg-type }} - pattern: pkg-testrun-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.pkg-type }}-* + pattern: pkg-testrun-artifacts-${{ inputs.distro-slug }}${{ inputs.fips && '-fips' || '' }}-${{ inputs.pkg-type }}* separate-directories: true delete-merged: true diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index df107359f03f..4d5bef699ff3 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -79,6 +79,7 @@ jobs: - x86_64 outputs: pkg-matrix-include: ${{ steps.generate-pkg-matrix.outputs.matrix }} + build-reports: ${{ steps.generate-pkg-matrix.outputs.build-reports }} steps: - name: "Throttle Builds" @@ -118,6 +119,11 @@ jobs: 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@v4 @@ -204,7 +210,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}-${{ inputs.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}} + name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}-${{ inputs.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts !artifacts/pkg/* @@ -214,8 +220,9 @@ jobs: report: name: Report runs-on: ubuntu-latest - if: always() && inputs.skip-code-coverage == false && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && needs.test.result != 'cancelled' && needs.test.result != 'skipped' needs: + - generate-matrix - test steps: @@ -231,7 +238,7 @@ jobs: uses: actions/upload-artifact/merge@v4 with: name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }} - pattern: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}-* + pattern: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}* separate-directories: true delete-merged: true diff --git a/.github/workflows/test-packages-action-windows.yml b/.github/workflows/test-packages-action-windows.yml index a3198ac6ffb6..33802c8c3b94 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -82,6 +82,7 @@ jobs: - x86_64 outputs: pkg-matrix-include: ${{ steps.generate-pkg-matrix.outputs.matrix }} + build-reports: ${{ steps.generate-pkg-matrix.outputs.build-reports }} steps: - name: "Throttle Builds" @@ -125,6 +126,11 @@ jobs: 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@v4 @@ -220,7 +226,7 @@ jobs: if: always() && steps.download-artifacts-from-vm.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}-${{ inputs.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}} + name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}-${{ inputs.arch }}-${{ matrix.tests-chunk }}-${{ matrix.version || 'no-version'}}-${{ env.TIMESTAMP }} path: | artifacts !artifacts/pkg/* @@ -230,8 +236,9 @@ jobs: report: name: Report runs-on: ubuntu-latest - if: always() && inputs.skip-code-coverage == false && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + if: always() && fromJSON(needs.generate-matrix.outputs.build-reports) && needs.test.result != 'cancelled' && needs.test.result != 'skipped' needs: + - generate-matrix - test steps: @@ -247,7 +254,7 @@ jobs: uses: actions/upload-artifact/merge@v4 with: name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }} - pattern: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}-* + pattern: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.pkg-type }}* separate-directories: true delete-merged: true diff --git a/salt/fileserver/roots.py b/salt/fileserver/roots.py index 91536d737ce7..e81f37dcf029 100644 --- a/salt/fileserver/roots.py +++ b/salt/fileserver/roots.py @@ -101,7 +101,9 @@ def _add_file_stat(fnd): full = os.path.join(root, path) # Refuse to serve file that is not under the root. - if not salt.utils.verify.clean_path(root, full, subdir=True): + if not salt.utils.verify.clean_path( + root, full, subdir=True, realpath=not __opts__["fileserver_followsymlinks"] + ): continue if os.path.isfile(full) and not salt.fileserver.is_file_ignored(__opts__, full): @@ -149,7 +151,9 @@ def serve_file(load, fnd): if saltenv == "__env__": root = root.replace("__env__", actual_saltenv) # Refuse to serve file that is not under the root. - if salt.utils.verify.clean_path(root, fpath, subdir=True): + if salt.utils.verify.clean_path( + root, fpath, subdir=True, realpath=not __opts__["fileserver_followsymlinks"] + ): file_in_root = True if not file_in_root: return ret diff --git a/salt/utils/verify.py b/salt/utils/verify.py index 4799e010e49e..85d9e5683908 100644 --- a/salt/utils/verify.py +++ b/salt/utils/verify.py @@ -524,25 +524,28 @@ def _realpath(path): return os.path.realpath(path) -def clean_path(root, path, subdir=False): +def clean_path(root, path, subdir=False, realpath=True): """ Accepts the root the path needs to be under and verifies that the path is under said root. Pass in subdir=True if the path can result in a - subdirectory of the root instead of having to reside directly in the root + subdirectory of the root instead of having to reside directly in the root. + Pass realpath=False if filesystem links should not be resolved. """ - real_root = _realpath(root) - if not os.path.isabs(real_root): + if not os.path.isabs(root): return "" + root = os.path.normpath(root) if not os.path.isabs(path): path = os.path.join(root, path) path = os.path.normpath(path) - real_path = _realpath(path) + if realpath: + root = _realpath(root) + path = _realpath(path) if subdir: - if real_path.startswith(real_root): - return real_path + if os.path.commonpath([path, root]) == root: + return path else: - if os.path.dirname(real_path) == os.path.normpath(real_root): - return real_path + if os.path.dirname(path) == root: + return path return "" diff --git a/tests/pytests/unit/fileserver/test_roots.py b/tests/pytests/unit/fileserver/test_roots.py index c6a58136a3c9..a197b937eec5 100644 --- a/tests/pytests/unit/fileserver/test_roots.py +++ b/tests/pytests/unit/fileserver/test_roots.py @@ -3,6 +3,7 @@ """ import copy +import os import pathlib import shutil import sys @@ -315,3 +316,28 @@ def test_serve_file_not_in_root(tmp_state_tree): assert ret == {"data": "", "dest": "..\\bar"} else: assert ret == {"data": "", "dest": "../bar"} + + +def test_find_file_symlink_destination_not_in_root(tmp_state_tree): + dirname = pathlib.Path(tmp_state_tree).parent / "foo" + dirname.mkdir(parents=True, exist_ok=True) + testfile = dirname / "testfile" + testfile.write_text("testfile") + symlink = tmp_state_tree / "bar" + symlink.symlink_to(str(dirname)) + ret = roots.find_file("bar/testfile") + assert ret["path"] == str(symlink / "testfile") + assert ret["rel"] == f"bar{os.sep}testfile" + + +def test_serve_file_symlink_destination_not_in_root(tmp_state_tree): + dirname = pathlib.Path(tmp_state_tree).parent / "foo" + dirname.mkdir(parents=True, exist_ok=True) + testfile = dirname / "testfile" + testfile.write_text("testfile") + symlink = tmp_state_tree / "bar" + symlink.symlink_to(str(dirname)) + load = {"path": "bar/testfile", "saltenv": "base", "loc": 0} + fnd = {"path": str(symlink / "testfile"), "rel": "bar/testfile"} + ret = roots.serve_file(load, fnd) + assert ret == {"data": b"testfile", "dest": "bar/testfile"} diff --git a/tests/pytests/unit/utils/verify/test_clean_path_link.py b/tests/pytests/unit/utils/verify/test_clean_path_link.py index 8effa56a59ca..99b18477eacb 100644 --- a/tests/pytests/unit/utils/verify/test_clean_path_link.py +++ b/tests/pytests/unit/utils/verify/test_clean_path_link.py @@ -65,3 +65,11 @@ def test_clean_path_symlinked_tgt(setup_links): expect_path = str(to_path / "test") ret = salt.utils.verify.clean_path(str(from_path), str(test_path)) assert ret == expect_path, f"{ret} is not {expect_path}" + + +def test_clean_path_symlinked_src_unresolved(setup_links): + to_path, from_path = setup_links + test_path = from_path / "test" + expect_path = str(from_path / "test") + ret = salt.utils.verify.clean_path(str(from_path), str(test_path), realpath=False) + assert ret == expect_path, f"{ret} is not {expect_path}" diff --git a/tools/ci.py b/tools/ci.py index 2096a52ae3b3..446c188df84f 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -714,7 +714,11 @@ def matrix( _matrix.append({"transport": transport, "tests-chunk": chunk}) ctx.info("Generated matrix:") - ctx.print(_matrix, soft_wrap=True) + if not _matrix: + ctx.print(" * `None`") + else: + for entry in _matrix: + ctx.print(" * ", entry, soft_wrap=True) if ( gh_event["repository"]["fork"] is True @@ -724,11 +728,17 @@ def matrix( ctx.warn("Forks don't have access to MacOS 13 Arm64. Clearning the matrix.") _matrix.clear() + if not _matrix: + build_reports = False + ctx.info("Not building reports because the matrix is empty") + else: + build_reports = True + github_output = os.environ.get("GITHUB_OUTPUT") if github_output is not None: with open(github_output, "a", encoding="utf-8") as wfh: wfh.write(f"matrix={json.dumps(_matrix)}\n") - wfh.write(f"build-reports={json.dumps(len(_matrix) > 0)}\n") + wfh.write(f"build-reports={json.dumps(build_reports)}\n") ctx.exit(0) @@ -900,7 +910,11 @@ def pkg_matrix( ctx.info(f"No {version} ({backend}) for {distro_slug} at {prefix}") ctx.info("Generated matrix:") - ctx.print(_matrix, soft_wrap=True) + if not _matrix: + ctx.print(" * `None`") + else: + for entry in _matrix: + ctx.print(" * ", entry, soft_wrap=True) if ( gh_event is not None @@ -911,10 +925,16 @@ def pkg_matrix( ctx.warn("Forks don't have access to MacOS 13 Arm64. Clearning the matrix.") _matrix.clear() + if not _matrix: + build_reports = False + ctx.info("Not building reports because the matrix is empty") + else: + build_reports = True + if github_output is not None: with open(github_output, "a", encoding="utf-8") as wfh: wfh.write(f"matrix={json.dumps(_matrix)}\n") - wfh.write(f"build-reports={json.dumps(len(_matrix) > 0)}\n") + wfh.write(f"build-reports={json.dumps(build_reports)}\n") ctx.exit(0)