Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflow summary #205

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 21 additions & 32 deletions .github/workflows/compass-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ jobs:
go-version-file: go.mod
- name: Run unit tests
run: make test | tee test.log
- name: Generate summary
if: success() || failure()
run: |
{
echo '## Test Log'
echo '```'
cat test.log
echo '```'
} >> $GITHUB_STEP_SUMMARY
- name: Upload test logs artifact
uses: actions/upload-artifact@v4
if: success() || failure()
Expand Down Expand Up @@ -102,20 +111,18 @@ jobs:
timeout: '5m0s'
vuln-type: 'os,library'

format: json
output: 'trivy-results.json'

- name: Convert results
format: table
output: 'trivy-results.txt'
- name: Generate summary
if: success() || failure()
run: |
./trivy/trivy convert -f table -o trivy-results.txt trivy-results.json
./trivy/trivy convert -f sarif -o trivy-results.sarif trivy-results.json

- name: Upload Trivy scan results to GitHub Security tab
if: (success() || failure()) && github.ref == 'refs/heads/main'
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
{
echo '## Trivy'
echo '```txt'
cat trivy-results.txt
echo '```'
} >> $GITHUB_STEP_SUMMARY

- name: Upload trivy table
if: success() || failure()
Expand All @@ -134,31 +141,13 @@ jobs:
context: .
tags: ${{ needs.setup.outputs.tag }}

summary:
print-images:
runs-on: ubuntu-latest
needs: [setup, build-image, unit-tests, trivy]
if: success() || failure()
needs: build-image
steps:
- name: "Download test log"
uses: actions/download-artifact@v4
with:
name: test.log
- name: "Download trivy log"
uses: actions/download-artifact@v4
with:
name: trivy-results.txt
- name: "Generate summary"
run: |
{
echo '# Compass Manager'
echo '## Trivy'
echo '```txt'
cat trivy-results.txt
echo '```'
echo '## Test Log'
echo '```'
cat test.log
echo '```'
echo '## Images'
echo '```json'
echo '${{ needs.build-image.outputs.images }}' | jq
Expand Down
Loading