From 13eba60cf445ceed966f01ace5e62a7d7d3973ab Mon Sep 17 00:00:00 2001 From: Marco Braga Date: Fri, 24 Oct 2025 10:09:19 -0300 Subject: [PATCH 1/2] ci/gha: introduce step to check go.mod version Introduce the step to validate if the go.mod is in conformance with Kubernetes project standard by using the patch version from the build env (ending with .0, x.y.0). --- .github/workflows/deps.yml | 10 ++++++++++ Makefile | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index e391216b90..7323336ad3 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-dotzero-check: + runs-on: ubuntu-latest + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + with: + show-progress: false + - name: "Go directive must use Go version major.minor.0" + 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 ./... From dedf7c49a0d2aae14e717773f7e6f13044de214c Mon Sep 17 00:00:00 2001 From: Marco Braga Date: Tue, 28 Oct 2025 11:54:55 -0300 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Damiano Donati --- .github/workflows/deps.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index 7323336ad3..f4f1c9405e 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -47,13 +47,13 @@ jobs: uses: golang/govulncheck-action@v1 with: go-version-file: tests/e2e/go.mod - gomod-dotzero-check: + gomod-match-check: runs-on: ubuntu-latest steps: - name: "Checkout Repository" uses: actions/checkout@v4 with: show-progress: false - - name: "Go directive must use Go version major.minor.0" + - name: "All go.mod go directive must use version major.minor.patch that matches GOLANG_DIRECTIVE_VERSION" run: | make verify-go-directive