diff --git a/Makefile b/Makefile index dd22ea0..aa47490 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,8 @@ SKAFFOLD_TEST_PACKAGES = ./pkg/skaffold/... ./cmd/... ./hack/... ./pkg/webhook/. GO_FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./pkg/diag/*") VERSION_PACKAGE = $(REPOPATH)/pkg/skaffold/version -COMMIT = $(shell git rev-parse HEAD) +COMMIT ?= $(shell git rev-parse HEAD) +TREE_STATE ?= $(if $(shell git status --porcelain),dirty,clean) ifeq "$(strip $(VERSION))" "" override VERSION = $(shell git describe --always --tags --dirty) @@ -52,7 +53,7 @@ GO_BUILD_TAGS_windows = "release" GO_LDFLAGS = -X $(VERSION_PACKAGE).version=$(VERSION) GO_LDFLAGS += -X $(VERSION_PACKAGE).buildDate=$(shell date +'%Y-%m-%dT%H:%M:%SZ') GO_LDFLAGS += -X $(VERSION_PACKAGE).gitCommit=$(COMMIT) -GO_LDFLAGS += -X $(VERSION_PACKAGE).gitTreeState=$(if $(shell git status --porcelain),dirty,clean) +GO_LDFLAGS += -X $(VERSION_PACKAGE).gitTreeState=$(TREE_STATE) GO_LDFLAGS += -s -w GO_LDFLAGS_windows =" $(GO_LDFLAGS) -extldflags \"$(LDFLAGS_windows)\""