diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index f8bc408e..5907ed84 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -12,4 +12,4 @@ jobs: - uses: codespell-project/actions-codespell@master with: check_filenames: true - skip: ./.git,./.github/workflows/codespell.yml,.git,*.png,*.jpg,*.svg,*.sum,./vendor,go.sum,./release-tools/prow.sh + skip: ./.git,./.github/workflows/codespell.yml,.git,*.png,*.jpg,*.svg,*.sum,./vendor,go.sum,./release-tools/prow.sh,./docs diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e66a4484..d9a2bd1b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -4,7 +4,7 @@ jobs: integration_tests: strategy: matrix: - go: ['1.23'] + go: ['1.22'] platform: [windows-latest] runs-on: ${{ matrix.platform }} steps: @@ -51,7 +51,7 @@ jobs: unit_tests: strategy: matrix: - go: ['1.23'] + go: ['1.22'] platform: [windows-latest] runs-on: ${{ matrix.platform }} steps: @@ -69,7 +69,7 @@ jobs: bump_version_test: strategy: matrix: - go: ['1.23'] + go: ['1.22'] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/Makefile b/Makefile index ce9c0d38..e9d222d4 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,28 @@ BUILD_TOOLS_DIR = $(BUILD_DIR)/tools GO_ENV_VARS = GO111MODULE=on GOOS=windows CSI_PROXY_API_GEN = $(BUILD_DIR)/csi-proxy-api-gen +# overrides the $(CMDS:%=build-%) rule in release-tools/build.make because this project is not compatible with go >1.23 +# TODO: remove this override as part of https://github.com/kubernetes-csi/csi-proxy/issues/361 +build-csi-proxy: check-go-version-go + # Checks that the go version is 1.22 or lower + if (( "$$(go version | awk '{print $3}' | sed 's/go//' | cut -d'.' -f2)" > 22 )); then echo "This project requires go 1.22 or lower"; exit 1; fi; + mkdir -p bin + # os_arch_seen captures all of the $$os-$$arch-$$buildx_platform seen for the current binary + # that we want to build, if we've seen an $$os-$$arch-$$buildx_platform before it means that + # we don't need to build it again, this is done to avoid building + # the windows binary multiple times (see the default value of $$BUILD_PLATFORMS) + export os_arch_seen="" && echo '$(BUILD_PLATFORMS)' | tr ';' '\n' | while read -r os arch buildx_platform suffix base_image addon_image; do \ + os_arch_seen_pre=$${os_arch_seen%%$$os-$$arch-$$buildx_platform*}; \ + if ! [ $${#os_arch_seen_pre} = $${#os_arch_seen} ]; then \ + continue; \ + fi; \ + if ! (set -x; cd ./$(CMDS_DIR)/$* && CGO_ENABLED=0 GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '$(FULL_LDFLAGS)' -o "$(abspath ./bin)/$*$$suffix" .); then \ + echo "Building $* for GOOS=$$os GOARCH=$$arch failed, see error(s) above."; \ + exit 1; \ + fi; \ + os_arch_seen+=";$$os-$$arch-$$buildx_platform"; \ + done + .PHONY: compile-csi-proxy-api-gen compile-csi-proxy-api-gen: GO111MODULE=on go build -o $(CSI_PROXY_API_GEN) ./cmd/csi-proxy-api-gen diff --git a/go.mod b/go.mod index d0e27abf..d746b2ab 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,11 @@ module github.com/kubernetes-csi/csi-proxy -go 1.23 +// NOTE: This project must be built with go < 1.23 +// `make build` will error if go1.23 or higher is used. -godebug winsymlink=0 +go 1.22.0 + +toolchain go1.22.3 require ( github.com/Microsoft/go-winio v0.6.2 diff --git a/scripts/run-integration.sh b/scripts/run-integration.sh index 7cc048a9..4e9a01c8 100755 --- a/scripts/run-integration.sh +++ b/scripts/run-integration.sh @@ -18,6 +18,10 @@ pkgdir=${GOPATH}/src/github.com/kubernetes-csi/csi-proxy source $pkgdir/scripts/utils.sh main() { + # TODO: remove go version pin as part of https://github.com/kubernetes-csi/csi-proxy/issues/361 + wget -q https://go.dev/dl/go1.22.12.linux-amd64.tar.gz + rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz + compile_csi_proxy compile_csi_proxy_integration_tests sync_csi_proxy