From e5441b44e91d9fcb44baa3cc3b45340c5c8fb45e Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 10 Oct 2019 17:10:16 +0000 Subject: [PATCH 1/6] Bump Go version in build container to 1.13.1 --- build/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Dockerfile b/build/Dockerfile index 1c511535e1..4e35e0c712 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.7-buster +FROM golang:1.13.1-buster # Support Raspberry Pi 2 and newer ENV GOARM 7 From dd70668b89b0dfc215cacf2839f284b802b95ff1 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 10 Oct 2019 17:28:42 +0000 Subject: [PATCH 2/6] Update tools submodule to latest commit f041a74ffbf2 --- tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools b/tools index ca69607f79..f041a74ffb 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit ca69607f7936e186cee43bb4bcaede979de701e2 +Subproject commit f041a74ffbf273b627d6c960f17357108d0dbd1c From 56491b35f1ac9cfb472245a73638fbcdc2d92fc0 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Fri, 11 Oct 2019 20:47:29 +0000 Subject: [PATCH 3/6] Go 1.13 needs different static linking flags We don't need to pre-build the Go standard library or use -i flag either - Go sorts that all out for us now. --- Makefile | 30 ++++++++---------------------- build/Dockerfile | 13 ------------- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 67ea1d6d4e..8bcbfabc9c 100644 --- a/Makefile +++ b/Makefile @@ -176,18 +176,11 @@ PUSH_ML=push_ml_weave push_ml_weaveexec push_ml_weave-kube push_ml_weave-npc WEAVE_EXPORT=weave$(ARCH_EXT).tar.gz -NETGO_CHECK=@strings $@ | grep cgo_stub\\\.go >/dev/null || { \ - rm $@; \ - echo "\nYour go standard library was built without the 'netgo' build tag."; \ - echo "To fix that, run"; \ - echo " sudo go clean -i net"; \ - echo " sudo go install -tags netgo std"; \ - false; \ -} # The flags we are passing to go build. -extldflags -static for making a static binary, -# -linkmode external for linking external C libraries into the binary, -X main.version for telling the -# Go binary which version it is, -tags netgo for enforcing the native Go DNS resolver -BUILD_FLAGS=-i -ldflags "-linkmode external -extldflags -static -X main.version=$(WEAVE_VERSION)" -tags netgo +# -X main.version for telling the Go binary which version it is, +# -s -w drop symbol tables used by debuggers (not Go's internal symbol info) +# -tags "osusergo netgo" to use native Go UID and DNS implementations +BUILD_FLAGS=-ldflags "-extldflags -static -X main.version=$(WEAVE_VERSION) -s -w" -tags "osusergo netgo" PACKAGE_BASE=$(shell go list -e ./) @@ -216,10 +209,8 @@ ifeq ($(BUILD_IN_CONTAINER),true) # This make target compiles all binaries inside of the weaveworks/build container # It bind-mounts the source into the container and passes all important variables exes $(EXES) tests lint: $(BUILD_UPTODATE) - @mkdir -p $(shell pwd)/.pkg $(SUDO) docker run $(RM) $(RUN_FLAGS) \ -v $(shell pwd):/go/src/github.com/weaveworks/weave \ - -v $(shell pwd)/.pkg:/go/pkg \ -e GOARCH=$(ARCH) -e CGO_ENABLED=1 -e GOOS=linux -e CIRCLECI -e CIRCLE_BUILD_NUM -e CIRCLE_NODE_TOTAL -e CIRCLE_NODE_INDEX -e COVERDIR -e SLOW -e DEBUG \ $(BUILD_IMAGE) COVERAGE=$(COVERAGE) WEAVE_VERSION=$(WEAVE_VERSION) CC=$(CC) QEMUARCH=$(QEMUARCH) CGO_LDFLAGS=$(CGO_LDFLAGS) $@ touch $@ @@ -235,19 +226,15 @@ ifeq ($(COVERAGE),true) else go build $(BUILD_FLAGS) -o $@ ./$(@D) endif - $(NETGO_CHECK) $(WEAVEUTIL_EXE) $(KUBEUTILS_EXE) $(WEAVENPC_EXE) $(NETWORKTESTER_EXE): go build $(BUILD_FLAGS) -o $@ ./$(@D) - $(NETGO_CHECK) $(WEAVEWAIT_EXE): - go build $(BUILD_FLAGS) -tags "netgo iface mcast" -o $@ ./$(@D) - $(NETGO_CHECK) + go build $(BUILD_FLAGS) -tags "osusergo netgo iface mcast" -o $@ ./$(@D) $(WEAVEWAIT_NOMCAST_EXE): - go build $(BUILD_FLAGS) -tags "netgo iface" -o $@ ./$(@D) - $(NETGO_CHECK) + go build $(BUILD_FLAGS) -tags "osusergo netgo iface" -o $@ ./$(@D) # These programs need a separate rule as they fail the netgo check in # the main build stanza due to not importing net package @@ -412,15 +399,14 @@ clean-bin: -$(SUDO) DOCKER_HOST=$(DOCKER_HOST) docker rmi $(IMAGES) find prog -type f -name "Dockerfile.*" -not -name "Dockerfile.template" -print | xargs rm -f find prog -type f -name "*qemu-*" -print | xargs rm -f - rm -rf $(EXES) $(IMAGES_UPTODATE) $(WEAVEDB_UPTODATE) weave*.tar.gz .pkg + go clean ./... + rm -rf $(EXES) $(IMAGES_UPTODATE) $(WEAVEDB_UPTODATE) weave*.tar.gz .cache clean: clean-bin clean-work-dir -$(SUDO) DOCKER_HOST=$(DOCKER_HOST) docker rmi $(BUILD_IMAGE) rm -rf test/tls/*.pem test/coverage.* test/coverage $(BUILD_UPTODATE) build: - $(SUDO) go clean -i net - $(SUDO) go install -tags netgo std $(MAKE) run-smoketests: all testrunner diff --git a/build/Dockerfile b/build/Dockerfile index 4e35e0c712..57af75f934 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -57,19 +57,6 @@ RUN go get \ github.com/fatih/hclfmt \ github.com/client9/misspell/cmd/misspell -# First clean, because we're gonna rebuild the std both with -race enabled and disabled -# Running go install std twice is intentional and required, as content is written in two different directories -# (/usr/local/go/pkg/linux_amd64 vs /usr/local/go/pkg/linux_amd64_race) -# The other architectures do not have support for -race -RUN go clean -i net \ - && go install -tags netgo std \ - && go install -race -tags netgo std - -# Prebuild std for the other architectures -RUN for platform in ${GO_CROSSPLATFORMS}; do \ - GOOS=${platform%/*} GOARCH=${platform##*/} \ - go install -tags netgo std; done - # Allow full write access to the Go folders for anyone RUN chmod -R a+w /usr/local/go From 404f1bbef3465176c1e756ca961b7dbfed293159 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 10 Oct 2019 17:19:29 +0000 Subject: [PATCH 4/6] Bump image used in CI to Go 1.13.1 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e20dfe057a..9619ef09bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 defaults: &defaults docker: - - image: weaveworks/weavebuild:circle20-2e6504d3 + - image: weaveworks/weavebuild:go-1-13-1-88d87f8e working_directory: /go/src/github.com/weaveworks/weave jobs: From 5110a604f8f7cc67ee02ecd35df989a3dbf43302 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 22 Oct 2019 09:31:31 +0000 Subject: [PATCH 5/6] Bump to Go 1.13.3 --- build/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Dockerfile b/build/Dockerfile index 57af75f934..435831df50 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.1-buster +FROM golang:1.13.3-buster # Support Raspberry Pi 2 and newer ENV GOARM 7 From 80e9dee9b2c9bd36430d43ec39862d7f515ba6eb Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 22 Oct 2019 11:19:51 +0000 Subject: [PATCH 6/6] Update CI image again --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9619ef09bc..8cb510644e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 defaults: &defaults docker: - - image: weaveworks/weavebuild:go-1-13-1-88d87f8e + - image: weaveworks/weavebuild:go-1-13-1-5110a604 working_directory: /go/src/github.com/weaveworks/weave jobs: