Skip to content

Commit

Permalink
fix jq to be specific to os vulns
Browse files Browse the repository at this point in the history
Signed-off-by: Sertac Ozercan <[email protected]>
  • Loading branch information
sozercan committed Jan 16, 2024
1 parent a4eed11 commit 2e7b5d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
id: vuln_count
run: |
report_file="report.json"
vuln_count=$(jq '.Results | length' "$report_file")
vuln_count=$(jq '[.Results[] | select(.Class=="os-pkgs") | .Vulnerabilities[]] | length' "$report_file")
echo "vuln_count=$vuln_count" >> $GITHUB_OUTPUT
- name: Copa Action
Expand Down
2 changes: 1 addition & 1 deletion test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ teardown_file() {
@test "Run trivy on patched image" {
run trivy image --exit-code 1 --vuln-type os --ignore-unfixed -f json -o nginx.1.21.6-patched.json 'docker.io/library/nginx:1.21.6-patched'
[ "$status" -eq 0 ]
vulns=$(jq '.Results[0].Vulnerabilities | length' nginx.1.21.6-patched.json)
vulns=$(jq '[.Results[] | select(.Class=="os-pkgs") | .Vulnerabilities[]] | length' nginx.1.21.6-patched.json)
assert_equal "$vulns" "0"
}

0 comments on commit 2e7b5d6

Please sign in to comment.