Skip to content

Commit

Permalink
WIP E2E Testing
Browse files Browse the repository at this point in the history
Contributed on behalf of STMicroelectronics
  • Loading branch information
jfaltermeier committed Aug 26, 2024
1 parent 39be9e4 commit 464ba3c
Show file tree
Hide file tree
Showing 7 changed files with 575 additions and 0 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: "[E2E Tests] Minikube"

on:
push:
branches:
- e2e-testing
inputs:
theia-cloud-helm-branch:
description: "Theia Cloud Helm Branch to use"
type: string
default: "main"
workflow_dispatch:
inputs:
theia-cloud-helm-branch:
description: "Theia Cloud Helm Branch to use"
type: string
default: "main"

permissions:
contents: read

concurrency:
group: ci-e2e-theia-cloud-minikube-${{ github.ref }}
cancel-in-progress: true

jobs:
runtests:
name: Run Tests on Minikube
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes: [v1.31.0] #[v1.31.0, v1.30.4, v1.29.8, v1.28.13]
paths: [false] #[true, false]
ephemeral: [true] #[true, false]
keycloak: [false] #[true, false]
steps:
- name: Checkout Theia Cloud
uses: actions/checkout@v4
with:
path: "./theia-cloud"

- name: Checkout Theia Cloud Helm
uses: actions/checkout@v4
with:
repository: "eclipsesource/theia-cloud-helm"
ref: "${{ github.event.inputs.theia-cloud-helm-branch }}"
path: "./theia-cloud-helm"

- name: Setup Minikube
uses: manusa/actions-setup-minikube@92af4db914ab207f837251cd53eb7060e6477614
with:
minikube version: v1.33.1
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}
start args: "--force"

- name: Enable Minikube Addons
run: |
minikube addons enable dashboard
minikube addons enable default-storageclass
minikube addons enable ingress
minikube addons enable metrics-server
- name: List Minikube Addons
run: minikube addons list

- name: Patch Ingress to allow snippet annotations and restart
run: |
kubectl -n ingress-nginx patch cm ingress-nginx-controller --patch '{"data":{"allow-snippet-annotations":"true"}}'
kubectl -n ingress-nginx delete pod -l app.kubernetes.io/name=ingress-nginx
# we use the non driver, so minikube should see the same images as the host
- name: Build Theia Cloud Images
run: |
cd theia-cloud
docker build --no-cache -t theiacloud/theia-cloud-service:minikube-ci-e2e -f dockerfiles/service/Dockerfile .
docker build --no-cache -t theiacloud/theia-cloud-operator:minikube-ci-e2e -f dockerfiles/operator/Dockerfile .
docker build --no-cache -t theiacloud/theia-cloud-landing-page:minikube-ci-e2e -f dockerfiles/landing-page/Dockerfile .
docker build --no-cache -t theiacloud/theia-cloud-wondershaper:minikube-ci-e2e -f dockerfiles/wondershaper/Dockerfile .
docker build --no-cache -t theiacloud/theia-cloud-conversion-webhook:minikube-ci-e2e -f dockerfiles/conversion-webhook/Dockerfile .
docker build --no-cache -t theiacloud/theia-cloud-demo:latest -f demo/dockerfiles/demo-theia-docker/Dockerfile demo/dockerfiles/demo-theia-docker/.
docker tag theiacloud/theia-cloud-demo:latest theiacloud/theia-cloud-demo:minikube-ci-e2e
docker build --no-cache -t theiacloud/theia-cloud-activity-demo:minikube-ci-e2e -f demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile demo/dockerfiles/demo-theia-monitor-vscode/.
docker build --no-cache -t theiacloud/theia-cloud-activity-demo-theia:minikube-ci-e2e -f demo/dockerfiles/demo-theia-monitor-theia/Dockerfile .
- name: Get NGINX Ingress Controller Host
id: ingress_info
run: |
INGRESS_HOST=$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.spec.clusterIP}')
echo "INGRESS_HOST=$INGRESS_HOST" >> $GITHUB_ENV
- name: Run Terraform
run: |
cd theia-cloud/terraform/ci-configurations
terraform init
terraform apply \
-var="ingress_ip=${{ env.INGRESS_HOST }}" \
-var="use_paths=${{ matrix.paths }}" \
-var="use_ephemeral_storage=${{ matrix.ephemeral }}" \
-var="enable_keycloak=${{ matrix.keycloak }}" \
-auto-approve
- name: List All Services in All Namespaces
run: kubectl get services --all-namespaces

- name: List All AppDefinitions in All Namespaces
run: kubectl get appdefinitions --all-namespaces

- name: List all Pods Images
run: kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" | tr -s '[[:space:]]' '\n' | sort | uniq

- name: Wait for Deployments to be Ready
run: |
kubectl wait --namespace ingress-nginx --for=condition=available deployment/ingress-nginx-controller --timeout=300s
kubectl wait --namespace theiacloud --for=condition=available deployment/conversion-webhook --timeout=300s
kubectl wait --namespace theiacloud --for=condition=available deployment/landing-page-deployment --timeout=300s
kubectl wait --namespace theiacloud --for=condition=available deployment/operator-deployment --timeout=300s
kubectl wait --namespace theiacloud --for=condition=available deployment/service-deployment --timeout=300s
# URLs
# service: servicex
# landing: trynow
# instance: instances
- name: Access NGINX Ingress URL
run: |
curl -LkI "https://trynow.${{ env.INGRESS_HOST }}.nip.io/"
83 changes: 83 additions & 0 deletions terraform/ci-configurations/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 464ba3c

Please sign in to comment.