Skip to content

Commit

Permalink
Merge branch 'merge-upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
dsh2dsh committed Oct 18, 2024
2 parents b4534b0 + f7c1e37 commit c91e1c4
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 62 deletions.
52 changes: 26 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -99,31 +99,27 @@ parameters:
type: boolean
default: false

release_docker_baseimage_tag:
type: string
default: "1.21"

workflows:
version: 2

ci:
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:
Expand All @@ -138,6 +134,7 @@ workflows:
goos: ["linux"]
goarch: ["amd64"]
requires:
- test-go
- quickcheck-go-<< matrix.goarch >>-<< matrix.goos >>-<< matrix.goversion >>

release:
Expand Down Expand Up @@ -167,7 +164,7 @@ workflows:
jobs:
quickcheck-docs:
docker:
- image: cimg/base:2023.09
- image: cimg/base:2024.09
steps:
- checkout
- install-docdep
Expand All @@ -186,10 +183,12 @@ jobs:
goarch:
type: string
docker:
- image: cimg/go:<<parameters.goversion>>
# any toolchain >= 1.22 will auto-download GOTOOLCHAIN
- image: &cimg_with_modern_go cimg/go:1.22
environment:
GOOS: <<parameters.goos>>
GOARCH: <<parameters.goarch>>
GOTOOLCHAIN: "go<<parameters.goversion>>"

steps:
- checkout
Expand All @@ -203,12 +202,10 @@ jobs:
key: quickcheck-<<parameters.goversion>>

- run: make formatcheck
- run: make generate-platform-test-list
- run: make zrepl-bin test-platform-bin
- run: make vet
- run: make lint

- run: rm -f artifacts/generate-platform-test-list
- store_artifacts:
path: artifacts
- persist_to_workspace:
Expand Down Expand Up @@ -237,12 +234,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:<<parameters.goversion>>
- image: *cimg_with_modern_go
environment:
GOTOOLCHAIN: "go<<parameters.goversion>>"
steps:
- checkout
- go/load-cache:
Expand All @@ -253,16 +252,17 @@ jobs:

release-build:
machine:
image: ubuntu-2004:202201-02
image: &release-vm-image "ubuntu-2404:current"
resource_class: large
steps:
- checkout
- run: make release-docker RELEASE_DOCKER_BASEIMAGE_TAG=<<pipeline.parameters.release_docker_baseimage_tag>>
- run: make release-docker
- persist_to_workspace:
root: .
paths: [.]
release-deb:
machine:
image: ubuntu-2004:202201-02
image: *release-vm-image
steps:
- attach_workspace:
at: .
Expand All @@ -274,7 +274,7 @@ jobs:

release-rpm:
machine:
image: ubuntu-2004:202201-02
image: *release-vm-image
steps:
- attach_workspace:
at: .
Expand All @@ -286,17 +286,17 @@ jobs:

release-upload:
docker:
- image: cimg/base:2020.08
- image: cimg/base:2024.09
steps:
- attach_workspace:
at: .
- run: make wrapup-and-checksum
- store_artifacts:
path: artifacts
path: artifacts/release

publish-zrepl-github-io:
docker:
- image: cimg/base:2023.09
- image: cimg/base:2024.09
steps:
- checkout
- install-docdep
Expand Down
10 changes: 0 additions & 10 deletions .circleci/trigger_debian_binary_packaging_workflow.bash

This file was deleted.

56 changes: 34 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,65 @@ 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 :=
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_GOVERSION ?= go1.23.1
STRIPPED_GOVERSION := $(subst go,,$(RELEASE_GOVERSION))
RELEASE_DOCKER_BASEIMAGE ?= golang:$(STRIPPED_GOVERSION)
RELEASE_DOCKER_CACHEMOUNT :=

ifneq ($(GOARM),)
ZREPL_TARGET_TUPLE := $(GOOS)-$(GOARCH)v$(GOARM)
else
ZREPL_TARGET_TUPLE := $(GOOS)-$(GOARCH)
endif

.PHONY: printvars
printvars:
@echo GOOS=$(GOOS)
@echo GOARCH=$(GOARCH)
@echo GOARM=$(GOARM)

ifneq ($(RELEASE_DOCKER_CACHEMOUNT),)
_RELEASE_DOCKER_CACHEMOUNT := -v $(RELEASE_DOCKER_CACHEMOUNT)/mod:/go/pkg/mod -v $(RELEASE_DOCKER_CACHEMOUNT)/xdg-cache:/root/.cache/go-build
.PHONY: release-docker-mkcachemount
release-docker-mkcachemount:
mkdir -p $(RELEASE_DOCKER_CACHEMOUNT)
mkdir -p $(RELEASE_DOCKER_CACHEMOUNT)/mod
mkdir -p $(RELEASE_DOCKER_CACHEMOUNT)/xdg-cache
else
_RELEASE_DOCKER_CACHEMOUNT :=
.PHONY: release-docker-mkcachemount
release-docker-mkcachemount:
# nothing to do
endif

##################### PRODUCING A RELEASE #############
.PHONY: release wrapup-and-checksum check-git-clean sign clean
.PHONY: release wrapup-and-checksum check-git-clean sign clean ensure-release-toolchain

ensure-release-toolchain:
# ensure the toolchain is actually the one we expect
test $(RELEASE_GOVERSION) = "$$($(GO_ENV_VARS) $(GO) env GOVERSION)"

