Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Build release binaries with goreleaser using Go 1.13 #2397

Merged
merged 5 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ builds:
# - windows
goarch:
- amd64
archive:
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- README.md
archives:
- format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- README.md
release:
github:
owner: m3db
Expand Down
38 changes: 14 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ GO_BUILD_LDFLAGS_CMD := $(abspath ./scripts/go-build-ldflags.sh)
GO_BUILD_LDFLAGS := $(shell $(GO_BUILD_LDFLAGS_CMD) LDFLAG)
GO_BUILD_COMMON_ENV := CGO_ENABLED=0
LINUX_AMD64_ENV := GOOS=linux GOARCH=amd64 $(GO_BUILD_COMMON_ENV)
GO_RELEASER_DOCKER_IMAGE := goreleaser/goreleaser:v0.117.2
# GO_RELEASER_DOCKER_IMAGE is latest goreleaser for go 1.13
GO_RELEASER_DOCKER_IMAGE := goreleaser/goreleaser:v0.127.0
GO_RELEASER_RELEASE_ARGS ?= --rm-dist
GO_RELEASER_WORKING_DIR := /go/src/github.com/m3db/m3
GOMETALINT_VERSION := v2.0.5

Expand Down Expand Up @@ -80,8 +82,6 @@ SUBDIRS := \
m3ninx \
aggregator \
ctl \
# Disabled during kubeval dependency issue https://github.com/m3db/m3/issues/2220
# kube \

TOOLS := \
read_ids \
Expand Down Expand Up @@ -189,6 +189,7 @@ install-tools:
GOBIN=$(tools_bin_path) go install github.com/pointlander/peg
GOBIN=$(tools_bin_path) go install github.com/prateek/gorename
GOBIN=$(tools_bin_path) go install github.com/rakyll/statik
GOBIN=$(tools_bin_path) go install github.com/garethr/kubeval

.PHONY: install-gometalinter
install-gometalinter:
Expand All @@ -206,12 +207,12 @@ check-for-goreleaser-github-token:
release: check-for-goreleaser-github-token
@echo Releasing new version
$(GO_BUILD_LDFLAGS_CMD) ECHO > $(BUILD)/release-vars.env
docker run -e "GITHUB_TOKEN=$(GITHUB_TOKEN)" --env-file $(BUILD)/release-vars.env -v $(PWD):$(GO_RELEASER_WORKING_DIR) -w $(GO_RELEASER_WORKING_DIR) $(GO_RELEASER_DOCKER_IMAGE) release --rm-dist
docker run -e "GITHUB_TOKEN=$(GITHUB_TOKEN)" --env-file $(BUILD)/release-vars.env -v $(PWD):$(GO_RELEASER_WORKING_DIR) -w $(GO_RELEASER_WORKING_DIR) $(GO_RELEASER_DOCKER_IMAGE) release $(GO_RELEASER_RELEASE_ARGS)

.PHONY: release-snapshot
release-snapshot: check-for-goreleaser-github-token
@echo Creating snapshot release
docker run -e "GITHUB_TOKEN=$(GITHUB_TOKEN)" -v $(PWD):$(GO_RELEASER_WORKING_DIR) -w $(GO_RELEASER_WORKING_DIR) $(GO_RELEASER_DOCKER_IMAGE) --snapshot --rm-dist
make release GO_RELEASER_RELEASE_ARGS="--snapshot --rm-dist"

.PHONY: docs-container
docs-container:
Expand Down Expand Up @@ -293,22 +294,6 @@ test-ci-integration:

define SUBDIR_RULES

# Temporarily remove kube validation until we fix a dependency issue with
# kubeval (one of its depenencies depends on go1.13).
# https://github.com/m3db/m3/issues/2220
#
# We override the rules for `*-gen-kube` to just generate the kube manifest
# bundle.
# ifeq ($(SUBDIR), kube)

