Skip to content

Empty workspace smoke test on udi9 #2

Empty workspace smoke test on udi9

Empty workspace smoke test on udi9 #2

#
# 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:
workflow_run:
workflows: ["Pull Request Check"]
types:
- completed
branches:
- '**'
env:
# Use repository variable if set, otherwise fallback to default registry
REGISTRY: ${{ vars.REGISTRY || 'quay.io/devfile' }}
TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: kubectl
DEPLOYMENT_TIMEOUT: 90s
jobs:
workspace-api-tests-on-minikube:
if: github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
include:
- name: amd64-build
runner: ubuntu-22.04
arch: amd64
- name: arm64-build
runner: ubuntu-22.04-arm
arch: arm64
- name: ppc64le-build
runner: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free runner space
run: |
sudo rm -rf /usr/local/lib/android
- name: Get PR number
run: |
pr_number="${{ github.event.workflow_run.pull_requests[0].number }}"
if [ -z "$pr_number" ] || [ "$pr_number" == "null" ]; then
pr_number=$(echo "${{ github.event.workflow_run.head_branch }}" | grep -oE '[0-9]+' | head -1 || echo "")
fi
if [ -z "$pr_number" ]; then
echo "Error: Could not extract PR number from workflow_run event"
exit 1
fi
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: echo "arch=${{ matrix.arch }}" >> $GITHUB_ENV
- 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
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Pull UDI image into minikube
run: |
eval $(minikube docker-env)
docker pull ${{ env.REGISTRY }}/universal-developer-image:${{env.arch}}-pr-${{ env.PR_NUMBER }}
docker tag ${{ env.REGISTRY }}/universal-developer-image:${{env.arch}}-pr-${{ env.PR_NUMBER }} ${{ env.REGISTRY }}/universal-developer-image:ubi9-pr-${{ 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: |
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: ${{ env.REGISTRY }}/universal-developer-image:ubi9-pr-${{ 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=${{ env.REGISTRY }}/universal-developer-image:ubi9-pr-${{ 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