From f3e0257545f081a1e0202e2a7c581f95faf33cf4 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 27 Jan 2025 12:33:33 -0500 Subject: [PATCH 1/4] Use reusable e2e test action --- .github/workflows/e2e.yaml | 82 ++------------------------------------ 1 file changed, 3 insertions(+), 79 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 82584963..ff8fc172 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -1,11 +1,6 @@ name: End-to-end tests on: workflow_dispatch: - inputs: - rev: - required: true - default: "" - type: string pull_request: branches: - main @@ -14,78 +9,7 @@ jobs: e2e-tests: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: jumpstarter-dev/jumpstarter-e2e with: - fetch-depth: 0 - - - name: Install uv - uses: astral-sh/setup-uv@v2 - - - name: Install python - run: uv python install 3.12 - - - name: Install jumpstarter - run: | - if [ -z "${{ inputs.rev }}" ]; then - REV="main" - else - REV="${{ inputs.rev }}" - fi - uv tool install "git+https://github.com/jumpstarter-dev/jumpstarter.git@$REV" - - - name: Run make deploy - run: make deploy - - - name: Create client - run: | - mkdir -p ~/.config/jumpstarter/clients - go run ./cmd/jmpctl/main.go client create test-client-1 > ~/.config/jumpstarter/clients/test-client-1.yaml - cat <> ~/.config/jumpstarter/clients/test-client-1.yaml - drivers: - allow: [] - unsafe: True - EOF - - - name: Create exporter - run: | - sudo mkdir -p /etc/jumpstarter/exporters - sudo chown $USER /etc/jumpstarter/exporters - - go run ./cmd/jmpctl/main.go exporter create test-exporter-1 > /etc/jumpstarter/exporters/test-exporter-1.yaml - cat <> /etc/jumpstarter/exporters/test-exporter-1.yaml - export: - power: - type: jumpstarter.drivers.power.driver.MockPower - EOF - kubectl -n default patch exporters.jumpstarter.dev test-exporter-1 \ - --type=merge --patch '{"metadata":{"labels":{"example.com/board":"rpi4"}}}' - - go run ./cmd/jmpctl/main.go exporter create test-exporter-2 > /etc/jumpstarter/exporters/test-exporter-2.yaml - cat <> /etc/jumpstarter/exporters/test-exporter-2.yaml - export: - storage: - type: jumpstarter.drivers.storage.driver.MockStorageMux - EOF - kubectl -n default patch exporters.jumpstarter.dev test-exporter-2 \ - --type=merge --patch '{"metadata":{"labels":{"example.com/board":"rpi5"}}}' - - - name: Run jumpstarter - run: | - export JUMPSTARTER_GRPC_INSECURE=1 - - jmp list - jmp-exporter list - - jmp-exporter run test-exporter-1 & - jmp-exporter run test-exporter-2 & - - sleep 5 - - jmp shell test-client-1 --label example.com/board rpi4 < Date: Mon, 27 Jan 2025 12:43:32 -0500 Subject: [PATCH 2/4] Install grpcurl in makefile --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index a2e17cf1..e5f131d4 100644 --- a/Makefile +++ b/Makefile @@ -152,6 +152,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION) GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION) KIND = $(LOCALBIN)/kind-$(KIND_VERSION) KO = $(LOCALBIN)/ko-$(KO_VERSION) +GRPCURL = $(LOCALBIN)/grpcurl-$(GRPCURL_VERSION) ## Tool Versions KUSTOMIZE_VERSION ?= v5.4.1 @@ -160,6 +161,7 @@ ENVTEST_VERSION ?= release-0.18 GOLANGCI_LINT_VERSION ?= v1.61.0 KIND_VERSION ?= v0.23.0 KO_VERSION ?= v0.17.0 +GRPCURL_VERSION ?= v1.9.2 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. @@ -186,6 +188,11 @@ ko: $(KO) ## Download ko locally if necessary. $(KO): $(LOCALBIN) $(call go-install-tool,$(KO),github.com/google/ko,$(KO_VERSION)) +.PHONY: grpcurl +grpcurl: $(GRPCURL) ## Download grpcurl locally if necessary. +$(GRPCURL): $(LOCALBIN) + $(call go-install-tool,$(GRPCURL),github.com/fullstorydev/grpcurl/cmd/grpcurl,$(GRPCURL_VERSION)) + .PHONY: helm-lint helm-lint: helm lint ./deploy/helm/jumpstarter/ From 6dfab74209211ce1cd35dd8858a750cc3aa47d28 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 27 Jan 2025 12:45:02 -0500 Subject: [PATCH 3/4] Use locally installed version of grpcurl --- Makefile | 2 +- hack/deploy_with_helm.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e5f131d4..d316a6c4 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified $(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - .PHONY: deploy -deploy: ko-build cluster +deploy: ko-build cluster grpcurl ./hack/deploy_with_helm.sh .PHONY: deploy-exporters diff --git a/hack/deploy_with_helm.sh b/hack/deploy_with_helm.sh index 49ea65f3..a90c693d 100755 --- a/hack/deploy_with_helm.sh +++ b/hack/deploy_with_helm.sh @@ -3,6 +3,7 @@ set -eo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" KIND=${KIND:-bin/kind-v0.23.0} +GRPCURL=${GRPCURL:-bin/grpcurl-v1.9.2} IMG=${IMG:-quay.io/jumpstarter-dev/jumpstarter-controller:latest} INGRESS_ENABLED=${INGRESS_ENABLED:-false} @@ -108,7 +109,7 @@ echo -e "${GREEN}Waiting for grpc endpoints to be ready:${NC}" for ep in ${GRPC_ENDPOINT} ${GRPC_ROUTER_ENDPOINT}; do RETRIES=30 echo -e "${GREEN} * Checking ${ep} ... ${NC}" - while ! podman run docker.io/fullstorydev/grpcurl -insecure ${ep} list; do + while ! ${GRPCURL} -insecure ${ep} list; do sleep 2 RETRIES=$((RETRIES-1)) if [ ${RETRIES} -eq 0 ]; then From a07fb546425f4353c92b5bd985906b1f05e063f5 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 27 Jan 2025 12:48:47 -0500 Subject: [PATCH 4/4] fixup! Use reusable e2e test action --- .github/workflows/e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index ff8fc172..e57de758 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -9,7 +9,7 @@ jobs: e2e-tests: runs-on: ubuntu-latest steps: - - uses: jumpstarter-dev/jumpstarter-e2e + - uses: jumpstarter-dev/jumpstarter-e2e@main with: controller-ref: ${{ github.ref }} jumpstarter-ref: main