-
Notifications
You must be signed in to change notification settings - Fork 77
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
fix: download grype on windows runners #315
Changes from 10 commits
b13c331
01125b8
9b3285b
9aed9bf
e0a00e3
c96a0d5
338f9a7
a3d82a6
add3316
3c398f9
47ac6a5
ff87f3f
2e2320a
1d25ef9
a1707e8
0d36653
039f0d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,28 +44,158 @@ jobs: | |
- run: npm run audit | ||
- run: npm test | ||
|
||
test-as-action: # run actions to test some scenarios | ||
test-download-action: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
with: | ||
path: ./ | ||
|
||
- name: "Donwload Grype v0.54.0" | ||
- name: Download Grype v0.54.0 | ||
uses: ./download-grype # anchore/scan-action/download-grype | ||
with: | ||
grype-version: v0.54.0 | ||
|
||
- name: "Check Grype version before scan-action" | ||
- name: Check Grype version before scan-action | ||
run: grype version | egrep "^Version:.*0.54.0$" | ||
|
||
- name: "Scan test image" | ||
- name: Scan test image | ||
uses: ./ | ||
with: | ||
image: "alpine:latest" | ||
image: alpine:latest | ||
grype-version: v0.54.0 # set the same version to test that current Grype binary wasn't overwritten by the latest version | ||
fail-build: false # to prevent fail due to vuln:s on test image | ||
|
||
- name: "Check Grype version after scan-action" | ||
- name: Check Grype version after scan-action | ||
run: grype version | egrep "^Version:.*0.54.0$" | ||
|
||
test-image-input: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
image: alpine:latest | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
|
||
test-directory-input: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
path: tests/fixtures/npm-project | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
|
||
test-sbom-input: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
sbom: tests/fixtures/test_sbom.spdx.json | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
|
||
test-table-output: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
output-format: table | ||
image: alpine:latest | ||
fail-build: false | ||
|
||
test-windows-image: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
image: alpine:latest | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
|
||
test-windows-path: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
path: tests/fixtures/npm-project | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just want to double-check that this way of checking whether a file exists works on Windows - don't have a windows machine in front of me to check myself. Specifically, can you make sure that |
||
|
||
test-windows-json: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
output-format: json | ||
path: tests/fixtures/npm-project | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.json }}' | ||
|
||
test-sarif-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
image: debian:8 | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
|
||
test-sarif-directory: | ||
kzantow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
path: tests/fixtures/npm-project | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.sarif }}' | ||
|
||
test-json-directory: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: ./ | ||
id: scan | ||
with: | ||
output-format: json | ||
path: tests/fixtures/npm-project | ||
fail-build: false | ||
|
||
- name: Validate file exists | ||
run: ls '${{ steps.scan.outputs.json }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to double-check up the return code of
ls
if passed a non-existent file. On Linux, I thinktest -f
might be a cleaner test (thoughtest
isn't available on Windows).Not blocking though - this works.