Skip to content

Commit

Permalink
Store quality gate state on failure (#364)
Browse files Browse the repository at this point in the history
* stash qg state on run

Signed-off-by: Alex Goodman <[email protected]>

* update instructions

Signed-off-by: Alex Goodman <[email protected]>

---------

Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman authored Oct 26, 2023
1 parent 3e92103 commit b3ff497
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/actions/quality-gate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,47 @@ runs:
working-directory: tests/quality
run: poetry run make capture provider=${{ inputs.provider }}


- name: Validate provider results
shell: bash
working-directory: tests/quality
run: poetry run make validate

- name: Archive the provider state (${{ inputs.provider }})
if: ${{ failure() }}
shell: bash
run: tar -czvf qg-capture-state-${{ inputs.provider }}.tar.gz -C tests/quality --exclude tools --exclude labels .yardstick.yaml .yardstick

- name: Upload the provider state archive (${{ inputs.provider }})
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: qg-capture-state-${{ inputs.provider }}
path: qg-capture-state-${{ inputs.provider }}.tar.gz

- name: Show instructions to debug
if: ${{ failure() }}
shell: bash
run: |
ARCHIVE_BASENAME=qg-capture-state-${{ inputs.provider }}
ARCHIVE_NAME=$ARCHIVE_BASENAME.zip
cat << EOF >> $GITHUB_STEP_SUMMARY
## Troubleshooting '${{ inputs.provider }}' failed run
Download the artifact from this workflow run: \`$ARCHIVE_NAME\`
Then run the following commands to debug:
\`\`\`bash
# copy the archive to the tests/quality directory
cd tests/quality
unzip $ARCHIVE_NAME && tar -xzf $ARCHIVE_BASENAME.tar.gz
\`\`\`
Now you can debug the provider with yardstick:
\`\`\`bash
poetry shell
yardstick result list
yardstick label explore
\`\`\`
EOF
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.grype
.grype-db
*.tar.gz
*.zip

/bin
/data/
Expand Down

0 comments on commit b3ff497

Please sign in to comment.