diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index e391216b90..f4f1c9405e 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -47,3 +47,13 @@ jobs: uses: golang/govulncheck-action@v1 with: go-version-file: tests/e2e/go.mod + gomod-match-check: + runs-on: ubuntu-latest + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + with: + show-progress: false + - name: "All go.mod go directive must use version major.minor.patch that matches GOLANG_DIRECTIVE_VERSION" + run: | + make verify-go-directive diff --git a/Makefile b/Makefile index f3b597fa59..e759caab4f 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,9 @@ OUTPUT ?= $(shell pwd)/_output INSTALL_PATH ?= $(OUTPUT)/bin LDFLAGS ?= -w -s -X k8s.io/component-base/version.gitVersion=$(VERSION) -X main.gitVersion=$(VERSION) +GOLANG_DIRECTIVE_VERSION ?= 1.24.0 +CURL_RETRIES ?= 3 + # flags for ecr-credential-provider artifact promotion UPLOAD ?= $(OUTPUT)/upload GCS_LOCATION ?= gs://k8s-staging-provider-aws/releases/ @@ -120,7 +123,7 @@ e2e.test: mv tests/e2e/e2e.test e2e.test .PHONY: check -check: verify-fmt verify-lint vet +check: verify-fmt verify-lint vet verify-go-directive .PHONY: develop develop: aws-cloud-controller-manager test update-fmt check @@ -142,6 +145,12 @@ verify-lint: verify-codegen: ./hack/verify-codegen.sh +.PHONY: verify-go-directive +verify-go-directive: + # use the core Cluster API script directly to verify the go directive matches the desired one. + # ref: https://github.com/kubernetes-sigs/cluster-api/blob/v1.10.7/hack/verify-go-directive.sh + curl --retry $(CURL_RETRIES) -fsL https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/refs/tags/v1.11.0/hack/verify-go-directive.sh | bash -s -- -g $(GOLANG_DIRECTIVE_VERSION) + .PHONY: vet vet: go vet ./...