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