frontend: Add ephemeral containers section #2753
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Setup minikube as CI step in GitHub Actions" | |
# https://minikube.sigs.k8s.io/docs/tutorials/setup_minikube_in_github_actions/ | |
# https://github.com/marketplace/actions/setup-minikube | |
name: Build Container and test | |
on: | |
pull_request: | |
paths: | |
- 'backend/**' | |
- 'frontend/**' | |
- Makefile | |
- '.github/**' | |
- Dockerfile | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: build discover and deploy | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Start cluster | |
uses: medyagh/setup-minikube@master | |
# now you can run kubectl to see the pods in the cluster | |
- name: Try the cluster! | |
run: kubectl get pods -A | |
- name: Build image | |
run: | | |
export SHELL=/bin/bash | |
eval $(minikube -p minikube docker-env) | |
DOCKER_IMAGE_VERSION=latest make image | |
DOCKER_IMAGE_VERSION=latest DOCKER_PLUGINS_IMAGE_NAME=headlamp-plugins-test make build-plugins-container | |
echo -n "verifying images:" | |
docker images | |
- name: Deploy to cluster | |
run: | |
kubectl apply -f e2e-tests/kubernetes-headlamp-ci.yaml | |
- name: Test service URLs | |
run: | | |
echo "------------------sleeping 3...------------------" | |
sleep 3 | |
minikube service list | |
minikube service headlamp -n kube-system --url | |
kubectl get deployments -n kube-system | |
minikube logs | tail -10 | |
echo "------------------waiting for headlamp deployment to be available...------------------" | |
kubectl wait deployment -n kube-system headlamp --for condition=Available=True --timeout=30s | |
minikube service headlamp -n kube-system --url | |
echo "------------------opening the service------------------" | |
export SERVICE_URL=$(minikube service headlamp -n kube-system --url | tail -1) | |
echo $SERVICE_URL | |
curl -L $SERVICE_URL | grep -q "Headlamp: Kubernetes Web UI" | |
echo "------------------Getting HEADLAMP_TOKEN------------------" | |
kubectl create serviceaccount headlamp-admin --namespace kube-system | |
export HEADLAMP_TOKEN=$(kubectl create token headlamp-admin --duration 24h -n kube-system) | |
echo "------------------Running playwright e2e tests------------------" | |
cd e2e-tests | |
npm ci | |
npx playwright install --with-deps | |
HEADLAMP_TEST_URL=$SERVICE_URL npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: e2e-tests-report | |
path: e2e-tests/playwright-report/ | |
retention-days: 30 |