Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
fa6940d0
Unverified
Commit
fa6940d0
authored
Aug 30, 2024
by
Derek Nola
Committed by
GitHub
Aug 30, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add trivy scanning trigger for PRs (#10758)
Signed-off-by:
Derek Nola
<
derek.nola@suse.com
>
parent
0b4d2497
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
trivy.yaml
.github/workflows/trivy.yaml
+49
-0
No files found.
.github/workflows/trivy.yaml
0 → 100644
View file @
fa6940d0
name
:
PR Comment Triggered Trivy Scan
on
:
issue_comment
:
types
:
[
created
]
jobs
:
trivy_scan
:
if
:
github.event.issue.pull_request && github.event.comment.body == '/trivy'
runs-on
:
ubuntu-latest
permissions
:
pull-requests
:
write
env
:
GH_TOKEN
:
${{ github.token }}
steps
:
-
name
:
Checkout PR code
uses
:
actions/checkout@v4
with
:
ref
:
${{ github.event.issue.pull_request.head.ref }}
-
name
:
Comment Status on PR
run
:
|
gh repo set-default ${{ github.repository }}
gh pr comment ${{ github.event.issue.number }} -b ":construction: Running Trivy scan on PR :construction: "
-
name
:
Build K3s Image
run
:
|
make local
make package-image
-
name
:
Run Trivy vulnerability scanner
uses
:
aquasecurity/trivy-action@0.20.0
with
:
image-ref
:
'
rancher/k3s'
format
:
'
table'
severity
:
"
HIGH,CRITICAL"
output
:
"
trivy-report.txt"
-
name
:
Add Trivy Report to PR
run
:
|
echo '```' | cat - trivy-report.txt > temp && mv temp trivy-report.txt
echo '```' >> trivy-report.txt
gh issue comment ${{ github.event.issue.number }} --edit-last -F trivy-report.txt
-
name
:
Report Failure
if
:
${{ failure() }}
run
:
|
gh issue comment ${{ github.event.issue.number }} --edit-last -b ":x: Trivy scan action failed, check logs :x:"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment