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