From 3b413a0ef44a38063c1b4e0345f455020fdc3587 Mon Sep 17 00:00:00 2001 From: Daneyon Hansen Date: Mon, 9 Dec 2024 14:44:40 -0800 Subject: [PATCH] Moves gw api env var to Setup test env step Signed-off-by: Daneyon Hansen --- .../workflows/.env/pr-tests/max_versions.env | 2 +- .../action.yaml | 5 +++-- .github/workflows/nightly-tests.yaml | 17 +++++++++++++- .github/workflows/regression-tests.yaml | 17 ++++++++++++++ Makefile | 22 +++++++++---------- .../issue_10359.yaml | 0 6 files changed, 48 insertions(+), 15 deletions(-) rename changelog/{v1.19.0-beta1 => v1.19.0-beta2}/issue_10359.yaml (100%) diff --git a/.github/workflows/.env/pr-tests/max_versions.env b/.github/workflows/.env/pr-tests/max_versions.env index 542bab5c3a6b..0a6f724778a3 100644 --- a/.github/workflows/.env/pr-tests/max_versions.env +++ b/.github/workflows/.env/pr-tests/max_versions.env @@ -1 +1 @@ -k8sgateway_api_version='v1.2.0' +k8sgateway_api_version='v1.2.1' diff --git a/.github/workflows/composite-actions/kube-gateway-api-conformance-tests/action.yaml b/.github/workflows/composite-actions/kube-gateway-api-conformance-tests/action.yaml index a892803886c4..f48d64bb5da2 100644 --- a/.github/workflows/composite-actions/kube-gateway-api-conformance-tests/action.yaml +++ b/.github/workflows/composite-actions/kube-gateway-api-conformance-tests/action.yaml @@ -40,6 +40,7 @@ runs: CLUSTER_NODE_VERSION: ${{ matrix.kube-version.node }} IMAGE_VARIANT: ${{ matrix.image-variant }} CONFORMANCE: "true" + CONFORMANCE_VERSION: ${{ inputs.k8sgateway-api-version }} run: ./ci/kind/setup-kind.sh - name: Install Gloo Gateway with the k8s gateway integration enabled shell: bash @@ -57,9 +58,9 @@ runs: fi - name: Run the kubernetes gateway API conformance tests shell: bash - env: - GATEWAY_API_VERSION: ${{ inputs.k8sgateway-api-version }} run: make conformance + env: + CONFORMANCE_VERSION: ${{ inputs.k8sgateway-api-version }} - name: Capture debug information when tests fail if: ${{ failure() }} shell: bash diff --git a/.github/workflows/nightly-tests.yaml b/.github/workflows/nightly-tests.yaml index a929eea07cea..4ca48612101b 100644 --- a/.github/workflows/nightly-tests.yaml +++ b/.github/workflows/nightly-tests.yaml @@ -489,7 +489,15 @@ jobs: - uses: actions/checkout@v4 with: ref: main + - name: Dotenv Action + uses: falti/dotenv-action@v1.1.4 + id: dotenv + with: + path: ${{ matrix.version-files.file }} + log-variables: true - uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests + with: + k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }} kube_gateway_api_conformance_tests_18: name: Conformance (branch=v1.18.x, type=Kubernetes Gateway API, version=${{matrix.kube-version.node}} ) @@ -507,8 +515,15 @@ jobs: - uses: actions/checkout@v4 with: ref: v1.18.x + - name: Dotenv Action + uses: falti/dotenv-action@v1.1.4 + id: dotenv + with: + path: ${{ matrix.version-files.file }} + log-variables: true - uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests - + with: + k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }} kube_gateway_api_conformance_tests_17: name: Conformance (branch=v1.17.x, type=Kubernetes Gateway API, version=${{matrix.kube-version.node}} ) diff --git a/.github/workflows/regression-tests.yaml b/.github/workflows/regression-tests.yaml index 070ec0c6a6c1..b765f82cb568 100644 --- a/.github/workflows/regression-tests.yaml +++ b/.github/workflows/regression-tests.yaml @@ -82,12 +82,29 @@ jobs: # (see https://github.com/solo-io/solo-projects/issues/6094) image-variant: - standard + version-files: + - label: 'min' + file: './.github/workflows/.env/pr-tests/min_versions.env' + - label: 'max' + file: './.github/workflows/.env/pr-tests/max_versions.env' steps: + # Checkout the branch that initiated the action - uses: actions/checkout@v4 - id: auto-succeed-tests if: needs.prepare_env.outputs.should-auto-succeed-regression-tests == 'true' run: | echo "Kubernetes Gateway API conformance tests auto-succeeded" + # The dotenv action is used to load key-value pairs from files. + # In this case, the file is specified in the matrix and will contain the versions of the tools to use + - name: Dotenv Action + uses: falti/dotenv-action@v1.1.4 + id: dotenv + with: + path: ${{ matrix.version-files.file }} + log-variables: true + # Run the k8s gateway api conformance tests - id: run-tests if: needs.prepare_env.outputs.should-auto-succeed-regression-tests != 'true' uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests + with: + k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }} diff --git a/Makefile b/Makefile index 67b61f0c901c..d08c8460e5b0 100644 --- a/Makefile +++ b/Makefile @@ -95,9 +95,9 @@ TEST_ASSET_DIR ?= $(ROOTDIR)/_test # Directory to store downloaded conformance tests for different versions CONFORMANCE_DIR ?= $(TEST_ASSET_DIR)/conformance # Gateway API version used for conformance testing -GATEWAY_API_VERSION ?= v1.2.0 +CONFORMANCE_VERSION ?= v1.2.0 # Fetch the module directory for the specified version of the Gateway API -GATEWAY_API_MODULE_DIR := $(shell go list -m -json sigs.k8s.io/gateway-api@$(GATEWAY_API_VERSION) | jq -r '.Dir') +GATEWAY_API_MODULE_DIR := $(shell go mod download -json sigs.k8s.io/gateway-api@$(CONFORMANCE_VERSION) | jq -r '.Dir') # This is the location where assets are placed after a test failure # This is used by our e2e tests to emit information about the running instance of Gloo Gateway @@ -1244,14 +1244,14 @@ build-test-chart: ## Build the Helm chart and place it in the _test directory #---------------------------------------------------------------------------------- # Download and prepare the conformance test suite for a specific Gateway API version -$(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/conformance_test.go: - mkdir -p $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION) - go mod download sigs.k8s.io/gateway-api@$(GATEWAY_API_VERSION) +$(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/conformance_test.go: + mkdir -p $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION) + go mod download sigs.k8s.io/gateway-api@$(CONFORMANCE_VERSION) cp $(GATEWAY_API_MODULE_DIR)/conformance/conformance_test.go $@ # Install the correct version of Gateway API CRDs in the Kubernetes cluster install-crds: - kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/$(GATEWAY_API_VERSION)/experimental-install.yaml + kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/$(CONFORMANCE_VERSION)/experimental-install.yaml # Update go.mod to replace Gateway API module with the version used for conformance testing update-mod: @@ -1265,18 +1265,18 @@ reset-mod: # Common arguments for conformance testing CONFORMANCE_SUPPORTED_FEATURES ?= -supported-features=Gateway,ReferenceGrant,HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRouteResponseHeaderModification,HTTPRoutePortRedirect,HTTPRouteHostRewrite,HTTPRouteSchemeRedirect,HTTPRoutePathRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,HTTPRouteRequestMirror CONFORMANCE_SUPPORTED_PROFILES ?= -conformance-profiles=GATEWAY-HTTP -CONFORMANCE_REPORT_ARGS ?= -report-output=$(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/$(VERSION)-report.yaml -organization=solo.io -project=gloo-gateway -version=$(VERSION) -url=github.com/solo-io/gloo -contact=github.com/solo-io/gloo/issues/new/choose +CONFORMANCE_REPORT_ARGS ?= -report-output=$(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/$(VERSION)-report.yaml -organization=solo.io -project=gloo-gateway -version=$(VERSION) -url=github.com/solo-io/gloo -contact=github.com/solo-io/gloo/issues/new/choose CONFORMANCE_ARGS := -gateway-class=gloo-gateway $(CONFORMANCE_SUPPORTED_FEATURES) $(CONFORMANCE_SUPPORTED_PROFILES) $(CONFORMANCE_REPORT_ARGS) # Run conformance tests for the specified Gateway API version .PHONY: conformance -conformance: $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/conformance_test.go install-crds update-mod +conformance: $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/conformance_test.go install-crds update-mod @trap "make reset-mod" EXIT; \ - go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/... -args $(CONFORMANCE_ARGS) + go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/... -args $(CONFORMANCE_ARGS) .PHONY: conformance-% ## Run the conformance test suite -conformance-%: $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/conformance_test.go - go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(GATEWAY_API_VERSION)/... -args $(CONFORMANCE_ARGS) \ +conformance-%: $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/conformance_test.go + go test -mod=mod -ldflags=$(LDFLAGS) -tags conformance -test.v $(CONFORMANCE_DIR)/$(CONFORMANCE_VERSION)/... -args $(CONFORMANCE_ARGS) \ -run-test=$* #---------------------------------------------------------------------------------- diff --git a/changelog/v1.19.0-beta1/issue_10359.yaml b/changelog/v1.19.0-beta2/issue_10359.yaml similarity index 100% rename from changelog/v1.19.0-beta1/issue_10359.yaml rename to changelog/v1.19.0-beta2/issue_10359.yaml