-
Notifications
You must be signed in to change notification settings - Fork 36
180 lines (158 loc) · 6.53 KB
/
smoke-test-pr-check.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
#
# Copyright (c) 2023-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: Smoke Test
# Trigger the workflow on pull request
on:
pull_request:
paths-ignore:
- '**/*.md'
- devfile.yaml
- '.che/*'
- '.rebase/*'
env:
LOCAL_TEST_DIR: /tmp
jobs:
smoke-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout che-code source code
uses: actions/checkout@v3
- name: Prepare Che-Code Dockerfile ( remove tests )
run: |
#
# truncate Dockerfile, remove section that runs tests
#
cp -f build/dockerfiles/linux-libc-ubi8.Dockerfile build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile
REMOVE_FROM="### Beginning of tests"
REMOVE_TO="### Ending of tests"
sed -i "/${REMOVE_FROM}/,/${REMOVE_TO}/{/${REMOVE_FROM}/n;/${REMOVE_TO}/!d;}" build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile
#
# show the Dockerfile
#
cat build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile
- name: Compile Che-Code editor
run: |
#
# build linux-libc-ubi8-amd64:latest docker image
#
docker image prune -a -f
docker build --memory-swap -1 --memory 12g -f build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile -t linux-libc-ubi8-amd64 .
- name: Build Che-Code Docker image
run: |
#
# build che-code:latest docker image
#
cp -f build/dockerfiles/assembly.Dockerfile build/dockerfiles/assembly.copy.Dockerfile
REPLACE_FROM="FROM linux-musl-amd64 as linux-musl-content"
sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
REPLACE_FROM="COPY --from=linux-musl-content --chown=0:0 /checode-linux-musl /mnt/rootfs/checode-linux-musl"
sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
REPLACE_FROM="FROM linux-libc-ubi9-amd64 as linux-libc-ubi9-content"
sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
REPLACE_FROM="COPY --from=linux-libc-ubi9-content --chown=0:0 /checode-linux-libc/ubi9 /mnt/rootfs/checode-linux-libc/ubi9"
sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
export DOCKER_BUILDKIT=1
docker build -f build/dockerfiles/assembly.copy.Dockerfile -t che-code .
docker tag che-code:latest che-code:next
docker save -o /tmp/che-code-latest.tar che-code:latest che-code:next
- name: Display docker images
run: |
docker images
- name: Cleanup docker images
run: |
docker system prune -af
- name: Disk free
run: |
df -h
- name: Start minikube
id: run-minikube
uses: che-incubator/setup-minikube-action@next
with:
minikube-version: v1.23.2
- name: Install chectl
run: bash <(curl -sL https://che-incubator.github.io/chectl/install.sh) --channel=next
- name: Deploy Che
run: |
#
# load che-code images from /tmp/che-code-latest.tar
#
eval $(minikube docker-env) && docker load -i /tmp/che-code-latest.tar && rm /tmp/che-code-latest.tar
#
# deploy Che
#
chectl server:deploy \
--batch \
--platform minikube \
--k8spodwaittimeout=480000 \
--k8spodreadytimeout=480000 \
--che-operator-cr-patch-yaml "${GITHUB_WORKSPACE}/build/test/github-minikube-checluster-patch.yaml"
#
# apply patch
#
kubectl patch devworkspaceoperatorconfigs \
-n eclipse-che devworkspace-config \
--patch '{"config": {"workspace": {"imagePullPolicy": "IfNotPresent"}}}' \
--type merge
- name: Pull Universal Base Image
run: |
minikube image pull quay.io/devfile/universal-developer-image:ubi8-latest
- name: Run Smoke test
run: |
docker run \
--shm-size=2048m \
-p 5920:5920 \
--network="host" \
-e TS_SELENIUM_LOAD_PAGE_TIMEOUT=60000 \
-e [email protected] \
-e TS_SELENIUM_PASSWORD=admin \
-e TS_SELENIUM_BASE_URL=https://$(kubectl get ingress che -n eclipse-che -o jsonpath='{.spec.rules[0].host}') \
-e DELETE_WORKSPACE_ON_FAILED_TEST=true \
-e TS_SELENIUM_START_WORKSPACE_TIMEOUT=120000 \
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
-e VIDEO_RECORDING=true \
-e TS_SELENIUM_LOG_LEVEL=TRACE \
-e TS_WAIT_LOADER_PRESENCE_TIMEOUT=120000 \
-e TS_COMMON_DASHBOARD_WAIT_TIMEOUT=30000 \
-v ${LOCAL_TEST_DIR}/tests/e2e/report:/tmp/e2e/report:Z \
-v ${LOCAL_TEST_DIR}/tests/e2e/video:/tmp/ffmpeg_report:Z \
-e USERSTORY=SmokeTest \
-e TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=false \
-e TEST_REPO=https://github.com/che-incubator/quarkus-api-example?df=smoke-test.devfile.yaml \
quay.io/mmusiien/che-e2e:smoke-test
- name: Bump logs
if: always()
run: |
NS=admin-che
TARGET_DIR="/tmp/devworkspace-happy-path-artifacts/${NS}-info"
mkdir -p "$TARGET_DIR"
for POD in $(kubectl get pods -o name -n ${NS}); do
for CONTAINER in $(kubectl get -n ${NS} ${POD} -o jsonpath="{.spec.containers[*].name}"); do
echo "[INFO] Downloading logs $POD/$CONTAINER in $NS"
# container name includes `pod/` prefix. remove it
LOGS_FILE=$TARGET_DIR/$(echo ${POD}-${CONTAINER}.log | sed 's|pod/||g')
kubectl logs ${POD} -c ${CONTAINER} -n ${NS} > $LOGS_FILE || true
done
done
echo "[INFO] Bumping events in namespace ${NS}"
kubectl get events -n $NS > $TARGET_DIR/events.log || true
- name: Store e2e artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: e2e-artifacts
path: /tmp/tests
- name: Store k8s logs
if: always()
uses: actions/upload-artifact@v3
with:
name: k8s-logs
path: /tmp/devworkspace-happy-path-artifacts/admin-che-info