-
Notifications
You must be signed in to change notification settings - Fork 66
250 lines (232 loc) · 8.81 KB
/
empty-worksapce-smoke-test-on-minikube-ubi9.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#
# Copyright (c) 2019-2024 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
name: Empty workspace smoke test on udi9
on:
pull_request:
paths-ignore:
- '**/*.md'
- .devfile.yaml
- LICENSE
env:
USERSTORY: CloneGitRepoAPI
TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: kubectl
DEPLOYMENT_TIMEOUT: 90s
PULL_POLICY: IfNotPresent
jobs:
workspace-api-tests-on-minikube:
strategy:
fail-fast: false
matrix:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Free runner space
run: |
sudo rm -rf /usr/local/lib/android
# obtain the PR number for tegging the image
- name: Get PR number
id: get_pr_number
run: |
pr_number=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
echo ">>>>>>>>>>>$pr_number"
- name: Cleanup build-in images
run: |
# remove build-in images from the VM because it is not used
docker rmi -f $(docker images -aq)
- name: Set arch environment variable
run: |
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
echo arch="amd64" >> $GITHUB_ENV
else
echo arch="arm64" >> $GITHUB_ENV
fi
- name: Start minikube cluster
run: |
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-${{env.arch}}
install minikube-linux-${{env.arch}} /usr/local/bin/minikube && rm minikube-linux-${{env.arch}}
minikube start --vm-driver=docker --addons=ingress --cpus 2 --memory 6500
# connect with docker daemon in the minikube and build an image there
# we need to build the image in the minikube because we have just 14 GB of space on the runner
# the UBI have more than 9 GB size this approach saves the disk space
- name: Build base image
run: |
eval $(minikube docker-env)
cd base/ubi9 && docker build -t quay.io/devfile/base-developer-image:ubi9-latest .
- name: Build universal image
run: |
eval $(minikube docker-env)
cd universal/ubi9 && docker build -t quay.io/devfile/universal-developer-image:${{ env.PR_NUMBER }} .
- name: Checkout DWO
uses: actions/checkout@master
with:
repository: devfile/devworkspace-operator
path: devworkspace-operator
- name: Setup cert manager
run: |
cd devworkspace-operator
make install_cert_manager
kubectl wait deployment -n cert-manager cert-manager --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
kubectl wait deployment -n cert-manager cert-manager-cainjector --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
kubectl wait deployment -n cert-manager cert-manager-webhook --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
- name: Setup DWO
run: |
cd devworkspace-operator
make install
kubectl rollout status deployment -n devworkspace-controller devworkspace-controller-manager --timeout=$DEPLOYMENT_TIMEOUT
kubectl rollout status deployment -n devworkspace-controller devworkspace-webhook-server --timeout=$DEPLOYMENT_TIMEOUT
kubectl wait deployment -n devworkspace-controller devworkspace-webhook-server --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
kubectl wait deployment -n devworkspace-controller devworkspace-controller-manager --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT
- name: Check that UDI is present in the image list
run: |
# we used it for the build above and do not need it anymore. It saves the disk space
minikube image rm quay.io/devfile/base-developer-image:ubi9-latest
minikube image list --format table
- name: Install NodeJs
uses: actions/setup-node@v4
- name: Checkout tests codebase
uses: actions/checkout@master
with:
ref: api-test-with-clone-project-without-generating
repository: eclipse/che
path: che
# Host devfile locally.
# Use the insiders tag for the che-code image and the PR number for the universal-developer-image
- name: Host devfile locally
run: |
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: devfile.yaml
data:
devfile.yaml: |
schemaVersion: 2.2.2
metadata:
name: che-code
commands:
- id: init-container-command
apply:
component: che-code-injector
- id: init-che-code-command
exec:
component: che-code-runtime-description
commandLine: nohup /checode/entrypoint-volume.sh > /checode/entrypoint-logs.txt 2>&1 &
events:
preStart:
- init-container-command
postStart:
- init-che-code-command
components:
- name: che-code-injector
container:
image: quay.io/che-incubator/che-code:insiders
command:
- /entrypoint-init-container.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 256Mi
memoryRequest: 32Mi
cpuLimit: 500m
cpuRequest: 30m
- name: che-code-runtime-description
container:
image: quay.io/devfile/universal-developer-image:${{ env.PR_NUMBER }}
memoryLimit: 1024Mi
memoryRequest: 256Mi
cpuLimit: 500m
cpuRequest: 30m
volumeMounts:
- name: checode
path: /checode
endpoints:
- name: che-code
attributes:
type: main
cookiesAuthEnabled: true
discoverable: false
urlRewriteSupported: true
targetPort: 3100
exposure: public
secure: true
protocol: https
- name: code-redirect-1
targetPort: 13131
exposure: public
protocol: https
attributes:
discoverable: false
urlRewriteSupported: false
- name: code-redirect-2
targetPort: 13132
exposure: public
protocol: https
attributes:
discoverable: false
urlRewriteSupported: false
- name: code-redirect-3
targetPort: 13133
exposure: public
protocol: https
attributes:
discoverable: false
urlRewriteSupported: false
attributes:
app.kubernetes.io/component: che-code-runtime
app.kubernetes.io/part-of: che-code.eclipse.org
controller.devfile.io/container-contribution: true
- name: checode
volume: {}
---
apiVersion: v1
kind: Pod
metadata:
name: file-server
labels:
app: file-server
spec:
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: server-volume
mountPath: /usr/share/nginx/html
readOnly: true
volumes:
- name: server-volume
configMap:
name: devfile.yaml
---
apiVersion: v1
kind: Service
metadata:
name: file-service
spec:
selector:
app: file-server
ports:
- protocol: TCP
port: 80
targetPort: 80
EOF
- name: Run Empty workspace smoke test
run: |
export TS_API_TEST_UDI_IMAGE=quay.io/devfile/universal-developer-image:${{ env.PR_NUMBER }}
export TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI=http://file-service.default.svc:80/devfile.yaml
cd che/tests/e2e
npm i
npm run driver-less-test