release: clean
# no cross-platform support for target test
$(MAKE) test-go
release: ensure-release-toolchain
$(MAKE) _run_make_foreach_target_tuple RUN_MAKE_FOREACH_TARGET_TUPLE_ARG="vet"
$(MAKE) _run_make_foreach_target_tuple RUN_MAKE_FOREACH_TARGET_TUPLE_ARG="lint"
$(MAKE) _run_make_foreach_target_tuple RUN_MAKE_FOREACH_TARGET_TUPLE_ARG="zrepl-bin"
$(MAKE) _run_make_foreach_target_tuple RUN_MAKE_FOREACH_TARGET_TUPLE_ARG="test-platform-bin"
$(MAKE) noarch

release-docker: $(ARTIFACTDIR)
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) \
release-docker: $(ARTIFACTDIR) release-docker-mkcachemount
sed 's/FROM.*!SUBSTITUTED_BY_MAKEFILE/FROM $(RELEASE_DOCKER_BASEIMAGE)/' build.Dockerfile > $(ARTIFACTDIR)/build.Dockerfile
docker build -t zrepl_release --pull -f $(ARTIFACTDIR)/build.Dockerfile .
docker run --rm -i \
$(_RELEASE_DOCKER_CACHEMOUNT) \
-v $(CURDIR):/src -u $$(id -u):$$(id -g) \
zrepl_release \
make release \
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) \
ZREPL_VERSION=$(ZREPL_VERSION) ZREPL_PACKAGE_RELEASE=$(ZREPL_PACKAGE_RELEASE)
ZREPL_VERSION=$(ZREPL_VERSION) ZREPL_PACKAGE_RELEASE=$(ZREPL_PACKAGE_RELEASE) \
RELEASE_GOVERSION=$(RELEASE_GOVERSION)

debs-docker:
$(MAKE) _debs_or_rpms_docker _DEB_OR_RPM=deb
Expand Down Expand Up @@ -227,7 +242,7 @@ _run_make_foreach_target_tuple:
$(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=illumos GOARCH=amd64

##################### REGULAR TARGETS #####################
.PHONY: lint test-go test-platform cover-merge cover-html vet zrepl-bin test-platform-bin generate-platform-test-list
.PHONY: lint test-go test-platform cover-merge cover-html vet zrepl-bin test-platform-bin

lint:
$(GO_ENV_VARS) $(GOLANGCI_LINT) run ./...
Expand All @@ -251,9 +266,6 @@ endif
zrepl-bin:
$(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl-$(ZREPL_TARGET_TUPLE)"

generate-platform-test-list:
$(GO_BUILD) -o $(ARTIFACTDIR)/generate-platform-test-list ./platformtest/tests/gen

COVER_PLATFORM_BIN_PATH := $(ARTIFACTDIR)/platformtest-cover-$(ZREPL_TARGET_TUPLE)
cover-platform-bin:
$(GO_ENV_VARS) $(GO) test $(GO_BUILDFLAGS) \
Expand Down Expand Up @@ -311,7 +323,7 @@ cover-full:
# not part of the build, must do that manually
.PHONY: generate formatcheck format

generate: generate-platform-test-list
generate:
protoc -I=replication/logic/pdu --go_out=replication/logic/pdu --go-grpc_out=replication/logic/pdu replication/logic/pdu/pdu.proto
protoc -I=rpc/grpcclientidentity/example --go_out=rpc/grpcclientidentity/example/pdu --go-grpc_out=rpc/grpcclientidentity/example/pdu rpc/grpcclientidentity/example/grpcauth.proto
$(GO_ENV_VARS) $(GO) generate $(GO_BUILDFLAGS) -x ./...
Expand Down
8 changes: 4 additions & 4 deletions build.installprotoc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,8 +18,8 @@ wget https://github.com/protocolbuffers/protobuf/releases/download/v"$VERSION"/"
stat "$FILENAME"

sha256sum -c --ignore-missing <<EOF
6003de742ea3fcf703cfec1cd4a3380fd143081a2eb0e559065563496af27807 protoc-3.6.1-linux-x86_64.zip
af8e5aaaf39ddec62ec8dd2be1b8d9602c6da66564883a16393ade5f71170922 protoc-3.6.1-linux-aarch_64.zip
d622619dcbfb5ecb281cfb92c1a74d6a0f42e752d9a2774b197f475f7ab1c8c4 protoc-28.0-linux-aarch_64.zip
b2e187c8b9f2d97cd3ecae4926d1bb2cbebe3ab768e7c987cbc86bb17f319358 protoc-28.0-linux-x86_64.zip
EOF

unzip -d /usr "$FILENAME"
unzip -d /usr/local "$FILENAME"
10 changes: 10 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ Those changes will likely come with some breakage in the config.
However, I want to avoid breaking **use cases** that are satisfied by the current design.
There will be beta/RC releases to give users a chance to evaluate.

0.7.0 (unreleased)
------------------

INCOMPLETE LIST OF CHANGES

* |maint| Update to Go 1.23, require Go 1.22. Adopt `go.mod` toolchain aka `GOTOOLCHAIN` env var.
* |maint| Fix deprecations exposed by the toolchain update.
* |maint| Long-overdue update of all our dependencies & address deprecations.
* |maint| The `make release-docker` in CircleCI produces executables that are bit-identical to my personal machine.

0.6.1
-----

Expand Down

0 comments on commit c91e1c4

Please sign in to comment.