@@ -31,9 +31,10 @@ name: Build & Publish Notebook Servers (TEMPLATE)
31
31
32
32
jobs :
33
33
build :
34
- runs-on : ubuntu-24.04
34
+ # https://docs.github.com/en/actions/how-tos/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
35
+ runs-on : ${{ inputs.platform == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
35
36
env :
36
- # Some pieces of code (image pulls for example) in podman consult TMPDIR or default to /var/tmp
37
+ # Some pieces of code (image pulls, for example) in podman consult TMPDIR or default to /var/tmp
37
38
TMPDIR : /home/runner/.local/share/containers/tmpdir
38
39
# Use the rootful instance of podman for sharing images with cri-o
39
40
# https://podman-desktop.io/blog/sharing-podman-images-with-kubernetes-cluster#introduction
43
44
IMAGE_REGISTRY : " ghcr.io/${{ github.repository }}/workbench-images"
44
45
# GitHub image registry used for storing $(CONTAINER_ENGINE)'s cache
45
46
CACHE : " ghcr.io/${{ github.repository }}/workbench-images/build-cache"
46
- TRIVY_VERSION : 0.57.1
47
- TRIVY_VULNDB : " /home/runner/.local/share/containers/trivy_db"
47
+ TRIVY_VERSION : 0.64.1
48
48
# Targets (and their folder) that should be scanned using FS instead of IMAGE scan due to resource constraints
49
49
TRIVY_SCAN_FS_JSON : ' {}'
50
50
# Makefile variables
@@ -168,17 +168,34 @@ jobs:
168
168
run : sudo apt-get -qq remove podman crun
169
169
170
170
- uses : actions/cache@v4
171
+ # https://docs.github.com/en/actions/reference/variables-reference#default-environment-variables
172
+ # https://docs.github.com/en/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables
171
173
id : cached-linuxbrew
172
174
with :
173
175
path : /home/linuxbrew/.linuxbrew
174
- key : linuxbrew
176
+ key : linuxbrew-${{ runner.os }}-${{ runner.arch }}
175
177
176
- - name : Install podman
177
- if : steps.cached-linuxbrew.outputs.cache-hit != 'true'
178
+ - name : Install podman (linux/amd64)
179
+ if : inputs.platform == 'linux/amd64' && steps.cached-linuxbrew.outputs.cache-hit != 'true'
178
180
run : |
179
181
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
180
182
/home/linuxbrew/.linuxbrew/bin/brew install podman
181
183
184
+ # Warning: Your CPU architecture (arm64) is not supported. We only support
185
+ # x86_64 CPU architectures. You will be unable to use binary packages (bottles).
186
+ #
187
+ # This is a Tier 2 configuration:
188
+ # https://docs.brew.sh/Support-Tiers#tier-2
189
+ # Do not report any issues to Homebrew/* repositories!
190
+ # Read the above document instead before opening any issues or PRs.
191
+ - name : Install podman (linux/arm64)
192
+ if : inputs.platform == 'linux/arm64' && steps.cached-linuxbrew.outputs.cache-hit != 'true'
193
+ # Error: podman: no bottle available!
194
+ # If you're feeling brave, you can try to install from source with:
195
+ run : |
196
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
197
+ /home/linuxbrew/.linuxbrew/bin/brew install --build-from-source podman
198
+
182
199
- name : Add linuxbrew to PATH
183
200
run : echo "/home/linuxbrew/.linuxbrew/bin/" >> $GITHUB_PATH
184
201
@@ -247,64 +264,6 @@ jobs:
247
264
248
265
# endregion
249
266
250
- # region Trivy init & DB pre-pull
251
-
252
- - name : " pull_request|schedule: resolve target if Trivy scan should run"
253
- id : resolve-target
254
- if : ${{ fromJson(inputs.github).event_name == 'pull_request' || fromJson(inputs.github).event_name == 'schedule' }}
255
- env :
256
- EVENT_NAME : ${{ fromJson(inputs.github).event_name }}
257
- HAS_TRIVY_LABEL : ${{ contains(fromJson(inputs.github).event.pull_request.labels.*.name, 'trivy-scan') }}
258
- FS_SCAN_FOLDER : ${{ fromJson(env.TRIVY_SCAN_FS_JSON)[inputs.target] }}
259
- run : |
260
- if [[ "$EVENT_NAME" == "pull_request" && "$HAS_TRIVY_LABEL" == "true" ]]; then
261
- if [[ -n "$FS_SCAN_FOLDER" ]]; then
262
- TARGET="$FS_SCAN_FOLDER"
263
- TYPE="fs"
264
- else
265
- TARGET="${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}"
266
- TYPE="image"
267
- fi
268
- elif [[ "$EVENT_NAME" == "schedule" ]]; then
269
- if [[ -n "$FS_SCAN_FOLDER" ]]; then
270
- TARGET="$FS_SCAN_FOLDER"
271
- TYPE="fs"
272
- else
273
- TARGET="${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}"
274
- TYPE="image"
275
- fi
276
- fi
277
-
278
- if [[ -n "$TARGET" ]]; then
279
- echo "target=$TARGET" >> $GITHUB_OUTPUT
280
- echo "type=$TYPE" >> $GITHUB_OUTPUT
281
- echo "Trivy scan will run on $TARGET ($TYPE)"
282
- else
283
- echo "Trivy scan won't run"
284
- fi
285
-
286
- # only one db can be downloaded in one call https://github.com/aquasecurity/trivy/issues/3616
287
- - name : Pre-pull Trivy vulnerabilities DB
288
- if : ${{ steps.resolve-target.outputs.target }}
289
- run : |
290
- mkdir ${TRIVY_VULNDB}
291
- podman run --rm \
292
- --env PODMAN_SOCK \
293
- -v ${TRIVY_VULNDB}:/cache \
294
- docker.io/aquasec/trivy:$TRIVY_VERSION \
295
- --cache-dir /cache \
296
- image \
297
- --download-db-only
298
- podman run --rm \
299
- --env PODMAN_SOCK \
300
- -v ${TRIVY_VULNDB}:/cache \
301
- docker.io/aquasec/trivy:$TRIVY_VERSION \
302
- --cache-dir /cache \
303
- image \
304
- --download-java-db-only
305
-
306
- # endregion
307
-
308
267
# region Image build
309
268
310
269
- name : Compute extra podman build args
@@ -560,6 +519,40 @@ jobs:
560
519
561
520
# region Trivy vulnerability scan
562
521
522
+ - name : " pull_request|schedule: resolve target if Trivy scan should run"
523
+ id : resolve-target
524
+ if : ${{ fromJson(inputs.github).event_name == 'pull_request' || fromJson(inputs.github).event_name == 'schedule' }}
525
+ env :
526
+ EVENT_NAME : ${{ fromJson(inputs.github).event_name }}
527
+ HAS_TRIVY_LABEL : ${{ contains(fromJson(inputs.github).event.pull_request.labels.*.name, 'trivy-scan') }}
528
+ FS_SCAN_FOLDER : ${{ fromJson(env.TRIVY_SCAN_FS_JSON)[inputs.target] }}
529
+ run : |
530
+ if [[ "$EVENT_NAME" == "pull_request" && "$HAS_TRIVY_LABEL" == "true" ]]; then
531
+ if [[ -n "$FS_SCAN_FOLDER" ]]; then
532
+ TARGET="$FS_SCAN_FOLDER"
533
+ TYPE="fs"
534
+ else
535
+ TARGET="${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}"
536
+ TYPE="image"
537
+ fi
538
+ elif [[ "$EVENT_NAME" == "schedule" ]]; then
539
+ if [[ -n "$FS_SCAN_FOLDER" ]]; then
540
+ TARGET="$FS_SCAN_FOLDER"
541
+ TYPE="fs"
542
+ else
543
+ TARGET="${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}"
544
+ TYPE="image"
545
+ fi
546
+ fi
547
+
548
+ if [[ -n "$TARGET" ]]; then
549
+ echo "target=$TARGET" >> $GITHUB_OUTPUT
550
+ echo "type=$TYPE" >> $GITHUB_OUTPUT
551
+ echo "Trivy scan will run on $TARGET ($TYPE)"
552
+ else
553
+ echo "Trivy scan won't run"
554
+ fi
555
+
563
556
- name : Run Trivy vulnerability scanner
564
557
if : ${{ steps.resolve-target.outputs.target }}
565
558
run : |
@@ -588,12 +581,9 @@ jobs:
588
581
podman run --rm \
589
582
$PODMAN_ARGS \
590
583
-v ${REPORT_FOLDER}:/report \
591
- -v ${TRIVY_VULNDB}:/cache \
592
584
docker.io/aquasec/trivy:$TRIVY_VERSION \
593
- --cache-dir /cache \
594
585
$SCAN_TYPE \
595
586
$SCAN_ARGS \
596
- --skip-db-update \
597
587
--scanners vuln --ignore-unfixed \
598
588
--exit-code 0 --timeout 30m \
599
589
--format template --template "@/report/$REPORT_TEMPLATE" -o /report/$REPORT_FILE \
@@ -664,7 +654,7 @@ jobs:
664
654
# --ipc=host because Microsoft says so in Playwright docs
665
655
# --net=host because testcontainers connects to the Reaper container's exposed port
666
656
# we need to pass through the relevant environment variables
667
- # DEBUG configures nodejs debuggers, sets different verbosity as needed
657
+ # DEBUG configures Node.js debuggers, sets different verbosity as needed
668
658
# CI=true is set on every CI nowadays
669
659
# PODMAN_SOCK should be mounted to /var/run/docker.sock, other likely mounting locations may not exist (mkdir -p)
670
660
# TEST_TARGET is the workbench image the test will run
0 commit comments