@@ -53,27 +53,29 @@ jobs:
5353
5454 steps :
5555 - name : Checkout repository
56- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
56+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57+ with :
58+ fetch-tags : true
5759
5860 - name : Set up QEMU
59- uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6 .0
61+ uses : docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7 .0
6062
6163 - name : Set up Docker Buildx
62- uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
64+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
6365
6466 - name : Set up Syft
65- uses : anchore/sbom-action/download-syft@f8bdd1d8ac5e901a77a92f111440fdb1b593736b # v0.20.6
67+ uses : anchore/sbom-action/download-syft@28d71544de8eaf1b958d335707167c5f783590ad # v0.22.2
6668
6769 - name : Install cosign
68- uses : sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10 .0
70+ uses : sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0 .0
6971
7072 - name : Set image name
7173 id : image-name
7274 run : echo "value=ghcr.io/${{ github.repository }}" >> "$GITHUB_OUTPUT"
7375
7476 - name : Gather build metadata
7577 id : meta
76- uses : docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8 .0
78+ uses : docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10 .0
7779 with :
7880 images : |
7981 ${{ steps.image-name.outputs.value }}
@@ -103,32 +105,33 @@ jobs:
103105 # if_false: type=oci,dest=image.tar
104106
105107 - name : Login to GitHub Container Registry
106- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6 .0
108+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7 .0
107109 with :
108110 registry : ghcr.io
109111 username : ${{ github.actor }}
110112 password : ${{ github.token }}
111113
112114 - name : Login to Docker Hub
113- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6 .0
115+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7 .0
114116 with :
115117 username : ${{ secrets.DOCKER_USERNAME }}
116118 password : ${{ secrets.DOCKER_PASSWORD }}
117119 if : inputs.publish
118120
119121 - name : Build and push image
120122 id : build
121- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
123+ uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
122124 with :
123125 context : .
124126 platforms : linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
125127 tags : ${{ steps.meta.outputs.tags }}
126128 build-args : |
127129 BASE_IMAGE=${{ matrix.variant }}
128- VERSION=${{ fromJSON( steps.meta .outputs.json).labels['org.opencontainers.image.version'] }}
130+ VERSION=${{ steps.version .outputs.value }}
129131 COMMIT_HASH=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
130132 BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
131- labels : ${{ steps.meta.outputs.labels }}
133+ labels : |
134+ ${{ steps.meta.outputs.labels }}
132135 # cache-from: type=gha
133136 # cache-to: type=gha,mode=max
134137 outputs : type=image,push=true
@@ -178,7 +181,7 @@ jobs:
178181
179182 # TODO: uncomment when the action is working for non ghcr.io pushes. GH Issue: https://github.com/actions/attest-build-provenance/issues/80
180183 # - name: Generate build provenance attestation
181- # uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0 .0
184+ # uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2 .0
182185 # with:
183186 # subject-name: dexidp/dex
184187 # subject-digest: ${{ steps.build.outputs.digest }}
@@ -192,48 +195,59 @@ jobs:
192195 # push-to-registry: true
193196 # if: inputs.publish
194197
198+ - name : Prepare image fs for scanning
199+ run : |
200+ docker load --input image.tar
201+ docker export $(docker create --rm ${{ steps.image-name.outputs.value }}@${{ steps.build.outputs.digest }}) -o docker-image.tar
202+
203+ mkdir -p docker-image
204+ tar -xf docker-image.tar -C docker-image
205+
195206 # # Use cache for the trivy-db to avoid the TOOMANYREQUESTS error https://github.com/aquasecurity/trivy-action/pull/397
196207 # # To avoid the trivy-db becoming outdated, we save the cache for one day
197208 - name : Get data
198209 id : date
199210 run : echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
200211
201212 - name : Restore trivy cache
202- uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
213+ uses : actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
203214 with :
204215 path : cache/db
205216 key : trivy-cache-${{ steps.date.outputs.date }}
206217 restore-keys : trivy-cache-
207218
208219 - name : Run Trivy vulnerability scanner
209- uses : aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # 0.33.1
220+ uses : aquasecurity/trivy-action@c1824fd6edce30d7ab345a9989de00bbd46ef284 # 0.34.0
210221 with :
211- input : image
222+ input : docker- image
212223 format : sarif
213224 output : trivy-results.sarif
214- scan-type : " fs "
225+ scan-type : " rootfs "
215226 scan-ref : " ."
216227 cache-dir : " ./cache"
217228 # Disable skipping trivy cache for now
218- # env:
219- # TRIVY_SKIP_DB_UPDATE: true
220- # TRIVY_SKIP_JAVA_DB_UPDATE: true
229+ env :
230+ TRIVY_SKIP_DB_UPDATE : true
231+ TRIVY_SKIP_JAVA_DB_UPDATE : true
221232
222233 # # Trivy-db uses `0600` permissions.
223234 # # But `action/cache` use `runner` user by default
224235 # # So we need to change the permissions before caching the database.
225236 - name : change permissions for trivy.db
226237 run : sudo chmod 0644 ./cache/db/trivy.db
227238
239+ - name : Check Trivy sarif
240+ run : cat trivy-results.sarif
241+
228242 - name : Upload Trivy scan results as artifact
229- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
243+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
230244 with :
231245 name : " [${{ github.job }}] Trivy scan results"
232246 path : trivy-results.sarif
233247 retention-days : 5
234248 overwrite : true
235249
236250 - name : Upload Trivy scan results to GitHub Security tab
237- uses : github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v3.29.5
251+ uses : github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v3.29.5
238252 with :
239253 sarif_file : trivy-results.sarif
0 commit comments