From def510abfdc67996ec489fa2a9f89c1e051e0655 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 8 Sep 2024 12:58:26 +0000 Subject: [PATCH] chore: require go 1.22/1.23, upgrade protobuf, upgrade all deps Go upgrade: - Go 1.23 is current => use that for release builds - Go 1.22 is less than one year old, it's desirable to support it. - The [`Go Toolchains`](https://go.dev/doc/toolchain) stuff is available in both of these (would also be in Go 1.21). That is quite nice stuff, but required some changes to how we versions we use in CircleCI and the `release-docker` Makefile target. Protobuf upgrade: - Go to protobuf GH release website - Download latest locally - run `sha256sum` - replace existing pinned hashes - `make generate` Deps upgrade: - `go get -t -u all` - repository moves aren't handled well automatically, fix manually - repeat until no changes --- .circleci/config.yml | 41 +- Makefile | 7 +- build.installprotoc.bash | 8 +- build/go.mod | 222 +- build/go.sum | 2517 ++--------------- client/status/status_dump.go | 2 +- client/status/status_interactive.go | 2 +- client/status/status_legacy.go | 2 +- daemon/hooks/stepstatus_enumer.go | 1 - daemon/job/active.go | 1 - daemon/job/activesidestate_enumer.go | 1 - .../trace_unique_concurrent_task_namer.go | 2 +- ...trace_unique_concurrent_task_namer_test.go | 2 +- daemon/pruner/state_enumer.go | 1 - ...holdercreationencryptionproperty_enumer.go | 1 - endpoint/replicationguaranteekind_enumer.go | 1 - go.mod | 84 +- go.sum | 241 +- replication/driver/errorclass_enumer.go | 1 - ...initialreplicationautoresolution_enumer.go | 1 - replication/logic/pdu/pdu.pb.go | 58 +- replication/logic/pdu/pdu_grpc.pb.go | 72 +- .../base2bufpool/nofitbehavior_enumer.go | 1 - .../example/pdu/grpcauth.pb.go | 15 +- .../example/pdu/grpcauth_grpc.pb.go | 36 +- ...placeholdercreateencryptionvalue_enumer.go | 1 - zfs/propertysource_enumer.go | 1 - 27 files changed, 769 insertions(+), 2553 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e2c9911..a9d1c20 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,8 @@ version: 2.1 orbs: - # NB: 1.7.2 is not the Go version, but the Orb version + # NB: this is not the Go version, but the Orb version # https://circleci.com/developer/orbs/orb/circleci/go#usage-go-modules-cache - go: circleci/go@1.7.2 + go: circleci/go@1.11.0 commands: setup-home-local-bin: steps: @@ -99,10 +99,6 @@ parameters: type: boolean default: false - release_docker_baseimage_tag: - type: string - default: "1.21" - workflows: version: 2 @@ -110,20 +106,20 @@ workflows: when: << pipeline.parameters.do_ci >> jobs: - quickcheck-docs - - quickcheck-go: &quickcheck-go-smoketest - name: quickcheck-go-amd64-linux-1.21 - goversion: &latest-go-release "1.21" + - quickcheck-go: + name: quickcheck-go-amd64-linux-1.23.1 + goversion: &latest-go-release "1.23.1" goos: linux goarch: amd64 - - test-go-on-latest-go-release: + - test-go: goversion: *latest-go-release - quickcheck-go: requires: - - quickcheck-go-amd64-linux-1.21 #quickcheck-go-smoketest.name - matrix: &quickcheck-go-matrix + - quickcheck-go-amd64-linux-1.23.1 #quickcheck-go-smoketest.name + matrix: alias: quickcheck-go-matrix parameters: - goversion: [*latest-go-release, "1.20"] + goversion: [*latest-go-release, "1.22.7"] goos: ["linux", "freebsd"] goarch: ["amd64", "arm64"] exclude: @@ -138,6 +134,7 @@ workflows: goos: ["linux"] goarch: ["amd64"] requires: + - test-go - quickcheck-go-<< matrix.goarch >>-<< matrix.goos >>-<< matrix.goversion >> release: @@ -167,7 +164,7 @@ workflows: jobs: quickcheck-docs: docker: - - image: cimg/base:2023.09 + - image: cimg/base:2024.09 steps: - checkout - install-docdep @@ -186,10 +183,12 @@ jobs: goarch: type: string docker: - - image: cimg/go:<> + # any toolchain >= 1.22 will auto-download GOTOOLCHAIN + - image: &cimg_with_modern_go cimg/go:1.22 environment: GOOS: <> GOARCH: <> + GOTOOLCHAIN: "go<>" steps: - checkout @@ -237,12 +236,14 @@ jobs: - run: sudo zfs version - run: sudo make test-platform GOOS="$GOOS" GOARCH="$GOARCH" - test-go-on-latest-go-release: + test-go: parameters: goversion: type: string docker: - - image: cimg/go:<> + - image: *cimg_with_modern_go + environment: + GOTOOLCHAIN: "go<>" steps: - checkout - go/load-cache: @@ -256,7 +257,7 @@ jobs: image: ubuntu-2004:202201-02 steps: - checkout - - run: make release-docker RELEASE_DOCKER_BASEIMAGE_TAG=<> + - run: make release-docker - persist_to_workspace: root: . paths: [.] @@ -286,7 +287,7 @@ jobs: release-upload: docker: - - image: cimg/base:2020.08 + - image: cimg/base:2024.09 steps: - attach_workspace: at: . @@ -296,7 +297,7 @@ jobs: publish-zrepl-github-io: docker: - - image: cimg/base:2023.09 + - image: cimg/base:2024.09 steps: - checkout - install-docdep diff --git a/Makefile b/Makefile index 6e3e7bd..fcc4b8a 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ GOARCH ?= $(shell bash -c 'source <($(GO) env) && echo "$$GOARCH"') GOARM ?= $(shell bash -c 'source <($(GO) env) && echo "$$GOARM"') GOHOSTOS ?= $(shell bash -c 'source <($(GO) env) && echo "$$GOHOSTOS"') GOHOSTARCH ?= $(shell bash -c 'source <($(GO) env) && echo "$$GOHOSTARCH"') -GO_ENV_VARS := GO111MODULE=on CGO_ENABLED=0 +GO_ENV_VARS := CGO_ENABLED=0 GO_LDFLAGS := "-X github.com/zrepl/zrepl/version.zreplVersion=$(_ZREPL_VERSION)" GO_MOD_READONLY := -mod=readonly GO_EXTRA_BUILDFLAGS := @@ -30,8 +30,8 @@ GO_BUILDFLAGS := $(GO_MOD_READONLY) $(GO_EXTRA_BUILDFLAGS) GO_BUILD := $(GO_ENV_VARS) $(GO) build $(GO_BUILDFLAGS) -ldflags $(GO_LDFLAGS) GOLANGCI_LINT := golangci-lint GOCOVMERGE := gocovmerge -RELEASE_DOCKER_BASEIMAGE_TAG ?= 1.21 -RELEASE_DOCKER_BASEIMAGE ?= golang:$(RELEASE_DOCKER_BASEIMAGE_TAG) +RELEASE_DOCKER_TOOLCHAIN ?= 1.22.7 +RELEASE_DOCKER_BASEIMAGE ?= golang:$(RELEASE_DOCKER_TOOLCHAIN) ifneq ($(GOARM),) ZREPL_TARGET_TUPLE := $(GOOS)-$(GOARCH)v$(GOARM) @@ -59,6 +59,7 @@ release: clean $(MAKE) noarch release-docker: $(ARTIFACTDIR) + # upstream docker image sets GOTOOLCHAIN=local sed 's/FROM.*!SUBSTITUTED_BY_MAKEFILE/FROM $(RELEASE_DOCKER_BASEIMAGE)/' build.Dockerfile > artifacts/release-docker.Dockerfile docker build -t zrepl_release --pull -f artifacts/release-docker.Dockerfile . docker run --rm -i -v $(CURDIR):/src -u $$(id -u):$$(id -g) \ diff --git a/build.installprotoc.bash b/build.installprotoc.bash index c39c74a..6320ee7 100644 --- a/build.installprotoc.bash +++ b/build.installprotoc.bash @@ -5,7 +5,7 @@ set -x MACH=$(uname -m) MACH="${MACH/aarch64/aarch_64}" -VERSION=3.6.1 +VERSION=28.0 FILENAME=protoc-"$VERSION"-linux-"$MACH".zip if [ -e "$FILENAME" ]; then @@ -18,8 +18,8 @@ wget https://github.com/protocolbuffers/protobuf/releases/download/v"$VERSION"/" stat "$FILENAME" sha256sum -c --ignore-missing <