Skip to content

Commit

Permalink
Download Application log files and upload as an artifact when enos sc…
Browse files Browse the repository at this point in the history
…enarios fail (#19860)
  • Loading branch information
Mike Baum authored Mar 31, 2023
1 parent 45f349d commit ea130fd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/test-run-enos-scenario-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
ENOS_VAR_vault_revision: ${{ inputs.vault-revision }}
ENOS_VAR_vault_bundle_path: ./support/downloads/${{ inputs.build-artifact-name }}
ENOS_VAR_vault_license_path: ./support/vault.hclic
ENOS_DEBUG_DATA_ROOT_DIR: ./enos/support/debug-data
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
Expand All @@ -123,10 +124,12 @@ jobs:
with:
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
- name: Prepare scenario dependencies
id: prepare_scenario
run: |
mkdir -p ./enos/support/terraform-plugin-cache
echo "${{ secrets.SSH_KEY_PRIVATE_CI }}" > ./enos/support/private_key.pem
chmod 600 ./enos/support/private_key.pem
echo "debug_data_artifact_name=enos-debug-data_$(echo ${{ matrix.scenario }} | sed -e 's/ /_/g' | sed -e 's/:/=/g')" >> $GITHUB_OUTPUT
- if: contains(inputs.matrix-file-name, 'github')
uses: actions/download-artifact@v3
with:
Expand All @@ -145,6 +148,14 @@ jobs:
id: run_retry
if: steps.run.outcome == 'failure'
run: enos scenario run --timeout 60m0s --chdir ./enos ${{ matrix.scenario }}
- name: Upload Debug Data
if: failure()
uses: actions/upload-artifact@v3
with:
# The name of the artifact is the same as the matrix scenario name with the spaces replaced with underscores and colons replaced by equals.
name: ${{ steps.prepare_scenario.outputs.debug_data_artifact_name }}
path: ${{ env.ENOS_DEBUG_DATA_ROOT_DIR }}
retention-days: 30
- name: Ensure scenario has been destroyed
if: ${{ always() }}
# With Enos version 0.0.11 the destroy step returns an error if the infrastructure
Expand Down

0 comments on commit ea130fd

Please sign in to comment.