Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 254 additions & 0 deletions .github/workflows/empty-worksapce-smoke-test-on-minikube-ubi10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
#
# Copyright (c) 2019-2025 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 udi10
on:
workflow_run:
workflows: ["Pull Request Check UBI 10"]
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:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
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: |
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

- 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}}-ubi10-pr-${{ env.PR_NUMBER }}
docker tag ${{ env.REGISTRY }}/universal-developer-image:${{env.arch}}-ubi10-pr-${{ env.PR_NUMBER }} ${{ env.REGISTRY }}/universal-developer-image:ubi10-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:ubi10-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:ubi10-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
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@

name: Empty workspace smoke test on udi9
on:
pull_request:
paths-ignore:
- '**/*.md'
- .devfile.yaml
- LICENSE
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' }}
USERSTORY: CloneGitRepoAPI
TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: kubectl
DEPLOYMENT_TIMEOUT: 90s
PULL_POLICY: IfNotPresent
# 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:
Expand All @@ -36,15 +36,20 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4
- 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 }')
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"

Expand All @@ -67,18 +72,18 @@ jobs:
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 ${{ env.REGISTRY }}/base-developer-image:ubi9-latest .
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build universal image
- name: Pull UDI image into minikube
run: |
eval $(minikube docker-env)
cd universal/ubi9 && docker build -t ${{ env.REGISTRY }}/universal-developer-image:${{ env.PR_NUMBER }} .
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
Expand All @@ -105,8 +110,6 @@ jobs:

- 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 ${{ env.REGISTRY }}/base-developer-image:ubi9-latest
minikube image list --format table

- name: Install NodeJs
Expand Down Expand Up @@ -161,7 +164,7 @@ jobs:
cpuRequest: 30m
- name: che-code-runtime-description
container:
image: ${{ env.REGISTRY }}/universal-developer-image:${{ env.PR_NUMBER }}
image: ${{ env.REGISTRY }}/universal-developer-image:ubi9-pr-${{ env.PR_NUMBER }}
memoryLimit: 1024Mi
memoryRequest: 256Mi
cpuLimit: 500m
Expand Down Expand Up @@ -244,9 +247,8 @@ jobs:

- name: Run Empty workspace smoke test
run: |
export TS_API_TEST_UDI_IMAGE=${{ env.REGISTRY }}/universal-developer-image:${{ env.PR_NUMBER }}
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

Loading