Skip to content

Commit

Permalink
set warning upload artifacts when check-artifact step return error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yangw-dev authored Feb 13, 2025
1 parent 0c4b50f commit ae56320
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/linux_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ jobs:
if [[ -d "artifacts-to-be-uploaded" ]]; then
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
fi
# Set to fail upload step if there are no files for upload and expected files for upload
echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
fi
upload_docs=0
Expand All @@ -328,7 +326,6 @@ jobs:
with:
name: ${{ inputs.upload-artifact }}
path: ${{ runner.temp }}/artifacts/
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}

# NB: This only works with our AWS runners
- name: Upload artifacts to S3 (if any)
Expand All @@ -339,7 +336,6 @@ jobs:
s3-bucket: gha-artifacts
s3-prefix: |
${{ env.REPOSITORY }}/${{ github.run_id }}/artifacts
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
path: ${{ runner.temp }}/artifacts/

- name: Upload documentation to S3 (if any)
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/linux_job_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ jobs:
if [[ -d "artifacts-to-be-uploaded" ]]; then
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
fi
# Set to fail upload step if there are no files for upload and expected files for upload
echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
fi
upload_docs=0
Expand All @@ -328,7 +326,6 @@ jobs:
with:
name: ${{ inputs.upload-artifact }}
path: ${{ runner.temp }}/artifacts/
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}

# NB: This only works with our AWS runners
- name: Upload artifacts to S3 (if any)
Expand All @@ -339,7 +336,6 @@ jobs:
s3-bucket: gha-artifacts
s3-prefix: |
${{ env.REPOSITORY }}/${{ github.run_id }}/artifacts
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
path: ${{ runner.temp }}/artifacts/

- name: Upload documentation to S3 (if any)
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/test_linux_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ jobs:
upload-artifact: my-cool-artifact
script: |
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
test-upload-artifact-no-artifact:
uses: ./.github/workflows/linux_job.yml
with:
runner: linux.2xlarge
test-infra-repository: ${{ github.repository }}
test-infra-ref: ${{ github.ref }}
upload-artifact: my-cool-artifact
script: |
echo "hello"
test-upload-artifact-s3:
uses: ./.github/workflows/linux_job.yml
with:
Expand All @@ -127,6 +136,16 @@ jobs:
upload-artifact-to-s3: true
script: |
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
test-upload-artifact-s3-no-artifact:
uses: ./.github/workflows/linux_job.yml
with:
runner: linux.2xlarge
test-infra-repository: ${{ github.repository }}
test-infra-ref: ${{ github.ref }}
upload-artifact: my-cool-artifact
upload-artifact-to-s3: true
script: |
echo "hello"
test-download-artifact:
needs: test-upload-artifact
uses: ./.github/workflows/linux_job.yml
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test_linux_job_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ jobs:
upload-artifact: my-cool-artifact
script: |
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
test-upload-artifact-no-artifact:
uses: ./.github/workflows/linux_job_v2.yml
permissions:
id-token: write
with:
runner: linux.2xlarge
test-infra-repository: ${{ github.repository }}
test-infra-ref: ${{ github.ref }}
upload-artifact: my-cool-artifact
script: |
echo "hello"
test-upload-artifact-s3:
uses: ./.github/workflows/linux_job_v2.yml
permissions:
Expand All @@ -114,6 +125,18 @@ jobs:
upload-artifact-to-s3: true
script: |
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
test-upload-artifact-s3-no-artifact:
uses: ./.github/workflows/linux_job_v2.yml
permissions:
id-token: write
with:
runner: linux.2xlarge
test-infra-repository: ${{ github.repository }}
test-infra-ref: ${{ github.ref }}
upload-artifact: my-cool-artifact
upload-artifact-to-s3: true
script: |
echo "hello"
test-download-artifact:
needs: test-upload-artifact
uses: ./.github/workflows/linux_job_v2.yml
Expand Down

0 comments on commit ae56320

Please sign in to comment.