Skip to content

Commit 5fd5ea4

Browse files
tolushadkwon17
andauthored
Support build on arm64 platform (#216)
* Build linux/arm64 ubi9 universal image in GH action Signed-off-by: dkwon17 <[email protected]> Signed-off-by: Anatolii Bazko <[email protected]> * Update dockerfile Signed-off-by: David Kwon <[email protected]> Signed-off-by: Anatolii Bazko <[email protected]> * Update CONTRIBUTING.md Signed-off-by: David Kwon <[email protected]> Signed-off-by: Anatolii Bazko <[email protected]> * Add newline Signed-off-by: David Kwon <[email protected]> Signed-off-by: Anatolii Bazko <[email protected]> * Add PR check (#1) Signed-off-by: Anatolii Bazko <[email protected]> * chore: Rework GitHub action to build UDI on arm64 (#2) Signed-off-by: Anatolii Bazko <[email protected] Signed-off-by: Anatolii Bazko <[email protected]> * Resolve conflicts Signed-off-by: Anatolii Bazko <[email protected]> --------- Signed-off-by: dkwon17 <[email protected]> Signed-off-by: Anatolii Bazko <[email protected]> Signed-off-by: David Kwon <[email protected]> Signed-off-by: Anatolii Bazko <[email protected] Co-authored-by: dkwon17 <[email protected]>
1 parent c242528 commit 5fd5ea4

File tree

6 files changed

+474
-96
lines changed

6 files changed

+474
-96
lines changed

.github/workflows/empty-worksapce-smoke-test-on-minikube-ubi9.yaml

+143-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ env:
2626

2727
jobs:
2828
workspace-api-tests-on-minikube:
29-
runs-on: ubuntu-22.04
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
33+
runs-on: ${{matrix.runners}}
3034
steps:
3135

3236
- name: Checkout
@@ -47,11 +51,19 @@ jobs:
4751
# remove build-in images from the VM because it is not used
4852
docker rmi -f $(docker images -aq)
4953
54+
- name: Set arch environment variable
55+
run: |
56+
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
57+
echo arch="amd64" >> $GITHUB_ENV
58+
else
59+
echo arch="arm64" >> $GITHUB_ENV
60+
fi
61+
5062
- name: Start minikube cluster
51-
id: run-minikube
52-
uses: che-incubator/setup-minikube-action@next
53-
with:
54-
minikube-version: v1.31.0
63+
run: |
64+
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-${{env.arch}}
65+
install minikube-linux-${{env.arch}} /usr/local/bin/minikube && rm minikube-linux-${{env.arch}}
66+
minikube start --vm-driver=docker --addons=ingress --cpus 2 --memory 6500
5567
5668
# connect with docker daemon in the minikube and build an image there
5769
# we need to build the image in the minikube because we have just 14 GB of space on the runner
@@ -89,7 +101,7 @@ jobs:
89101
kubectl wait deployment -n devworkspace-controller devworkspace-webhook-server --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
90102
kubectl wait deployment -n devworkspace-controller devworkspace-controller-manager --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
91103
92-
- name: Check that UDI is presen in the image list
104+
- name: Check that UDI is present in the image list
93105
run: |
94106
# we used it for the build above and do not need it anymore. It saves the disk space
95107
minikube image rm quay.io/devfile/base-developer-image:ubi9-latest
@@ -105,10 +117,134 @@ jobs:
105117
repository: eclipse/che
106118
path: che
107119

120+
# Host devfile locally.
121+
# Use the insiders tag for the che-code image and the PR number for the universal-developer-image
122+
- name: Host devfile locally
123+
run: |
124+
kubectl apply -f - <<EOF
125+
apiVersion: v1
126+
kind: ConfigMap
127+
metadata:
128+
name: devfile.yaml
129+
data:
130+
devfile.yaml: |
131+
schemaVersion: 2.2.2
132+
metadata:
133+
name: che-code
134+
commands:
135+
- id: init-container-command
136+
apply:
137+
component: che-code-injector
138+
- id: init-che-code-command
139+
exec:
140+
component: che-code-runtime-description
141+
commandLine: nohup /checode/entrypoint-volume.sh > /checode/entrypoint-logs.txt 2>&1 &
142+
events:
143+
preStart:
144+
- init-container-command
145+
postStart:
146+
- init-che-code-command
147+
components:
148+
- name: che-code-injector
149+
container:
150+
image: quay.io/che-incubator/che-code:insiders
151+
command:
152+
- /entrypoint-init-container.sh
153+
volumeMounts:
154+
- name: checode
155+
path: /checode
156+
memoryLimit: 256Mi
157+
memoryRequest: 32Mi
158+
cpuLimit: 500m
159+
cpuRequest: 30m
160+
- name: che-code-runtime-description
161+
container:
162+
image: quay.io/devfile/universal-developer-image:${{ env.PR_NUMBER }}
163+
memoryLimit: 1024Mi
164+
memoryRequest: 256Mi
165+
cpuLimit: 500m
166+
cpuRequest: 30m
167+
volumeMounts:
168+
- name: checode
169+
path: /checode
170+
endpoints:
171+
- name: che-code
172+
attributes:
173+
type: main
174+
cookiesAuthEnabled: true
175+
discoverable: false
176+
urlRewriteSupported: true
177+
targetPort: 3100
178+
exposure: public
179+
secure: true
180+
protocol: https
181+
- name: code-redirect-1
182+
targetPort: 13131
183+
exposure: public
184+
protocol: https
185+
attributes:
186+
discoverable: false
187+
urlRewriteSupported: false
188+
- name: code-redirect-2
189+
targetPort: 13132
190+
exposure: public
191+
protocol: https
192+
attributes:
193+
discoverable: false
194+
urlRewriteSupported: false
195+
- name: code-redirect-3
196+
targetPort: 13133
197+
exposure: public
198+
protocol: https
199+
attributes:
200+
discoverable: false
201+
urlRewriteSupported: false
202+
attributes:
203+
app.kubernetes.io/component: che-code-runtime
204+
app.kubernetes.io/part-of: che-code.eclipse.org
205+
controller.devfile.io/container-contribution: true
206+
- name: checode
207+
volume: {}
208+
---
209+
apiVersion: v1
210+
kind: Pod
211+
metadata:
212+
name: file-server
213+
labels:
214+
app: file-server
215+
spec:
216+
containers:
217+
- name: nginx-container
218+
image: nginx
219+
ports:
220+
- containerPort: 80
221+
volumeMounts:
222+
- name: server-volume
223+
mountPath: /usr/share/nginx/html
224+
readOnly: true
225+
volumes:
226+
- name: server-volume
227+
configMap:
228+
name: devfile.yaml
229+
---
230+
apiVersion: v1
231+
kind: Service
232+
metadata:
233+
name: file-service
234+
spec:
235+
selector:
236+
app: file-server
237+
ports:
238+
- protocol: TCP
239+
port: 80
240+
targetPort: 80
241+
EOF
242+
108243
- name: Run Empty workspace smoke test
109244
run: |
110245
export TS_API_TEST_UDI_IMAGE=quay.io/devfile/universal-developer-image:${{ env.PR_NUMBER }}
246+
export TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI=http://file-service.default.svc:80/devfile.yaml
111247
cd che/tests/e2e
112248
npm i
113249
npm run driver-less-test
114-
250+

.github/workflows/pr-check.yaml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#
2+
# Copyright (c) 2021-2025 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
10+
name: Pull Request Check
11+
12+
# Trigger the workflow on pull request
13+
on: [pull_request]
14+
15+
jobs:
16+
build-base-image:
17+
name: Build base image
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
22+
runs-on: ${{matrix.runners}}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Set arch environment variable
27+
run: |
28+
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
29+
echo arch="amd64" >> $GITHUB_ENV
30+
else
31+
echo arch="arm64" >> $GITHUB_ENV
32+
fi
33+
- name: Free runner space
34+
run: sudo rm -rf /usr/local/lib/android
35+
- name: Cleanup docker images
36+
run: docker system prune -af
37+
- name: Build base image
38+
run: |
39+
cd base/ubi9 && docker buildx build \
40+
--platform linux/${{env.arch}} \
41+
--progress=plain \
42+
-t base-developer-image-${{env.arch}} .
43+
- name: Display docker images
44+
run: docker images
45+
- name: Compress image to a file
46+
run: docker save base-developer-image-${{env.arch}} | gzip > base-developer-image-${{env.arch}}.tgz
47+
- name: Upload image artifact
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: base-developer-image-${{env.arch}}
51+
path: base-developer-image-${{env.arch}}.tgz
52+
53+
build-udi:
54+
name: Build udi
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
59+
runs-on: ${{matrix.runners}}
60+
needs: build-base-image
61+
steps:
62+
- name: Set arch environment variable
63+
run: |
64+
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
65+
echo arch="amd64" >> $GITHUB_ENV
66+
else
67+
echo arch="arm64" >> $GITHUB_ENV
68+
fi
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
- name: Free runner space
72+
run: sudo rm -rf /usr/local/lib/android
73+
- name: Cleanup docker images
74+
run: docker system prune -af
75+
- name: Download BDI artifacts
76+
uses: actions/download-artifact@v4
77+
with:
78+
pattern: base-developer-image-*
79+
merge-multiple: true
80+
path: .
81+
- name: List downloaded files
82+
run: ls -lah
83+
- name: Load docker images
84+
run: docker load -i base-developer-image-${{env.arch}}.tgz
85+
- name: Display docker images
86+
run: docker images
87+
- name: Update UDI Dockerfile
88+
run: sed "s|quay.io/devfile/base-developer-image:ubi9-latest|base-developer-image-${{env.arch}}|" -i "universal/ubi9/Dockerfile"
89+
- name: Login to Quay.io
90+
uses: docker/login-action@v3
91+
with:
92+
registry: quay.io
93+
username: ${{ secrets.QUAY_USERNAME }}
94+
password: ${{ secrets.QUAY_PASSWORD }}
95+
- name: Build udi
96+
run: |
97+
cd universal/ubi9 && docker buildx build \
98+
--platform linux/${{env.arch}} \
99+
--progress=plain \
100+
--push \
101+
-t quay.io/devfile/universal-developer-image:${{env.arch}}-pr-${{github.event.number}} .
102+
103+
publish-udi:
104+
name: Publish udi
105+
runs-on: ubuntu-22.04
106+
needs: build-udi
107+
steps:
108+
- name: Login to Quay.io
109+
uses: docker/login-action@v3
110+
with:
111+
registry: quay.io
112+
username: ${{ secrets.QUAY_USERNAME }}
113+
password: ${{ secrets.QUAY_PASSWORD }}
114+
- name: publish
115+
run: |
116+
docker manifest create quay.io/devfile/universal-developer-image:pr-${{github.event.number}} \
117+
--amend quay.io/devfile/universal-developer-image:amd64-pr-${{github.event.number}} \
118+
--amend quay.io/devfile/universal-developer-image:arm64-pr-${{github.event.number}}
119+
120+
docker manifest annotate quay.io/devfile/universal-developer-image:pr-${{github.event.number}} \
121+
quay.io/devfile/universal-developer-image:amd64-pr-${{github.event.number}} \
122+
--os linux --arch amd64
123+
docker manifest annotate quay.io/devfile/universal-developer-image:pr-${{github.event.number}} \
124+
quay.io/devfile/universal-developer-image:arm64-pr-${{github.event.number}} \
125+
--os linux --arch arm64
126+
127+
docker manifest push quay.io/devfile/universal-developer-image:pr-${{github.event.number}}
128+
- name: 'Comment PR'
129+
uses: actions/github-script@v7
130+
with:
131+
script: |
132+
const { repo: { owner, repo } } = context;
133+
await github.rest.issues.createComment({
134+
issue_number: ${{github.event.number}},
135+
owner: context.repo.owner,
136+
repo: context.repo.repo,
137+
body: `Pull Request images published ✨\n\nUDI: [quay.io/devfile/universal-developer-image:pr-${{github.event.number}}](https://quay.io/devfile/universal-developer-image:pr-${{github.event.number}})`
138+
})

0 commit comments

Comments
 (0)