# Builds the single kube bundle from individual manifest files.
# all-gen-kube: install-tools
# @echo "--- Generating kube bundle"
# @./kube/scripts/build_bundle.sh
# find kube -name '*.yaml' -print0 | PATH=$(combined_bin_paths):$(PATH) xargs -0 kubeval -v=1.12.0

# else

.PHONY: mock-gen-$(SUBDIR)
mock-gen-$(SUBDIR): install-tools
@echo "--- Generating mocks $(SUBDIR)"
Expand Down Expand Up @@ -406,9 +391,6 @@ metalint-$(SUBDIR): install-gometalinter install-linter-badtime install-linter-i
@(PATH=$(combined_bin_paths):$(PATH) $(metalint_check) \
$(metalint_config) $(metalint_exclude) src/$(SUBDIR))

# endif kubeval
# endif

endef

# generate targets for each SUBDIR in SUBDIRS based on the rules specified above.
Expand All @@ -425,6 +407,13 @@ endef
# of metalint and finishes faster.
$(foreach SUBDIR_TARGET, $(filter-out metalint,$(SUBDIR_TARGETS)), $(eval $(SUBDIR_TARGET_RULE)))

# Builds the single kube bundle from individual manifest files.
.PHONY: kube-gen-all
kube-gen-all: install-tools
@echo "--- Generating kube bundle"
@./kube/scripts/build_bundle.sh
find kube -name '*.yaml' -print0 | PATH=$(combined_bin_paths):$(PATH) xargs -0 kubeval -v=1.12.0

.PHONY: go-mod-tidy
go-mod-tidy:
@echo "--- :golang: tidying modules"
Expand All @@ -434,6 +423,7 @@ go-mod-tidy:
all-gen: \
install-tools \
$(foreach SUBDIR_TARGET, $(filter-out metalint all-gen,$(SUBDIR_TARGETS)), $(SUBDIR_TARGET)) \
kube-gen-all \
go-mod-tidy

.PHONY: build-ui-ctl
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ require (
github.com/fortytw2/leaktest v1.2.1-0.20180901000122-b433bbd6d743
github.com/fossas/fossa-cli v1.0.30
github.com/fsnotify/fsnotify v1.4.8-0.20190312181446-1485a34d5d57 // indirect
github.com/garethr/kubeval v0.0.0-20180821130434-c44f5193dc94
github.com/ghodss/yaml v1.0.0
github.com/gnewton/jargo v0.0.0-20150417131352-41f5f186a805 // indirect
github.com/go-kit/kit v0.10.0
Expand Down Expand Up @@ -110,6 +111,7 @@ require (
github.com/uber/tchannel-go v1.12.0
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a
github.com/willf/bitset v1.1.10
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.etcd.io/etcd v3.4.3+incompatible
go.uber.org/atomic v1.5.1
go.uber.org/config v1.4.0
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.8-0.20190312181446-1485a34d5d57 h1:r+AdyYQnMjCqabCiXfAES7u0tbaqXlLXuZ5FT+5OEQs=
github.com/fsnotify/fsnotify v1.4.8-0.20190312181446-1485a34d5d57/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/garethr/kubeval v0.0.0-20180821130434-c44f5193dc94 h1:NMtO+FvLt7roVanhHmJUsIRq9sEbEytH/PWNE+zR8vw=
github.com/garethr/kubeval v0.0.0-20180821130434-c44f5193dc94/go.mod h1:L8VwozDBY4bGI25r29I6FURZus8xlVo/B7lNOSfre2g=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down Expand Up @@ -756,6 +758,12 @@ github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
Expand Down
1 change: 1 addition & 0 deletions tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package tools

import (
_ "github.com/fossas/fossa-cli/cmd/fossa"
_ "github.com/garethr/kubeval"
_ "github.com/golang/mock/mockgen"
_ "github.com/google/go-jsonnet/cmd/jsonnet"
_ "github.com/m3db/build-tools/linters/badtime"
Expand Down