Skip to content

Commit

Permalink
Pipelines/fix/checkouts+summary (#208)
Browse files Browse the repository at this point in the history
<!-- Thank you for your contribution. Before you submit the pull
request:
1. Follow contributing guidelines, templates, the recommended Git
workflow, and any related documentation.
2. Read and submit the required Contributor Licence Agreements
(https://github.com/kyma-project/community/blob/main/CONTRIBUTING.md#agreements-and-licenses).
3. Test your changes and attach their results to the pull request.
4. Update the relevant documentation.

If the pull request requires a decision, follow the [decision-making
process](https://github.com/kyma-project/community/blob/main/governance.md)
and replace the PR template with the [decision record
template](https://github.com/kyma-project/community/blob/main/.github/ISSUE_TEMPLATE/decision-record.md).
-->

**Description**

Changes proposed in this pull request:

- fix typos
- extract filenames to envs
- add folding to logs

**Related issue(s)**
<!-- If you refer to a particular issue, provide its number. For
example, `Resolves #123`, `Fixes #43`, or `See also #33`. -->
  • Loading branch information
VOID404 authored Sep 6, 2024
2 parents 7218bb1 + 87b932d commit 2fc9f35
Showing 1 changed file with 25 additions and 16 deletions.
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

0 comments on commit 2fc9f35

Please sign in to comment.