Skip to content

Commit 787c9be

Browse files
committed
try using grype and trivy from Linuxbrew
1 parent ff87fc7 commit 787c9be

File tree

6 files changed

+43
-14
lines changed

6 files changed

+43
-14
lines changed

.github/workflows/build_ci_multi.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@ jobs:
5050
name: 'build multi image'
5151
- run: buildah unshare make dist_name=localhost/curl-multi release_tag=master test
5252
name: 'test image'
53-
- run: make image_name=localhost/curl-multi:master scan
54-
name: 'security scan image'
53+
- name: 'install scan prereqs'
54+
run: /home/linuxbrew/.linuxbrew/bin/brew install grype trivy
55+
- name: 'security scan image'
56+
run: |
57+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
58+
make image_name=localhost/curl-multi:master scan

.github/workflows/build_latest_release_multi.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ jobs:
6464
name: 'build multi image'
6565
- run: buildah unshare make dist_name=localhost/curl-multi release_tag=$REL test
6666
name: 'test image'
67-
- run: make image_name=localhost/curl-multi:${REL} scan
68-
name: 'security scan image'
67+
- name: 'install scan prereqs'
68+
run: /home/linuxbrew/.linuxbrew/bin/brew install grype trivy
69+
- name: 'security scan image'
70+
run: |
71+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
72+
make image_name=localhost/curl-multi:${REL} scan
6973
- run: |
7074
buildah manifest push --format v2s2 --all curl-multi:$REL "docker://ghcr.io/curl/curl-container/curl-multi:${REL}"
7175
buildah manifest push --format v2s2 --all curl-base-multi:$REL "docker://ghcr.io/curl/curl-container/curl-base-multi:${REL}"

.github/workflows/build_master.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ jobs:
5858
name: 'build master images'
5959
- run: buildah unshare make dist_name=localhost/curl release_tag=master test
6060
name: 'test image'
61-
- run: make image_name=localhost/curl:master scan
62-
name: 'security scan image'
61+
- name: 'install scan prereqs'
62+
run: /home/linuxbrew/.linuxbrew/bin/brew install grype trivy
63+
- name: 'security scan image'
64+
run: |
65+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
66+
make image_name=localhost/curl:master scan
6367
- run: |
6468
buildah push curl-dev:master "docker://ghcr.io/curl/curl-container/curl-dev:master"
6569
buildah push curl-base:master "docker://ghcr.io/curl/curl-container/curl-base:master"

.github/workflows/build_master_dev.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ jobs:
5757
name: 'install dev deps'
5858
- run: buildah unshare make branch_or_ref=master release_tag=master build_debian
5959
name: 'build debian dev image'
60-
- run: make image_name=localhost/curl-dev-debian:master scan
61-
name: 'security scan image'
60+
- name: 'install scan prereqs'
61+
run: /home/linuxbrew/.linuxbrew/bin/brew install grype trivy
62+
- name: 'security scan image'
63+
run: |
64+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
65+
make image_name=localhost/curl-dev-debian:master scan
6266
- run: |
6367
buildah push curl-dev-debian:master "docker://ghcr.io/curl/curl-container/curl-dev-debian:master"
6468
name: 'push images to github registry'
@@ -78,8 +82,10 @@ jobs:
7882
cosign verify --key cosign.pub ghcr.io/curl/curl-container/curl-dev-debian:master
7983
- run: buildah unshare make branch_or_ref=master release_tag=master build_fedora
8084
name: 'build fedora dev image'
81-
- run: make image_name=localhost/curl-dev-fedora:master scan
82-
name: 'security scan image'
85+
- name: 'security scan image'
86+
run: |
87+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
88+
make image_name=localhost/curl-dev-fedora:master scan
8389
- run: |
8490
buildah push curl-dev-fedora:master "docker://ghcr.io/curl/curl-container/curl-dev-fedora:master"
8591
name: 'push images to github registry'

.github/workflows/build_master_multi.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ jobs:
5858
name: 'build multi image'
5959
- run: buildah unshare make dist_name=localhost/curl-multi release_tag=master test
6060
name: 'test image'
61-
- run: make image_name=localhost/curl-multi:master scan
62-
name: 'security scan image'
61+
- name: 'install scan prereqs'
62+
run: /home/linuxbrew/.linuxbrew/bin/brew install grype trivy
63+
- name: 'security scan image'
64+
run: |
65+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
66+
make image_name=localhost/curl-multi:master scan
6367
- run: |
6468
buildah manifest push --all --format v2s2 localhost/curl-base-multi:master "docker://ghcr.io/curl/curl-container/curl-base-multi:master"
6569
buildah manifest push --all --format v2s2 localhost/curl-multi:master "docker://ghcr.io/curl/curl-container/curl-multi:master"

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,23 @@ feature-test:
8383
#
8484
# > make image_name=localhost/curl:master scan
8585
#
86+
# Requires: grype trivy
87+
#
88+
# One way to install them:
89+
# curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
90+
# curl -sSfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo bash -s -- -b /usr/local/bin v0.32.0
91+
#
8692
scan:
8793
podman save -o image.tar ${image_name}
8894
# Run clamav on image.tar
8995
# freshclam
9096
clamscan image.tar
9197
# run grype on image.tar
92-
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin && grype image.tar
98+
grype --version
99+
grype image.tar
93100
# run trivy on image.tar
94101
systemctl --user enable --now podman.socket | true
95-
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo bash -s -- -b /usr/local/bin v0.32.0
102+
trivy --version
96103
trivy image --input image.tar
97104
rm image.tar
98105

0 commit comments

Comments
 (0)