Skip to content

Commit 568d153

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 9251d2c + 758b444 commit 568d153

File tree

5 files changed

+136
-72
lines changed

5 files changed

+136
-72
lines changed

.github/workflows/build-notebooks-TEMPLATE.yaml

Lines changed: 59 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ name: Build & Publish Notebook Servers (TEMPLATE)
3131

3232
jobs:
3333
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' }}
3536
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
3738
TMPDIR: /home/runner/.local/share/containers/tmpdir
3839
# Use the rootful instance of podman for sharing images with cri-o
3940
# https://podman-desktop.io/blog/sharing-podman-images-with-kubernetes-cluster#introduction
@@ -43,8 +44,7 @@ jobs:
4344
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images"
4445
# GitHub image registry used for storing $(CONTAINER_ENGINE)'s cache
4546
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
4848
# Targets (and their folder) that should be scanned using FS instead of IMAGE scan due to resource constraints
4949
TRIVY_SCAN_FS_JSON: '{}'
5050
# Makefile variables
@@ -168,17 +168,34 @@ jobs:
168168
run: sudo apt-get -qq remove podman crun
169169

170170
- 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
171173
id: cached-linuxbrew
172174
with:
173175
path: /home/linuxbrew/.linuxbrew
174-
key: linuxbrew
176+
key: linuxbrew-${{ runner.os }}-${{ runner.arch }}
175177

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'
178180
run: |
179181
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
180182
/home/linuxbrew/.linuxbrew/bin/brew install podman
181183
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+
182199
- name: Add linuxbrew to PATH
183200
run: echo "/home/linuxbrew/.linuxbrew/bin/" >> $GITHUB_PATH
184201

@@ -247,64 +264,6 @@ jobs:
247264
248265
# endregion
249266

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-
308267
# region Image build
309268

310269
- name: Compute extra podman build args
@@ -560,6 +519,40 @@ jobs:
560519

561520
# region Trivy vulnerability scan
562521

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+
563556
- name: Run Trivy vulnerability scanner
564557
if: ${{ steps.resolve-target.outputs.target }}
565558
run: |
@@ -588,12 +581,9 @@ jobs:
588581
podman run --rm \
589582
$PODMAN_ARGS \
590583
-v ${REPORT_FOLDER}:/report \
591-
-v ${TRIVY_VULNDB}:/cache \
592584
docker.io/aquasec/trivy:$TRIVY_VERSION \
593-
--cache-dir /cache \
594585
$SCAN_TYPE \
595586
$SCAN_ARGS \
596-
--skip-db-update \
597587
--scanners vuln --ignore-unfixed \
598588
--exit-code 0 --timeout 30m \
599589
--format template --template "@/report/$REPORT_TEMPLATE" -o /report/$REPORT_FILE \
@@ -664,7 +654,7 @@ jobs:
664654
# --ipc=host because Microsoft says so in Playwright docs
665655
# --net=host because testcontainers connects to the Reaper container's exposed port
666656
# 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
668658
# CI=true is set on every CI nowadays
669659
# PODMAN_SOCK should be mounted to /var/run/docker.sock, other likely mounting locations may not exist (mkdir -p)
670660
# TEST_TARGET is the workbench image the test will run

.github/workflows/security.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# https://github.com/ruivieira/trustyai-explainability-python/blob/main/.github/workflows/security.yaml
2+
---
3+
name: Security
4+
"on":
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
10+
jobs:
11+
build:
12+
name: Trivy scan (fs)
13+
runs-on: ubuntu-24.04
14+
permissions:
15+
contents: read
16+
security-events: write
17+
steps:
18+
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Trivy scan
23+
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # 0.32.0
24+
with:
25+
scan-type: 'fs'
26+
format: 'sarif'
27+
output: 'trivy-results.sarif'
28+
severity: 'MEDIUM,HIGH,CRITICAL'
29+
exit-code: '0'
30+
ignore-unfixed: false
31+
32+
- name: Update Security tab
33+
uses: github/codeql-action/upload-sarif@v3
34+
with:
35+
sarif_file: 'trivy-results.sarif'

