@@ -68,93 +68,27 @@ jobs:
6868 token : ${{ secrets.GITHUB_TOKEN }}
6969 working-directory : bottlecap
7070
71- build-and-scan-images :
72- name : Build and Scan Images (${{ matrix.name }})
71+ # Scan the compile image for vulnerabilities in build dependencies.
72+ # The final extension images are FROM scratch (just binaries), so scanning
73+ # them is redundant - Rust deps are covered by cargo-audit above, and
74+ # released images are scanned separately.
75+ compile-image-scan :
76+ name : Compiled Image Scan
7377 runs-on : ubuntu-22.04
74- strategy :
75- matrix :
76- include :
77- - name : amd64
78- arch : amd64
79- alpine : 0
80- suffix : amd64
81- - name : amd64-alpine
82- arch : amd64
83- alpine : 1
84- suffix : amd64-alpine
85- - name : arm64
86- arch : arm64
87- alpine : 0
88- suffix : arm64
89- - name : arm64-alpine
90- arch : arm64
91- alpine : 1
92- suffix : arm64-alpine
93- fail-fast : false
9478 steps :
9579 - name : Checkout repository
9680 uses : actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
9781
98- - name : Set up QEMU
99- uses : docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
100- with :
101- image : tonistiigi/binfmt:qemu-v9.2.2-52 # v3.6.0 latest
102- platforms : amd64,arm64
103-
10482 - name : Set up Docker Buildx
10583 uses : docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
10684
107- - name : Compile binary (${{ matrix.suffix }})
85+ - name : Build compile image
10886 run : |
109- ARCHITECTURE=${{ matrix.arch }} ALPINE=${{ matrix.alpine }} FIPS=0 DEBUG=0 FILE_SUFFIX=${{ matrix.suffix }} ./.gitlab/scripts/compile_bottlecap.sh
87+ ARCHITECTURE=amd64 ALPINE=0 FIPS=0 DEBUG=0 FILE_SUFFIX=amd64 ./.gitlab/scripts/compile_bottlecap.sh
11088 env :
11189 DOCKER_BUILDKIT : 1
11290
113- - name : Build layer (${{ matrix.suffix }})
114- run : |
115- COMPRESSER_IMAGE=ubuntu:22.04 ARCHITECTURE=${{ matrix.arch }} FILE_SUFFIX=${{ matrix.suffix }} ./.gitlab/scripts/build_layer.sh
116- env :
117- DOCKER_BUILDKIT : 1
118-
119- - name : Scan layer image with trivy
120- uses : aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
121- with :
122- image-ref : " datadog/build-extension-${{ matrix.suffix }}"
123- ignore-unfixed : true
124- exit-code : 1
125- format : table
126-
127- - name : Scan layer image with grype
128- uses : anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
129- with :
130- image : " datadog/build-extension-${{ matrix.suffix }}"
131- only-fixed : true
132- fail-build : true
133- severity-cutoff : low
134- output-format : table
135-
136- - name : Scan binary file with grype
137- uses : anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
138- with :
139- path : .binaries/bottlecap-${{ matrix.suffix }}
140- only-fixed : true
141- fail-build : true
142- severity-cutoff : low
143- output-format : table
144-
145- - name : Scan layer files with grype
146- uses : anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
147- with :
148- path : .layers/datadog_extension-${{ matrix.suffix }}
149- only-fixed : true
150- fail-build : true
151- severity-cutoff : low
152- output-format : table
153-
154- # Scan the compile image only once (it's the same for all variants)
155- # Only run for the first matrix job to avoid redundant scans
15691 - name : Scan compile image with trivy
157- if : matrix.suffix == 'amd64'
15892 uses : aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
15993 with :
16094 image-ref : " datadog/compile-bottlecap"
16397 format : table
16498
16599 - name : Scan compile image with grype
166- if : matrix.suffix == 'amd64'
167- uses : anchore/scan-action@3aaf50d765cfcceafa51d322ccb790e40f6cd8c5 # v7.2.0
100+ uses : anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
168101 with :
169102 image : " datadog/compile-bottlecap"
170103 only-fixed : true
@@ -173,7 +106,7 @@ jobs:
173106 output-format : table
174107
175108 retry :
176- needs : [trivy-scans, grype-scans, rust-dependency-scan, build-and -scan-images ]
109+ needs : [trivy-scans, grype-scans, rust-dependency-scan, compile-image -scan]
177110 if : failure() && fromJSON(github.run_attempt) < 2
178111 runs-on : ubuntu-22.04
179112 permissions :
@@ -186,7 +119,7 @@ jobs:
186119 run : gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
187120
188121 notify :
189- needs : [trivy-scans, grype-scans, rust-dependency-scan, build-and -scan-images ]
122+ needs : [trivy-scans, grype-scans, rust-dependency-scan, compile-image -scan]
190123 if : failure() && fromJSON(github.run_attempt) >= 2
191124 runs-on : ubuntu-22.04
192125 steps :
0 commit comments