Skip to content

Commit 480f20a

Browse files
authored
RHOAIENG-28774: add arm64 image support in CI scripts and GitHub Actions workflows (red-hat-data-services#1330)
1 parent c4910e0 commit 480f20a

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ 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:
3637
# 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
@@ -167,17 +168,34 @@ jobs:
167168
run: sudo apt-get -qq remove podman crun
168169

169170
- 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
170173
id: cached-linuxbrew
171174
with:
172175
path: /home/linuxbrew/.linuxbrew
173-
key: linuxbrew
176+
key: linuxbrew-${{ runner.os }}-${{ runner.arch }}
174177

175-
- name: Install podman
176-
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'
177180
run: |
178181
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
179182
/home/linuxbrew/.linuxbrew/bin/brew install podman
180183
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+
181199
- name: Add linuxbrew to PATH
182200
run: echo "/home/linuxbrew/.linuxbrew/bin/" >> $GITHUB_PATH
183201

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"))

0 commit comments

Comments
 (0)