Skip to content

Commit

Permalink
fix: update upload artifact workload to have unique ids
Browse files Browse the repository at this point in the history
  • Loading branch information
DanStough committed May 10, 2024
1 parent cc7b109 commit 640ba3a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/reusable-unit-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() }}
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/reusable-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down

0 comments on commit 640ba3a

Please sign in to comment.