diff --git a/admin/Makefile b/admin/Makefile index f6c12416e1d..0d29552f708 100644 --- a/admin/Makefile +++ b/admin/Makefile @@ -11,6 +11,10 @@ PMM_RELEASE_VERSION ?= $(shell git describe --always --dirty | cut -b2-) PMM_RELEASE_TIMESTAMP ?= $(shell date '+%s') PMM_RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD) PMM_RELEASE_BRANCH ?= $(shell git describe --always --contains --all) + +ifdef NO_VCS + NO_VCS := -buildvcs=false +endif ifeq ($(GOBIN),) GOBIN := $(shell go env GOPATH)/bin endif @@ -31,8 +35,8 @@ clean: ## Remove generated files find . -name *_reform.go -delete release: ## Build pmm-admin release binary - env CGO_ENABLED=0 go build -v $(LD_FLAGS) -o $(PMM_RELEASE_PATH)/pmm-admin ./cmd/pmm-admin/ - env CGO_ENABLED=0 go build -v $(LD_FLAGS) -o $(PMM_RELEASE_PATH)/pmm ./cmd/pmm/ + env CGO_ENABLED=0 go build -v $(NO_VCS) $(LD_FLAGS) -o $(PMM_RELEASE_PATH)/pmm-admin ./cmd/pmm-admin/ + env CGO_ENABLED=0 go build -v $(NO_VCS) $(LD_FLAGS) -o $(PMM_RELEASE_PATH)/pmm ./cmd/pmm/ install: ## Install pmm & pmm-admin binary go build -v $(LD_FLAGS) -o $(GOBIN)/pmm-admin ./cmd/pmm-admin/ diff --git a/agent/Makefile b/agent/Makefile index 2507f82fcb1..6c1e863b6ad 100644 --- a/agent/Makefile +++ b/agent/Makefile @@ -12,6 +12,10 @@ PMM_RELEASE_TIMESTAMP ?= $(shell date '+%s') PMM_RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD) PMM_RELEASE_BRANCH ?= $(shell git describe --always --contains --all) PMM_DEV_SERVER_PORT ?= 8443 + +ifdef NO_VCS + NO_VCS := -buildvcs=false +endif ifeq ($(GOBIN),) GOBIN := $(shell go env GOPATH)/bin endif @@ -25,8 +29,8 @@ VERSION_FLAGS = -X 'github.com/percona/pmm/version.ProjectName=pmm-agent' \ -X 'github.com/percona/pmm/version.Branch=$(PMM_RELEASE_BRANCH)' release: ## Build static pmm-agent release binary (Linux only) - env CGO_ENABLED=1 go build -v -ldflags "-extldflags '-static' $(VERSION_FLAGS)" -tags 'osusergo netgo static_build' -o $(PMM_RELEASE_PATH)/pmm-agent - go build -v -ldflags "-extldflags '-static' $(VERSION_FLAGS)" -tags 'osusergo netgo static_build' -o $(PMM_RELEASE_PATH)/pmm-agent-entrypoint ./cmd/pmm-agent-entrypoint + env CGO_ENABLED=1 go build -v $(NO_VCS) -ldflags "-extldflags '-static' $(VERSION_FLAGS)" -tags 'osusergo netgo static_build' -o $(PMM_RELEASE_PATH)/pmm-agent + go build -v $(NO_VCS) -ldflags "-extldflags '-static' $(VERSION_FLAGS)" -tags 'osusergo netgo static_build' -o $(PMM_RELEASE_PATH)/pmm-agent-entrypoint ./cmd/pmm-agent-entrypoint $(PMM_RELEASE_PATH)/pmm-agent --version ldd $(PMM_RELEASE_PATH)/pmm-agent 2>&1 | grep -Fq 'not a dynamic executable' diff --git a/build/local/build b/build/local/build index 4e51fcc4c4c..2c5b5492063 100755 --- a/build/local/build +++ b/build/local/build @@ -352,7 +352,7 @@ main() { run_build_script build-client-rpm fi - # Building client docker image takes 17s + # Building client docker image takes from 17s (using docker cache) to 43s (no docker cache). export DOCKER_CLIENT_TAG=percona/pmm-client:${GIT_COMMIT} if [ "$NO_CLIENT_DOCKER" -eq 0 ]; then run_build_script build-client-docker