Skip to content

Commit 83be915

Browse files
committed
ci: scan vulnerability
Signed-off-by: Kentaro Hayashi <[email protected]>
1 parent addb2b8 commit 83be915

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/scan-images.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Scan image vulnerability
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
# Sunday, 18:00 JST
9+
- cron: '0 9 * * 0'
10+
11+
concurrency:
12+
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
setup:
17+
name: Scan image with grype security vulnerability scanner
18+
strategy:
19+
fail-fast: false
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Pull latest grype container image
23+
run: |
24+
docker pull anchore/grype:latest
25+
debian:
26+
needs: setup
27+
name: Scan debian image with grype
28+
strategy:
29+
fail-fast: false
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Pull and scan upstream trixie image
33+
run: |
34+
docker pull debian:trixie
35+
echo "# Scan debian image with grype (filter)" >> $GITHUB_STEP_SUMMARY
36+
docker run --rm anchore/grype:latest debian:trixie | grep -v Negligible | grep -v "won't" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
37+
echo "# Scan debian image with grype" >> $GITHUB_STEP_SUMMARY
38+
docker run --rm anchore/grype:latest debian:trixie | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
39+
ruby:
40+
needs: setup
41+
name: Scan Ruby image with grype
42+
strategy:
43+
fail-fast: false
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Pull and scan upstream Ruby image
47+
run: |
48+
docker pull ruby:3.4-slim
49+
echo "# Scan Ruby image with grype (filter)" >> $GITHUB_STEP_SUMMARY
50+
docker run --rm anchore/grype:latest ruby:3.4-slim | grep -v Negligible | grep -v "won't" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
51+
echo "# Scan Ruby image with grype" >> $GITHUB_STEP_SUMMARY
52+
docker run --rm anchore/grype:latest ruby:3.4-slim | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
53+
fluentd:
54+
needs: setup
55+
name: Scan Fluentd image with grype
56+
strategy:
57+
fail-fast: false
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v6
61+
- name: Pull and scan Fluentd image
62+
run: |
63+
# v1.19.1-debian-amd64
64+
IMAGE=$(make echo-all-images | cut -d' ' -f1|cut -d',' -f3)
65+
echo "# Scan Fluentd image with grype (filter)" >> $GITHUB_STEP_SUMMARY
66+
docker run --rm anchore/grype:latest fluent/fluentd:$IMAGE | grep -v Negligible | grep -v "won't" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
67+
echo "# Scan Fluentd image with grype" >> $GITHUB_STEP_SUMMARY
68+
docker run --rm anchore/grype:latest fluent/fluentd:$IMAGE | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)