-
Notifications
You must be signed in to change notification settings - Fork 0
422 lines (403 loc) · 21.2 KB
/
build_multi_arch_image.yml
File metadata and controls
422 lines (403 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
name: Build and push docker image
'on':
workflow_call:
inputs:
tag_latest:
required: true
type: boolean
docker_tag:
required: true
type: string
container_name:
required: true
type: string
base_folder:
required: true
type: string
NO_CACHE:
required: true
type: boolean
EXTRA_COMMON:
required: false
type: string
jobs:
build_and_push_image:
name: Build image for ${{ inputs.container_name }} on ${{ matrix.arch }}
permissions:
contents: read
packages: write
attestations: write
id-token: write
runs-on: '${{ matrix.runner }}'
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-22.04
- arch: arm64
runner: ubuntu-22.04-arm
steps:
- name: Free Disk Space for Docker
uses: endersonmenezes/free-disk-space@7901478139cff6e9d44df5972fd8ab8fcade4db1
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
remove_tool_cache: true
rm_cmd: rm
remove_packages: >-
azure-cli google-cloud-cli microsoft-edge-stable
google-chrome-stable firefox postgresql* temurin-* *llvm* mysql*
dotnet-sdk-*
remove_packages_one_command: true
- name: Login to github container registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: setup trivy
uses: aquasecurity/setup-trivy@3fb12ec12f41e471780db15c232d5dd185dcb514
with:
version: v0.69.3
- name: setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version-file: .tool-versions
- name: make install
run: |
make install-node
- name: Build container
run: |
echo "Building image..."
make build-image
env:
ARCHITECTURE: '${{ matrix.arch }}'
CONTAINER_NAME: '${{ inputs.container_name }}'
MULTI_ARCH_TAG: '${{ inputs.docker_tag }}'
BASE_VERSION_TAG: ${{ inputs.docker_tag}}
IMAGE_TAG: "${{ inputs.docker_tag }}-${{ matrix.arch }}"
BASE_FOLDER: "${{ inputs.base_folder }}"
NO_CACHE: '${{ inputs.NO_CACHE }}'
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
- name: Check docker vulnerabilities - json output
run: |
make scan-image-json
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
BASE_FOLDER: "${{ inputs.base_folder }}"
IMAGE_TAG: "${{ inputs.docker_tag }}-${{ matrix.arch }}"
EXIT_CODE: 0
EXTRA_COMMON: "${{ inputs.extra_common }}"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
name: Upload scan results
with:
name: "scan_results_docker_${{ inputs.container_name }}_${{ matrix.arch }}.json"
path: .out/scan_results_docker.json
- name: Check docker vulnerabilities - table output
run: |
make scan-image
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
BASE_FOLDER: "${{ inputs.base_folder }}"
IMAGE_TAG: "${{ inputs.docker_tag }}-${{ matrix.arch }}"
EXIT_CODE: "1"
EXTRA_COMMON: "${{ inputs.extra_common }}"
- name: Show docker vulnerability output
if: always()
run: |
echo "Scan output for ghcr.io/nhsdigital/eps-devcontainers/base:${DOCKER_TAG}-${ARCHITECTURE}"
if [ -f .out/scan_results_docker.txt ]; then
cat .out/scan_results_docker.txt
fi
env:
ARCHITECTURE: '${{ matrix.arch }}'
DOCKER_TAG: '${{ inputs.docker_tag }}'
- name: Push tagged image and rebuild for github actions
run: |
echo "Pushing image..."
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-${ARCHITECTURE}"
echo "## PUSHED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-${ARCHITECTURE}" >> "$GITHUB_STEP_SUMMARY"
echo "Rebuilding image for github actions with tag githubactions-${DOCKER_TAG}-${ARCHITECTURE}"
make build-githubactions-image BASE_IMAGE_NAME="${CONTAINER_NAME}" BASE_IMAGE_TAG="${DOCKER_TAG}-${ARCHITECTURE}" IMAGE_TAG="${DOCKER_TAG}-${ARCHITECTURE}" NO_CACHE="${{ inputs.NO_CACHE }}"
echo "Pushing github actions image..."
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-${ARCHITECTURE}"
echo "## PUSHED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-${ARCHITECTURE}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
- name: Resolve image digest
id: resolve_arch_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-${ARCHITECTURE}" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for ${DOCKER_TAG}-${ARCHITECTURE}"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
- name: Attest image
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_arch_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested image
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-${ARCHITECTURE}@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
DIGEST: ${{ steps.resolve_arch_digest.outputs.digest }}
- name: Resolve github actions image digest
id: resolve_githubactions_arch_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-${ARCHITECTURE}" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for githubactions-${DOCKER_TAG}-${ARCHITECTURE}"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
- name: Attest github actions image
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_githubactions_arch_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested github actions image
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-${ARCHITECTURE}@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
DIGEST: ${{ steps.resolve_githubactions_arch_digest.outputs.digest }}
- name: Push latest image
if: ${{ inputs.tag_latest }}
run: |
docker tag "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-${ARCHITECTURE}" "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-${ARCHITECTURE}"
echo "Pushing latest image..."
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-${ARCHITECTURE}"
echo "## PUSHED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-${ARCHITECTURE}" >> "$GITHUB_STEP_SUMMARY"
docker tag "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-${ARCHITECTURE}" "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-${ARCHITECTURE}"
echo "Pushing github actions latest image..."
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-${ARCHITECTURE}"
echo "## PUSHED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-${ARCHITECTURE}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
- name: Resolve github actions latest image digest
if: ${{ inputs.tag_latest }}
id: resolve_githubactions_latest_arch_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-${ARCHITECTURE}" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for githubactions-latest-${ARCHITECTURE}"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
- name: Attest github actions latest image
if: ${{ inputs.tag_latest }}
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_githubactions_latest_arch_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested github actions latest image
if: ${{ inputs.tag_latest }}
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-${ARCHITECTURE}@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
DIGEST: ${{ steps.resolve_githubactions_latest_arch_digest.outputs.digest }}
- name: Resolve latest image digest
if: ${{ inputs.tag_latest }}
id: resolve_latest_arch_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-${ARCHITECTURE}" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for latest-${ARCHITECTURE}"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
- name: Attest latest image
if: ${{ inputs.tag_latest }}
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_latest_arch_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested latest image
if: ${{ inputs.tag_latest }}
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-${ARCHITECTURE}@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
ARCHITECTURE: '${{ matrix.arch }}'
DIGEST: ${{ steps.resolve_latest_arch_digest.outputs.digest }}
publish_combined_image:
name: Publish combined image for ${{ inputs.container_name }}
runs-on: ubuntu-22.04
needs: build_and_push_image
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Login to github container registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Push multi-arch tagged image
run: |
BUILD_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_TIMESTAMP
echo "Creating combined image for tag ${DOCKER_TAG}"
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.source=https://github.com/NHSDigital/eps-devcontainers" \
--annotation "index:org.opencontainers.image.description=EPS devcontainer ${CONTAINER_NAME}:${DOCKER_TAG}" \
--annotation "index:org.opencontainers.image.licenses=MIT" \
--annotation "index:org.opencontainers.image.version=${DOCKER_TAG}" \
--annotation "index:org.opencontainers.image.containerName=${CONTAINER_NAME}" \
--annotation "index:org.opencontainers.image.created=${BUILD_TIMESTAMP}" \
--annotation "index:org.opencontainers.image.authors=NHS England EPS Team" \
--tag "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-amd64" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-arm64"
echo "## PUSHED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}" >> "$GITHUB_STEP_SUMMARY"
echo "Creating combined image for tag githubactions-${DOCKER_TAG}"
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.source=https://github.com/NHSDigital/eps-devcontainers" \
--annotation "index:org.opencontainers.image.description=EPS devcontainer ${CONTAINER_NAME}:${DOCKER_TAG}" \
--annotation "index:org.opencontainers.image.licenses=MIT" \
--annotation "index:org.opencontainers.image.version=${DOCKER_TAG}" \
--annotation "index:org.opencontainers.image.containerName=${CONTAINER_NAME}" \
--annotation "index:org.opencontainers.image.created=${BUILD_TIMESTAMP}" \
--annotation "index:org.opencontainers.image.authors=NHS England EPS Team" \
--tag "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-amd64" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}-arm64"
echo "## PUSHED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
- name: Push multi-arch latest image
if: ${{ inputs.tag_latest }}
run: |
echo "Creating combined image for tag latest"
docker buildx imagetools create -t "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-amd64" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-arm64"
echo "## PUSHED COMBINED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest" >> "$GITHUB_STEP_SUMMARY"
echo "Creating combined image for tag githubactions-latest"
docker buildx imagetools create -t "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-amd64" \
"ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest-arm64"
echo "## PUSHED COMBINED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
- name: Resolve combined image digest
id: resolve_combined_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for ${DOCKER_TAG}"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
- name: Attest combined image
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_combined_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested combined image
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
DIGEST: ${{ steps.resolve_combined_digest.outputs.digest }}
- name: Resolve combined github actions image digest
id: resolve_githubactions_combined_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for githubactions-${DOCKER_TAG}"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
- name: Attest combined github actions image
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_githubactions_combined_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested combined github actions image
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-${DOCKER_TAG}@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
CONTAINER_NAME: '${{ inputs.container_name }}'
DIGEST: ${{ steps.resolve_githubactions_combined_digest.outputs.digest }}
- name: Resolve latest github actions image digest
if: ${{ inputs.tag_latest }}
id: resolve_githubactions_latest_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for githubactions-latest"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
- name: Attest latest github actions image
if: ${{ inputs.tag_latest }}
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_githubactions_latest_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested latest github actions image
if: ${{ inputs.tag_latest }}
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:githubactions-latest@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
DIGEST: ${{ steps.resolve_githubactions_latest_digest.outputs.digest }}
- name: Resolve latest image digest
if: ${{ inputs.tag_latest }}
id: resolve_latest_digest
run: |
DIGEST=$(docker buildx imagetools inspect "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest" | awk '/^Digest:/ {print $2; exit}')
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
echo "Resolved digest ${DIGEST} for latest"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
- name: Attest latest image
if: ${{ inputs.tag_latest }}
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
with:
subject-name: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.container_name }}
subject-digest: ${{ steps.resolve_latest_digest.outputs.digest }}
push-to-registry: false
- name: Summarise attested latest image
if: ${{ inputs.tag_latest }}
run: |
echo "## ATTESTED IMAGE : ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest@${DIGEST}" >> "$GITHUB_STEP_SUMMARY"
env:
CONTAINER_NAME: '${{ inputs.container_name }}'
DIGEST: ${{ steps.resolve_latest_digest.outputs.digest }}