Skip to content

Commit

Permalink
Feature dtcenter/MET#2796 develop - Fix error log artifact creation (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Jan 26, 2024
1 parent 41bfb3f commit f45f1b1
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ jobs:
uses: actions/upload-artifact@v4
if: ${{ always() && steps.save-errors.outputs.upload_error_logs }}
with:
name: error_logs
name: error_logs-${{ steps.get-artifact-name.outputs.artifact_name }}
path: artifact/error_logs
if-no-files-found: ignore

Expand All @@ -230,6 +230,33 @@ jobs:
path: artifact/diff-${{ steps.get-artifact-name.outputs.artifact_name }}
if-no-files-found: ignore

merge_error_logs:
name: Merge Error Logs
runs-on: ubuntu-latest
needs: use_case_tests
if: ${{ always() && needs.use_case_tests.result == 'failure' }}
steps:
- uses: actions/checkout@v4
- name: Check for error logs
id: check-for-error-logs
run: |
json_data=$(curl -s -H "Authorization: Bearer ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs")
error_log_jobs=($(echo "$json_data" | jq -r '.jobs[] | select(.name | startswith("Use Case Tests")) | .steps[] | select(.name | startswith("Save error logs")) | select(.conclusion | startswith("success"))'))
# save output variable to merge error logs if any error logs were created
if [ ! -z "${error_log_jobs}" ]; then
echo "has_error_logs=true" >> $GITHUB_OUTPUT
else
echo "has_error_logs=false" >> $GITHUB_OUTPUT
fi
- name: Merge Artifacts
if: ${{ always() && steps.check-for-error-logs.outputs.has_error_logs == 'true' }}
uses: actions/upload-artifact/merge@v4
with:
name: error_logs
pattern: error_logs-*
delete-merged: true

create_output_data_volumes:
name: Create Output Docker Data Volumes
runs-on: ubuntu-latest
Expand Down

0 comments on commit f45f1b1

Please sign in to comment.