diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee6b5236..67d1656f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,9 @@ jobs: build: if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id uses: ./.github/workflows/build.yml + e2e: + if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id + uses: ./.github/workflows/e2e.yml # Virtual job that can be configured as a required check before a PR can be merged. all-required-checks-done: name: All required checks done @@ -40,6 +43,7 @@ jobs: - test - codeql - build + - e2e runs-on: ubuntu-latest steps: - run: echo "All required checks done" diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..49a86339 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,23 @@ +name: End2End tests + +on: + workflow_call: + +permissions: + contents: read + +jobs: + kind: + name: Kind + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + id: setup-go + uses: ./.github/actions/setup-go-cache + with: + cache-prefix: go-integration-kind + + - name: E2E test + run: ./scripts/e2e-test.sh diff --git a/Makefile b/Makefile index 7ef57bdb..d3bee9d6 100644 --- a/Makefile +++ b/Makefile @@ -211,8 +211,12 @@ ifndef ignore-not-found ignore-not-found = false endif +.PHONY: kind-all kind-all: kind-create-cluster install-and-wait-cert-manager helm-repos helm-install install-armada-deps wait-for-armada-deps create-armada-namespace apply-armada-crs create-armadactl-config apply-default-priority-class get-armadactl ## Install everything +.PHONY: kind-all-local +kind-all-local: kind-create-cluster install-and-wait-cert-manager helm-repos helm-install-local install-armada-deps wait-for-armada-deps create-armada-namespace apply-armada-crs create-armadactl-config apply-default-priority-class get-armadactl ## Install everything from sources + .PHONY: kind-all-dev kind-all-dev: kind-create-cluster kind-deploy helm-repos install-armada-deps wait-for-armada-deps create-armada-namespace apply-armada-crs create-armadactl-config apply-default-priority-class get-armadactl ## Install everything with Operator built from scratch diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index 80e1be2e..526b96f8 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -9,26 +9,27 @@ log() { echo -e "${GREEN}$1${NC}" } -log "Running e2e tests..." - -log "Creating kind cluster..." -make kind-create-cluster +armadactl-retry() { + for i in {1..60}; do + if armadactl "$@"; then + return 0 + fi + sleep 1 + done + echo "armadactl command failed after 60 attempts" >&2 + exit 1 +} -log "Installing cert-manager..." -make install-and-wait-cert-manager +log "Running e2e tests..." -log "Building latest version of the operator and installing it via Helm..." -make helm-install-local +log "Creating test environment cluster..." +make kind-all-local -for i in {1..5}; do - kubectl get pods -n armada-system - kubectl describe deployment armada-operator-controller-manager -n armada-system - sleep 15 - kubectl logs deployment/armada-operator-controller-manager -n armada-system -done +log "Creating test queue..." +armadactl-retry create queue example -log "Waiting for Armada Operator pod to be ready..." -kubectl wait --for='condition=Ready' pods -l 'app.kubernetes.io/name=armada-operator' --timeout=600s --namespace armada-system +log "Submitting job..." +armadactl-retry submit dev/quickstart/example-job.yaml log "Deleting kind cluster..." make kind-delete-cluster