Skip to content

Commit fcfaee2

Browse files
committed
chore: Add test for arm64
Signed-off-by: Anatolii Bazko <[email protected]>
1 parent 5330e7b commit fcfaee2

File tree

2 files changed

+239
-0
lines changed

2 files changed

+239
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Copyright (c) 2019-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+
# Contributors:
10+
# Red Hat, Inc. - initial API and implementation
11+
#
12+
13+
name: Operator test
14+
on: pull_request
15+
jobs:
16+
operator-on-minikube-arm:
17+
runs-on: ubuntu-22.04-arm
18+
steps:
19+
- name: Checkout source code
20+
uses: actions/checkout@v3
21+
- name: Start minikube cluster
22+
id: run-minikube
23+
uses: che-incubator/setup-minikube-action@next
24+
with:
25+
minikube-version: v1.29.0
26+
- name: Install yq
27+
run: sudo pip install yq
28+
- name: Install chectl
29+
run: bash <(curl -sL https://che-incubator.github.io/chectl/install.sh) --channel=next
30+
- name: Run tests
31+
run: /bin/bash build/scripts/minikube-tests/test-operator-arm64.sh
32+
- uses: actions/upload-artifact@v3
33+
if: ${{ always() }}
34+
with:
35+
name: artifacts
36+
path: /tmp/artifacts-che
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2019-2023 Red Hat, Inc.
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
# Contributors:
11+
# Red Hat, Inc. - initial API and implementation
12+
#
13+
14+
set -e
15+
set -x
16+
17+
# Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
18+
export OPERATOR_REPO="${GITHUB_WORKSPACE}"
19+
if [ -z "${OPERATOR_REPO}" ]; then
20+
OPERATOR_REPO=$(dirname "$(dirname "$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")")")
21+
fi
22+
23+
source "${OPERATOR_REPO}/build/scripts/minikube-tests/common.sh"
24+
25+
# Stop execution on any error
26+
trap "catchFinish" EXIT SIGINT
27+
28+
runTest() {
29+
buildAndCopyCheOperatorImageToMinikube
30+
yq -riSY '.spec.template.spec.containers[0].image = "'${OPERATOR_IMAGE}'"' "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}/che-operator/kubernetes/operator.yaml"
31+
yq -riSY '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}/che-operator/kubernetes/operator.yaml"
32+
33+
chectl server:deploy \
34+
--batch \
35+
--platform minikube \
36+
--k8spodwaittimeout=6000000 \
37+
--k8spodreadytimeout=6000000 \
38+
--templates "${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH}" \
39+
--che-operator-cr-patch-yaml "${OPERATOR_REPO}/build/scripts/minikube-tests/minikube-checluster-patch.yaml"
40+
41+
make wait-devworkspace-running NAMESPACE="devworkspace-controller" VERBOSE=1
42+
43+
# Free up some cpu resources
44+
kubectl scale deployment che --replicas=0 -n eclipse-che
45+
46+
createDevWorkspaceTest
47+
startAndWaitDevWorkspaceTest
48+
stopAndWaitDevWorkspace
49+
deleteDevWorkspace
50+
}
51+
52+
createDevWorkspaceTest() {
53+
kubectl apply -f - <<EOF
54+
apiVersion: v1
55+
kind: Namespace
56+
metadata:
57+
name: ${USER_NAMESPACE}
58+
annotations:
59+
che.eclipse.org/username: admin
60+
labels:
61+
app.kubernetes.io/component: workspaces-namespace
62+
app.kubernetes.io/part-of: che.eclipse.org
63+
kubernetes.io/metadata.name: ${USER_NAMESPACE}
64+
EOF
65+
66+
kubectl apply -f - <<EOF
67+
apiVersion: workspace.devfile.io/v1alpha2
68+
kind: DevWorkspaceTemplate
69+
metadata:
70+
name: che-code
71+
namespace: ${USER_NAMESPACE}
72+
spec:
73+
commands:
74+
- apply:
75+
component: che-code-injector
76+
id: init-container-command
77+
- exec:
78+
commandLine: nohup /checode/entrypoint-volume.sh > /checode/entrypoint-logs.txt
79+
2>&1 &
80+
component: che-code-runtime-description
81+
id: init-che-code-command
82+
components:
83+
- container:
84+
command:
85+
- /entrypoint-init-container.sh
86+
cpuLimit: 500m
87+
cpuRequest: 30m
88+
env:
89+
- name: CHE_DASHBOARD_URL
90+
value: https://$(minikube ip).nip.io
91+
- name: OPENVSX_REGISTRY_URL
92+
value: https://open-vsx.org
93+
image: quay.io/abazko/che-code:next
94+
memoryLimit: 256Mi
95+
memoryRequest: 32Mi
96+
sourceMapping: /projects
97+
volumeMounts:
98+
- name: checode
99+
path: /checode
100+
name: che-code-injector
101+
- attributes:
102+
app.kubernetes.io/component: che-code-runtime
103+
app.kubernetes.io/part-of: che-code.eclipse.org
104+
controller.devfile.io/container-contribution: true
105+
container:
106+
cpuLimit: 500m
107+
cpuRequest: 30m
108+
endpoints:
109+
- attributes:
110+
cookiesAuthEnabled: true
111+
discoverable: false
112+
type: main
113+
urlRewriteSupported: true
114+
exposure: public
115+
name: che-code
116+
protocol: https
117+
secure: true
118+
targetPort: 3100
119+
- attributes:
120+
discoverable: false
121+
urlRewriteSupported: false
122+
exposure: public
123+
name: code-redirect-1
124+
protocol: https
125+
targetPort: 13131
126+
- attributes:
127+
discoverable: false
128+
urlRewriteSupported: false
129+
exposure: public
130+
name: code-redirect-2
131+
protocol: https
132+
targetPort: 13132
133+
- attributes:
134+
discoverable: false
135+
urlRewriteSupported: false
136+
exposure: public
137+
name: code-redirect-3
138+
protocol: https
139+
targetPort: 13133
140+
env:
141+
- name: CHE_DASHBOARD_URL
142+
value: https://$(minikube ip).nip.io
143+
- name: OPENVSX_REGISTRY_URL
144+
value: https://open-vsx.org
145+
image: quay.io/abazko/universal-developer-image:pr-3
146+
memoryLimit: 1024Mi
147+
memoryRequest: 256Mi
148+
sourceMapping: /projects
149+
volumeMounts:
150+
- name: checode
151+
path: /checode
152+
name: che-code-runtime-description
153+
- name: checode
154+
volume: {}
155+
events:
156+
postStart:
157+
- init-che-code-command
158+
preStart:
159+
- init-container-command
160+
EOF
161+
162+
kubectl apply -f - <<EOF
163+
kind: DevWorkspace
164+
apiVersion: workspace.devfile.io/v1alpha2
165+
metadata:
166+
name: ${DEV_WORKSPACE_NAME}
167+
namespace: ${USER_NAMESPACE}
168+
spec:
169+
contributions:
170+
- kubernetes:
171+
name: che-code
172+
name: editor
173+
routingClass: che
174+
started: false
175+
template:
176+
attributes:
177+
controller.devfile.io/storage-type: ephemeral
178+
components:
179+
- name: tooling-container
180+
container:
181+
image: quay.io/abazko/universal-developer-image:pr-3
182+
cpuLimit: 100m
183+
cpuRequest: 100m
184+
EOF
185+
}
186+
187+
startAndWaitDevWorkspaceTest() {
188+
# pre-pull image for faster workspace startup
189+
minikube image pull quay.io/abazko/universal-developer-image:pr-3
190+
minikube image pull quay.io/abazko/che-code:next
191+
192+
kubectl patch devworkspace ${DEV_WORKSPACE_NAME} -p '{"spec":{"started":true}}' --type=merge -n ${USER_NAMESPACE}
193+
kubectl wait devworkspace ${DEV_WORKSPACE_NAME} -n ${USER_NAMESPACE} --for=jsonpath='{.status.phase}'=Running --timeout=300s
194+
}
195+
196+
197+
pushd ${OPERATOR_REPO} >/dev/null
198+
initDefaults
199+
initTemplates
200+
runTest
201+
popd >/dev/null
202+
203+

0 commit comments

Comments
 (0)