From d2e2bf7db8ca81a90aec4c491aca922cbb815221 Mon Sep 17 00:00:00 2001 From: hurzhurz Date: Tue, 23 Apr 2024 10:33:29 +0200 Subject: [PATCH 01/10] salt.utils.verify.clean_path: make filesystem link resolution optinally --- salt/utils/verify.py | 21 +++++++++++-------- .../unit/utils/verify/test_clean_path_link.py | 8 +++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/salt/utils/verify.py b/salt/utils/verify.py index c4143996270..b3fe6c02c60 100644 --- a/salt/utils/verify.py +++ b/salt/utils/verify.py @@ -513,25 +513,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/utils/verify/test_clean_path_link.py b/tests/pytests/unit/utils/verify/test_clean_path_link.py index 8effa56a59c..99b18477eac 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}" From 1694f8464383f85fed696bc0d80849e7cd94eb10 Mon Sep 17 00:00:00 2001 From: hurzhurz Date: Mon, 22 Apr 2024 18:38:23 +0200 Subject: [PATCH 02/10] roots fileserver fix path verification for symlinks with destination outside of root --- salt/fileserver/roots.py | 8 +++++-- tests/pytests/unit/fileserver/test_roots.py | 25 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/salt/fileserver/roots.py b/salt/fileserver/roots.py index 91536d737ce..e81f37dcf02 100644 --- a/salt/fileserver/roots.py +++ b/salt/fileserver/roots.py @@ -101,7 +101,9 @@ def find_file(path, saltenv="base", **kwargs): 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/tests/pytests/unit/fileserver/test_roots.py b/tests/pytests/unit/fileserver/test_roots.py index c6a58136a3c..59058f34a34 100644 --- a/tests/pytests/unit/fileserver/test_roots.py +++ b/tests/pytests/unit/fileserver/test_roots.py @@ -315,3 +315,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"] == "bar/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"} From 738b373b4b82869a4f325fd41c7c775b734ae2af Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 17 May 2024 10:40:55 +0100 Subject: [PATCH 03/10] Make sure all uploaded artifacts have different names So that we can always merge them on reports --- .github/workflows/test-action-linux.yml | 11 ++++++++--- .github/workflows/test-action-macos.yml | 11 ++++++++--- .github/workflows/test-action-windows.yml | 11 ++++++++--- .github/workflows/test-packages-action-linux.yml | 7 ++++++- .github/workflows/test-packages-action-macos.yml | 7 ++++++- .github/workflows/test-packages-action-windows.yml | 7 ++++++- 6 files changed, 42 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-action-linux.yml b/.github/workflows/test-action-linux.yml index 55364495e33..e9ecb5d349f 100644 --- a/.github/workflows/test-action-linux.yml +++ b/.github/workflows/test-action-linux.yml @@ -130,6 +130,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 @@ -278,7 +283,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/ @@ -286,7 +291,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/ @@ -294,7 +299,7 @@ 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 diff --git a/.github/workflows/test-action-macos.yml b/.github/workflows/test-action-macos.yml index e61ab82ae58..bbd8b387d68 100644 --- a/.github/workflows/test-action-macos.yml +++ b/.github/workflows/test-action-macos.yml @@ -123,6 +123,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 @@ -306,7 +311,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/ @@ -314,7 +319,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/ @@ -322,7 +327,7 @@ 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 diff --git a/.github/workflows/test-action-windows.yml b/.github/workflows/test-action-windows.yml index a01a55ba34a..cdb284d8c02 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -130,6 +130,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 @@ -278,7 +283,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/ @@ -286,7 +291,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/ @@ -294,7 +299,7 @@ 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 diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index a319f9f262e..adb2ad8635c 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -126,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 @@ -221,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.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/* diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index df107359f03..352f059d997 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -118,6 +118,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 +209,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/* diff --git a/.github/workflows/test-packages-action-windows.yml b/.github/workflows/test-packages-action-windows.yml index a3198ac6ffb..ef1505bc5bd 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -125,6 +125,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 +225,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/* From ae0e579747860d2d2c4e5de9400408ed0d3f588c Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 17 May 2024 12:14:40 +0100 Subject: [PATCH 04/10] Improve/fix the condition of when the reports jobs run --- .github/workflows/test-action-linux.yml | 5 +++- .github/workflows/test-action-macos.yml | 5 +++- .github/workflows/test-action-windows.yml | 5 +++- .../workflows/test-packages-action-linux.yml | 4 ++- .../workflows/test-packages-action-macos.yml | 4 ++- .../test-packages-action-windows.yml | 4 ++- tools/ci.py | 28 ++++++++++++++++--- 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-action-linux.yml b/.github/workflows/test-action-linux.yml index e9ecb5d349f..0f1f8fd3272 100644 --- a/.github/workflows/test-action-linux.yml +++ b/.github/workflows/test-action-linux.yml @@ -305,7 +305,7 @@ jobs: 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 @@ -322,6 +322,7 @@ 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 }}-* @@ -330,6 +331,7 @@ jobs: - 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 }}-* @@ -355,6 +357,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 bbd8b387d68..eff2d7baa65 100644 --- a/.github/workflows/test-action-macos.yml +++ b/.github/workflows/test-action-macos.yml @@ -333,7 +333,7 @@ jobs: 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 @@ -350,6 +350,7 @@ 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 }}-* @@ -358,6 +359,7 @@ jobs: - 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 }}-* @@ -383,6 +385,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 cdb284d8c02..0bf51fe36f1 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -306,7 +306,7 @@ jobs: 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 @@ -323,6 +323,7 @@ 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 }}-* @@ -331,6 +332,7 @@ jobs: - 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 }}-* @@ -356,6 +358,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 adb2ad8635c..06bcc43c9a3 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" @@ -236,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: diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index 352f059d997..f98a58de2ea 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" @@ -219,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: diff --git a/.github/workflows/test-packages-action-windows.yml b/.github/workflows/test-packages-action-windows.yml index ef1505bc5bd..d16a01707e3 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" @@ -235,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: diff --git a/tools/ci.py b/tools/ci.py index 8a09af5bc05..635462d282f 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -713,7 +713,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 @@ -723,11 +727,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) @@ -899,7 +909,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 @@ -910,10 +924,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) From 8f76636c54af675121e4688756b023f5a681e49e Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 17 May 2024 12:22:55 +0100 Subject: [PATCH 05/10] Fix broken test on Windows --- tests/pytests/unit/fileserver/test_roots.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/pytests/unit/fileserver/test_roots.py b/tests/pytests/unit/fileserver/test_roots.py index 59058f34a34..a197b937eec 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 @@ -326,7 +327,7 @@ def test_find_file_symlink_destination_not_in_root(tmp_state_tree): symlink.symlink_to(str(dirname)) ret = roots.find_file("bar/testfile") assert ret["path"] == str(symlink / "testfile") - assert ret["rel"] == "bar/testfile" + assert ret["rel"] == f"bar{os.sep}testfile" def test_serve_file_symlink_destination_not_in_root(tmp_state_tree): From f184bfe4996eb5d0734545e6279346a2b03fdb0b Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 17 May 2024 15:08:33 +0100 Subject: [PATCH 06/10] Allow merging artifacts not to fail on re-runs --- .github/workflows/test-action-linux.yml | 6 +++--- .github/workflows/test-action-macos.yml | 6 +++--- .github/workflows/test-action-windows.yml | 6 +++--- .github/workflows/test-packages-action-linux.yml | 2 +- .github/workflows/test-packages-action-macos.yml | 2 +- .github/workflows/test-packages-action-windows.yml | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-action-linux.yml b/.github/workflows/test-action-linux.yml index 0f1f8fd3272..eb8b950d0c3 100644 --- a/.github/workflows/test-action-linux.yml +++ b/.github/workflows/test-action-linux.yml @@ -325,7 +325,7 @@ jobs: 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 @@ -334,7 +334,7 @@ jobs: 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 @@ -344,7 +344,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 diff --git a/.github/workflows/test-action-macos.yml b/.github/workflows/test-action-macos.yml index eff2d7baa65..c66b6c154e1 100644 --- a/.github/workflows/test-action-macos.yml +++ b/.github/workflows/test-action-macos.yml @@ -353,7 +353,7 @@ jobs: 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 @@ -362,7 +362,7 @@ jobs: 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 @@ -372,7 +372,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 diff --git a/.github/workflows/test-action-windows.yml b/.github/workflows/test-action-windows.yml index 0bf51fe36f1..d4266cdfd10 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -326,7 +326,7 @@ jobs: 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 @@ -335,7 +335,7 @@ jobs: 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 @@ -345,7 +345,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 diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index 06bcc43c9a3..3bef3702cd2 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -255,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 f98a58de2ea..4d5bef699ff 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -238,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 d16a01707e3..33802c8c3b9 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -254,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 From 27173cb94e2e102c3a322ef31835d38593c3cde2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 17 May 2024 18:10:30 +0100 Subject: [PATCH 07/10] Reduce the potential of failing when merging artifacts --- .github/workflows/ci.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/scheduled.yml | 2 +- .github/workflows/templates/ci.yml.jinja | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3d96ec88ae..cc1f68d791f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2071,7 +2071,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 3a590c4bf2f..0e8a094277e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2133,7 +2133,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 71b944487b2..f490fae1146 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -2110,7 +2110,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 40385489fa0..6bb3bf1cba6 100644 --- a/.github/workflows/templates/ci.yml.jinja +++ b/.github/workflows/templates/ci.yml.jinja @@ -347,7 +347,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 From 600e0b3a94436ded5e58c5a8787aed629044657c Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 18 May 2024 19:25:03 +0100 Subject: [PATCH 08/10] Fix windows repository artifact name --- .github/workflows/nightly.yml | 2 +- .github/workflows/staging.yml | 2 +- .github/workflows/templates/build-windows-repo.yml.jinja | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0e8a094277e..b3ed5b2df61 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2746,7 +2746,7 @@ jobs: - name: Upload Repository As An Artifact uses: ./.github/actions/upload-artifact with: - name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-nightly-repo + name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-nightly-repo-windows path: artifacts/pkgs/repo/* retention-days: 7 if-no-files-found: error diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 8dfb6893697..8a462a5ed8b 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -2574,7 +2574,7 @@ jobs: - name: Upload Repository As An Artifact uses: ./.github/actions/upload-artifact with: - name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-staging-repo + name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-staging-repo-windows path: artifacts/pkgs/repo/* retention-days: 7 if-no-files-found: error diff --git a/.github/workflows/templates/build-windows-repo.yml.jinja b/.github/workflows/templates/build-windows-repo.yml.jinja index dfa281b18ff..67a2d82e17f 100644 --- a/.github/workflows/templates/build-windows-repo.yml.jinja +++ b/.github/workflows/templates/build-windows-repo.yml.jinja @@ -85,7 +85,7 @@ - name: Upload Repository As An Artifact uses: ./.github/actions/upload-artifact with: - name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-<{ gh_environment }>-repo + name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-<{ gh_environment }>-repo-windows path: artifacts/pkgs/repo/* retention-days: 7 if-no-files-found: error From f525138d670663314c82e8f825c111737cdfdd3e Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 19 May 2024 09:41:03 +0100 Subject: [PATCH 09/10] Yet some more artifact merging fixes --- .github/workflows/ci.yml | 4 ++-- .github/workflows/nightly.yml | 4 ++-- .github/workflows/scheduled.yml | 4 ++-- .github/workflows/templates/ci.yml.jinja | 4 ++-- .github/workflows/test-action-linux.yml | 16 +++++++++------- .github/workflows/test-action-macos.yml | 10 ++++++---- .github/workflows/test-action-windows.yml | 10 ++++++---- .github/workflows/test-packages-action-linux.yml | 3 ++- .github/workflows/test-packages-action-macos.yml | 3 ++- .../workflows/test-packages-action-windows.yml | 3 ++- 10 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc1f68d791f..19308bca406 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2067,11 +2067,11 @@ jobs: - name: Merge All Code Coverage Test Run Artifacts + continue-on-error: true uses: actions/upload-artifact/merge@v4 - 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 b3ed5b2df61..df328362644 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2129,11 +2129,11 @@ jobs: - name: Merge All Code Coverage Test Run Artifacts + continue-on-error: true uses: actions/upload-artifact/merge@v4 - 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 f490fae1146..8beee3f1ae8 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -2106,11 +2106,11 @@ jobs: - name: Merge All Code Coverage Test Run Artifacts + continue-on-error: true uses: actions/upload-artifact/merge@v4 - 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 6bb3bf1cba6..636c327f19c 100644 --- a/.github/workflows/templates/ci.yml.jinja +++ b/.github/workflows/templates/ci.yml.jinja @@ -343,11 +343,11 @@ #} - name: Merge All Code Coverage Test Run Artifacts + continue-on-error: true uses: actions/upload-artifact/merge@v4 - 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 eb8b950d0c3..0c5c5776327 100644 --- a/.github/workflows/test-action-linux.yml +++ b/.github/workflows/test-action-linux.yml @@ -321,30 +321,32 @@ jobs: t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" - name: Merge JUnit XML Test Run Artifacts - uses: actions/upload-artifact/merge@v4 if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + continue-on-error: true + uses: actions/upload-artifact/merge@v4 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' + continue-on-error: true + uses: actions/upload-artifact/merge@v4 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 - name: Merge Code Coverage Test Run Artifacts - uses: actions/upload-artifact/merge@v4 if: ${{ inputs.skip-code-coverage == false }} - id: merge-coverage-artifacts + continue-on-error: true + uses: actions/upload-artifact/merge@v4 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 diff --git a/.github/workflows/test-action-macos.yml b/.github/workflows/test-action-macos.yml index c66b6c154e1..5b06f90a20c 100644 --- a/.github/workflows/test-action-macos.yml +++ b/.github/workflows/test-action-macos.yml @@ -349,8 +349,9 @@ jobs: t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" - name: Merge JUnit XML Test Run Artifacts - uses: actions/upload-artifact/merge@v4 if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + continue-on-error: true + uses: actions/upload-artifact/merge@v4 with: name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* @@ -358,8 +359,9 @@ jobs: 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' + continue-on-error: true + uses: actions/upload-artifact/merge@v4 with: name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} pattern: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* @@ -367,9 +369,9 @@ jobs: delete-merged: true - name: Merge Code Coverage Test Run Artifacts - uses: actions/upload-artifact/merge@v4 if: ${{ inputs.skip-code-coverage == false }} - id: merge-coverage-artifacts + continue-on-error: true + uses: actions/upload-artifact/merge@v4 with: name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* diff --git a/.github/workflows/test-action-windows.yml b/.github/workflows/test-action-windows.yml index d4266cdfd10..d2160e461a8 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -322,8 +322,9 @@ jobs: t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" - name: Merge JUnit XML Test Run Artifacts - uses: actions/upload-artifact/merge@v4 if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped' + continue-on-error: true + uses: actions/upload-artifact/merge@v4 with: name: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} pattern: testrun-junit-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* @@ -331,8 +332,9 @@ jobs: 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' + continue-on-error: true + uses: actions/upload-artifact/merge@v4 with: name: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} pattern: testrun-log-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* @@ -340,9 +342,9 @@ jobs: delete-merged: true - name: Merge Code Coverage Test Run Artifacts - uses: actions/upload-artifact/merge@v4 if: ${{ inputs.skip-code-coverage == false }} - id: merge-coverage-artifacts + continue-on-error: true + uses: actions/upload-artifact/merge@v4 with: name: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }} pattern: testrun-coverage-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}* diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index 3bef3702cd2..a5c00db88ea 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -252,10 +252,11 @@ jobs: t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" - name: Merge Test Run Artifacts + continue-on-error: true 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 4d5bef699ff..2e27f1e9849 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -235,10 +235,11 @@ jobs: t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" - name: Merge Test Run Artifacts + continue-on-error: true 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 33802c8c3b9..967482ac204 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -252,9 +252,10 @@ jobs: - name: Merge Test Run Artifacts uses: actions/upload-artifact/merge@v4 + continue-on-error: true 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 From 5d8655cb260438ea9485cdd78e4c7ce1ed58bf79 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 22 May 2024 18:08:04 +0100 Subject: [PATCH 10/10] Update to `ncipollo/release-action@v1` --- .github/workflows/release.yml | 2 +- .github/workflows/templates/release.yml.jinja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff943fe4a17..acaff8835a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -363,7 +363,7 @@ jobs: branch: ${{ github.ref }} - name: Create Github Release - uses: ncipollo/release-action@v1.12.0 + uses: ncipollo/release-action@v1 with: artifactErrorsFailBuild: true artifacts: ${{ steps.prepare-release.outputs.release-artifacts }} diff --git a/.github/workflows/templates/release.yml.jinja b/.github/workflows/templates/release.yml.jinja index efeef41f8a4..cb6d251b966 100644 --- a/.github/workflows/templates/release.yml.jinja +++ b/.github/workflows/templates/release.yml.jinja @@ -372,7 +372,7 @@ permissions: branch: ${{ github.ref }} - name: Create Github Release - uses: ncipollo/release-action@v1.12.0 + uses: ncipollo/release-action@v1 with: artifactErrorsFailBuild: true artifacts: ${{ steps.prepare-release.outputs.release-artifacts }}