From 640ba3afa38764c34337ee441da51b1d888dc1fa Mon Sep 17 00:00:00 2001 From: DanStough Date: Tue, 7 May 2024 12:47:44 -0400 Subject: [PATCH] fix: update upload artifact workload to have unique ids --- .github/workflows/reusable-unit-split.yml | 12 ++++++++++-- .github/workflows/reusable-unit.yml | 12 +++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/reusable-unit-split.yml b/.github/workflows/reusable-unit-split.yml index 7061e29e3e87..ba0e88bbf1d3 100644 --- a/.github/workflows/reusable-unit-split.yml +++ b/.github/workflows/reusable-unit-split.yml @@ -86,6 +86,14 @@ jobs: ulimit -Sa echo "Hard limits" ulimit -Ha + # upload-artifact requires a unique ID per run. These steps will be repeated with the matrix run, and other unit tests + # will also overlap with the names here. We use a random string rather than trying to do trickery + # with the package matrix. + - id: generate-matrix-id + run: | + MATRIX_RUN_ID=$(head /dev/urandom | tr -dc A-Z | head -c8) + echo "The matrix run ID is $MATRIX_RUN_ID" + echo "matrix-run-id=$MATRIX_RUN_ID" >> "$GITHUB_OUTPUT" - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 # NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos. - name: Setup Git @@ -167,12 +175,12 @@ jobs: - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: - name: test-results + name: ${{ steps.generate-matrix-id.outputs.matrix-run-id }}-test-results path: ${{env.TEST_RESULTS}} - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: - name: jsonfile + name: ${{ steps.generate-matrix-id.outputs.matrix-run-id }}-jsonfile path: /tmp/jsonfile - name: "Re-run fails report" if: ${{ !cancelled() }} diff --git a/.github/workflows/reusable-unit.yml b/.github/workflows/reusable-unit.yml index 2a11241e239b..db063294017c 100644 --- a/.github/workflows/reusable-unit.yml +++ b/.github/workflows/reusable-unit.yml @@ -130,16 +130,22 @@ jobs: env: DD_ENV: ci run: datadog-ci junit upload --service "$GITHUB_REPOSITORY" ${{env.TEST_RESULTS}}/gotestsum-report.xml - + # upload-artifact requires a unique ID per run. These steps will overlap with other users of the reusable workflow. + # We use a random string rather than trying to pass in some identifying information. + - id: generate-run-id + run: | + RUN_ID=$(head /dev/urandom | tr -dc A-Z | head -c8) + echo "The run ID is $RUN_ID" + echo "run-id=$RUN_ID" >> "$GITHUB_OUTPUT" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: - name: test-results + name: ${{ steps.generate-run-id.outputs.run-id }}-test-results path: ${{env.TEST_RESULTS}} - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: - name: jsonfile + name: ${{ steps.generate-run-id.outputs.run-id }}-jsonfile path: /tmp/jsonfile - name: "Re-run fails report" if: ${{ !cancelled() }}