chore: bump vcluster version & dependencies #79
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
name: E2E CI | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "**.go" | |
- "!**_test.go" # exclude test files to ignore unit test changes | |
- "test/**" # include test files in e2e again | |
- "!**.md" | |
- "examples/**" | |
- ".github/workflows/e2e.yaml" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
VCLUSTER_VERSION: v0.20.0 | |
VCLUSTER_SUFFIX: vcluster | |
VCLUSTER_NAME: vcluster | |
VCLUSTER_NAMESPACE: vcluster | |
jobs: | |
e2e-tests: | |
name: Execute test suites | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Set up kind k8s cluster | |
uses: engineerd/[email protected] | |
with: | |
version: "v0.20.0" | |
image: kindest/node:v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31 | |
- name: Testing kind cluster set-up | |
run: | | |
set -x | |
kubectl cluster-info | |
kubectl get pods -n kube-system | |
echo "kubectl config current-context:" $(kubectl config current-context) | |
echo "KUBECONFIG env var:" ${KUBECONFIG} | |
- name: Build plugin | |
run: | | |
# Build plugin | |
docker build . -f e2e/test_plugin/Dockerfile -t ghcr.io/loft-sh/test-plugin:v1 | |
# Import to kind cluster | |
kind load docker-image ghcr.io/loft-sh/test-plugin:v1 | |
- name: Create vcluster | |
id: create-vcluster | |
continue-on-error: true | |
run: | | |
set -x | |
# download vcluster cli | |
curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/download/${{ env.VCLUSTER_VERSION }}/vcluster-linux-amd64" && sudo install -c -m 0755 vcluster /usr/local/bin && rm -f vcluster | |
# vcluster create | |
vcluster create ${{ env.VCLUSTER_SUFFIX }} --activate=false -n ${{ env.VCLUSTER_NAMESPACE }} \ | |
--create-namespace \ | |
--debug \ | |
--connect=false \ | |
-f ./e2e/commonValues.yaml \ | |
-f ./e2e/test_plugin/plugin.yaml | |
- name: Wait until vcluster is ready | |
id: wait-until-vcluster-is-ready | |
if: steps.create-vcluster.outcome == 'success' | |
run: | | |
set -x | |
sleep 1 | |
kubectl wait --for=condition=ready pod -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} --timeout=120s | |
continue-on-error: true | |
- name: Collect deployment information in case vcluster fails to start | |
if: steps.wait-until-vcluster-is-ready.outcome != 'success' | |
run: | | |
set -x | |
kubectl get pods -o yaml -n ${{ env.VCLUSTER_NAMESPACE }} | |
echo "======================================================================================================================" | |
kubectl get events -n ${{ env.VCLUSTER_NAMESPACE }} --sort-by='.lastTimestamp' | |
echo "======================================================================================================================" | |
kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c vcluster --tail=10000 | |
echo "======================================================================================================================" | |
kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=10000 | |
echo "======================================================================================================================" | |
kubectl describe pods -n ${{ env.VCLUSTER_NAMESPACE }} | |
exit 1 | |
# Skips NetworkPolicy tests because they require network plugin with support (e.g. Calico) | |
- name: Execute e2e tests | |
id: execute-e2e-tests | |
working-directory: e2e | |
continue-on-error: true | |
run: | | |
set -x | |
VCLUSTER_SUFFIX=${{ env.VCLUSTER_SUFFIX }} VCLUSTER_NAME=${{ env.VCLUSTER_NAME }} VCLUSTER_NAMESPACE=${{ env.VCLUSTER_NAMESPACE }} go test -v -ginkgo.v -ginkgo.fail-fast | |
- name: Print logs if e2e tests fail | |
if: steps.execute-e2e-tests.outcome == 'failure' | |
run: | | |
set -x | |
kubectl get pods -o yaml -n ${{ env.VCLUSTER_NAMESPACE }} | |
echo "======================================================================================================================" | |
kubectl get events -n ${{ env.VCLUSTER_NAMESPACE }} --sort-by='.lastTimestamp' | |
echo "======================================================================================================================" | |
kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=10000 | |
echo "======================================================================================================================" | |
kubectl describe pods -n ${{ env.VCLUSTER_NAMESPACE }} | |
echo "======================================================================================================================" | |
kubectl get pods -A | |
echo "======================================================================================================================" | |
kubectl get svc -A | |
echo "======================================================================================================================" | |
kubectl get ns | |
exit 1 |