ci/cached-builds/gen_gha_matrix_jobs.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@
2121

2222
project_dir = pathlib.Path(__file__).parent.parent.parent.absolute()
2323

24+
ARM64_COMPATIBLE = {
25+
"codeserver-ubi9-python-3.11",
26+
"codeserver-ubi9-python-3.12",
27+
}
28+
2429
S390X_COMPATIBLE = {
2530
"runtime-minimal-ubi9-python-3.11",
31+
"runtime-minimal-ubi9-python-3.12",
2632
# add more here
2733
}
2834

@@ -57,6 +63,12 @@ class RhelImages(enum.Enum):
5763
INCLUDE_ONLY = "include-only"
5864

5965

66+
class Arm64Images(enum.Enum):
67+
EXCLUDE = "exclude"
68+
INCLUDE = "include"
69+
ONLY = "only"
70+
71+
6072
class S390xImages(enum.Enum):
6173
EXCLUDE = "exclude"
6274
INCLUDE = "include"
@@ -82,6 +94,15 @@ def main() -> None:
8294
nargs="?",
8395
help="Whether to `include` rhel images or `exclude` them or `include-only` them",
8496
)
97+
argparser.add_argument(
98+
"--arm64-images",
99+
type=Arm64Images,
100+
choices=list(Arm64Images),
101+
required=False,
102+
default=Arm64Images.INCLUDE,
103+
nargs="?",
104+
help="Whether to include, exclude, or only include arm64 images",
105+
)
85106
argparser.add_argument(
86107
"--s390x-images",
87108
type=S390xImages,
@@ -113,9 +134,12 @@ def main() -> None:
113134

114135
targets_with_platform: list[tuple[str, str]] = []
115136
for target in targets:
116-
if args.s390x_images != S390xImages.ONLY:
137+
if args.s390x_images != S390xImages.ONLY or args.arm64_images != Arm64Images.ONLY:
117138
targets_with_platform.append((target, "linux/amd64"))
118-
if args.s390x_images != S390xImages.EXCLUDE:
139+
if args.arm64_images != Arm64Images.EXCLUDE and args.s390x_images != S390xImages.ONLY:
140+
if target in ARM64_COMPATIBLE:
141+
targets_with_platform.append((target, "linux/arm64"))
142+
if args.s390x_images != S390xImages.EXCLUDE and args.arm64_images != Arm64Images.ONLY:
119143
# NOTE: hardcode the list of s390x-compatible Makefile targets in S390X_COMPATIBLE
120144
if target in S390X_COMPATIBLE:
121145
targets_with_platform.append((target, "linux/s390x"))

ci/cached-builds/kubeadm.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,16 @@ controllerManager: {}
5959
dns: {}
6060
proxy: {}
6161
scheduler: {}
62+
---
63+
apiVersion: kubelet.config.k8s.io/v1beta1
64+
kind: KubeletConfiguration
65+
# ISSUE #1326: disable gc, otherwise kubelet would GC Pytorch images causing later tests to fail
66+
# The low threshold must be strictly less than the high threshold
67+
imageGCHighThresholdPercent: 100
68+
imageGCLowThresholdPercent: 99
69+
# https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#minimum-eviction-reclaim
70+
evictionHard:
71+
# eviction threshold nodefs.available must be positive
72+
nodefs.available: "1Mi"
73+
# eviction threshold imagefs.available must be positive
74+
imagefs.available: "1Mi"

codeserver/ubi9-python-3.11/Dockerfile.cpu

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/oc
2929
####################
3030
FROM base AS codeserver
3131

32+
ARG TARGETOS TARGETARCH
33+
3234
ARG CODESERVER_SOURCE_CODE=codeserver/ubi9-python-3.11
3335
ARG CODESERVER_VERSION=v4.98.0
3436

@@ -50,7 +52,7 @@ WORKDIR /opt/app-root/bin
5052
RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
5153

5254
# Install code-server
53-
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
55+
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-${TARGETARCH}.rpm" && \
5456
yum -y clean all --enablerepo='*'
5557

5658
COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/utils utils/

0 commit comments

Comments
 (0)