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

Use dedup for trivy version check #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
28 changes: 28 additions & 0 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,31 @@ jobs:
branch: depup/reviewdog
base: main
labels: "bump:minor"

trivy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: haya14busa/action-depup@v1
id: depup
with:
file: .github/workflows/tests.yml
version_name: TRIVY_VERSION
repo: aquasecurity/trivy

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(deps): update trivy to ${{ steps.depup.outputs.latest }}"
commit-message: "chore(deps): update trivy to ${{ steps.depup.outputs.latest }}"
body: |
Update trivy to [v${{ steps.depup.outputs.latest }}](https://github.com/aquasecurity/trivy/releases/tag/v${{ steps.depup.outputs.latest }})
Compare [v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }}](https://github.com/aquasecurity/trivy/compare/v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }})

This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup).
branch: depup/trivy
base: main
labels: "bump:minor"
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,48 @@ jobs:
echo "reviewdog returned ${reviewdog_return}, expected '0'. Failing..."
exit 1
fi

test-trivy-version:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
name: trivy (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4

- uses: ./
continue-on-error: true
id: test
env:
INPUT_TRIVY_VERSION: v0.50.0
with:
github_token: ${{ secrets.github_token }}
trivy_command: config
trivy_target: .
reporter: github-check
level: info
working_directory: testdata/config/terraform/with_detections

# The check is expected to fail on the test data
- name: Check return codes
if: success() || failure ()
run: |
trivy_return="${{ steps.test.outputs.trivy-return-code }}"
reviewdog_return="${{ steps.test.outputs.reviewdog-return-code }}"

if [[ "$trivy_return" -eq 1 ]]; then
echo "trivy correctly returned failure ${trivy_return}"
else
echo "trivy returned ${trivy_return}, expected '1'. Failing..."
exit 1
fi

if [[ "$reviewdog_return" -eq 0 ]]; then
echo "reviewdog correctly returned success: ${reviewdog_return}"
else
echo "reviewdog returned ${reviewdog_return}, expected '0'. Failing..."
exit 1
fi
Loading