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

Pipelines/fix/checkouts+summary #208

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Changes from all 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
41 changes: 25 additions & 16 deletions .github/workflows/compass-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ permissions:
id-token: write # This is required for requesting the JWT token
contents: read # This is required for actions/checkout

env:
unit-test-log: unit-test.log
trivy-table: trivy-table.txt

jobs:
setup:
permissions:
Expand Down Expand Up @@ -80,13 +84,13 @@ jobs:
cache-dependency-path: go.sum
go-version-file: go.mod
- name: Run unit tests
run: make test | tee unit-test.log
run: make test | tee ${{ env.unit-test-log }}
- name: Upload test logs artifact
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: unit-test.log
path: test.log
name: ${{ env.unit-test-log }}
path: ${{ env.unit-test-log }}

trivy:
permissions:
Expand Down Expand Up @@ -118,14 +122,19 @@ jobs:
vuln-type: "os,library"

format: table
output: "trivy-results.txt"
output: ${{ env.trivy-table }}

- name: Upload trivy table
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: trivy-results.txt
path: trivy-results.txt
name: ${{ env.trivy-table }}
path: ${{ env.trivy-table }}

- name: Print trivy table
if: success() || failure()
run: cat ${{ env.trivy-table }}

build-image:
needs: setup
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main # Usage: kyma-project/test-infra/.github/workflows/image-builder.yml@main
Expand All @@ -144,29 +153,29 @@ jobs:
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test.log
name: ${{ env.unit-test-log }}
- name: "Download trivy log"
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: trivy-results.txt
name: ${{ env.trivy-table }}
- name: "Generate summary"
run: |
{
echo '# Compass Manager'
# if trivy-results.txt exists
if [ -f trivy-results.txt ]; then
# if trivy results table exists
if [ -f ${{ env.trivy-table }} ]; then
echo '## Trivy'
printf '\n```txt\n'
cat trivy-results.txt
cat ${{ env.trivy-table }}
printf '\n```\n'
fi
# if test.log exists
if [ -f test.log ]; then
# if test log exists
if [ -f ${{ env.unit-test-log }} ]; then
echo '## Unit Tests'
printf '\n```\n'
cat test.log
printf '\n```\n'
printf '<details>\n<summary>click to expand logs</summary>\n```\n'
cat ${{ env.unit-test-log }}}
printf '\n```\n</details>\n'
fi
# if build-image was successful
if [ "${{ needs.build-image.result }}" == "success" ]; then
Expand Down
Loading