From 55af9f30722dfb2034b35ea08756387104dfa5ff Mon Sep 17 00:00:00 2001 From: Mike Baum Date: Mon, 3 Apr 2023 14:42:30 -0400 Subject: [PATCH] [QT-516] Add a step to the enos run workflow to automatically upload application logs when a scenario fails (#3137) --- .github/workflows/enos-run.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/enos-run.yml b/.github/workflows/enos-run.yml index a6b7e9636b..49b8087fb5 100644 --- a/.github/workflows/enos-run.yml +++ b/.github/workflows/enos-run.yml @@ -80,6 +80,7 @@ jobs: runs-on: ${{ fromJSON(vars.RUNNER) }} env: GITHUB_TOKEN: ${{ secrets.SERVICE_USER_GITHUB_TOKEN }} + ENOS_DEBUG_DATA_ROOT_DIR: ./enos/support/debug-data steps: - name: Checkout uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -129,11 +130,13 @@ jobs: uses: hashicorp/action-setup-enos@v1 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed with: github-token: ${{ secrets.SERVICE_USER_GITHUB_TOKEN }} - - name: Set up AWS SSH private key + - name: Prepare scenario dependencies + id: prepare_scenario run: | mkdir -p ./enos/support 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.filter }} | sed -e 's/ /_/g' | sed -e 's/:/=/g')" >> "$GITHUB_OUTPUT" - name: Set up dependency cache id: dep-cache uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6 @@ -276,6 +279,14 @@ jobs: run: | export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ enos scenario run --timeout 60m0s --chdir ./enos ${{ matrix.filter }} + - name: Upload Debug Data + if: ${{ always() && steps.run_retry.outcome == 'failure' }} + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + 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: Destroy Enos scenario if: ${{ always() && steps.run_retry.outcome == 'failure' }} env: