From a7847e5e01e7a9e184d5c51bad58202a779a5715 Mon Sep 17 00:00:00 2001 From: Zac Bergquist Date: Tue, 6 Aug 2024 15:03:21 -0600 Subject: [PATCH] integrations: build with -trimpath option (#45092) --- integrations/access/common.mk | 2 +- integrations/event-handler/Makefile | 6 +++--- integrations/operator/Makefile | 2 +- integrations/terraform/Makefile | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/integrations/access/common.mk b/integrations/access/common.mk index ac3f39f158219..ee77ce7fa380a 100644 --- a/integrations/access/common.mk +++ b/integrations/access/common.mk @@ -6,7 +6,7 @@ VERSION ?= $(shell go run ../../hack/get-version/get-version.go) BUILDDIR ?= build BINARY = $(BUILDDIR)/teleport-$(ACCESS_PLUGIN) ADDFLAGS ?= -BUILDFLAGS ?= $(ADDFLAGS) -ldflags "-w -s" +BUILDFLAGS ?= $(ADDFLAGS) -trimpath -ldflags "-w -s" CGOFLAG ?= CGO_ENABLED=0 OS ?= $(shell go env GOOS) diff --git a/integrations/event-handler/Makefile b/integrations/event-handler/Makefile index 1cb18389d8002..f4fd8850d1a1e 100644 --- a/integrations/event-handler/Makefile +++ b/integrations/event-handler/Makefile @@ -17,7 +17,7 @@ BINARY = $(BUILDDIR)/teleport-event-handler GITREF ?= $(shell git describe --dirty --long --tags --match '$(VERSION)') ADDFLAGS ?= -BUILDFLAGS ?= $(ADDFLAGS) -ldflags "-w -s -X main.Gitref=$(GITREF) -X main.Version=$(VERSION)" +BUILDFLAGS ?= $(ADDFLAGS) -trimpath -ldflags "-w -s -X main.Gitref=$(GITREF) -X main.Version=$(VERSION)" CGOFLAG ?= CGO_ENABLED=0 PASS ?= 1234 @@ -58,7 +58,7 @@ release: build tar -czf $(RELEASE).tar.gz $(RELEASE_NAME) rm -rf $(RELEASE_NAME)/ @echo "---> Created $(RELEASE).tar.gz." - + .PHONY: clean clean: @@ -96,7 +96,7 @@ configure: build .PHONY: fluentd fluentd: - docker run -p 8888:8888 -v $(LOCALDIR)tmp:/keys -v $(LOCALDIR)tmp/fluent.conf:/fluentd/etc/fluent.conf fluent/fluentd:edge + docker run -p 8888:8888 -v $(LOCALDIR)tmp:/keys -v $(LOCALDIR)tmp/fluent.conf:/fluentd/etc/fluent.conf fluent/fluentd:edge .PHONY: example example: build diff --git a/integrations/operator/Makefile b/integrations/operator/Makefile index cfecfdf34410a..c27a2ac19ac85 100644 --- a/integrations/operator/Makefile +++ b/integrations/operator/Makefile @@ -127,7 +127,7 @@ crdgen-test: ## Run crdgen tests. .PHONY: build build: generate fmt vet ## Build manager binary. - go build -o bin/manager main.go namespace.go config.go + go build -trimpath -o bin/manager main.go namespace.go config.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. diff --git a/integrations/terraform/Makefile b/integrations/terraform/Makefile index d835003c1afc9..6e4a7ef7f7ac5 100644 --- a/integrations/terraform/Makefile +++ b/integrations/terraform/Makefile @@ -7,7 +7,8 @@ BUILDDIR ?= build TFDIR ?= example ADDFLAGS ?= -BUILDFLAGS ?= $(ADDFLAGS) -ldflags '-w -s' +BUILDFLAGS ?= $(ADDFLAGS) -trimpath -ldflags '-w -s' +# CGO must NOT be enabled as hashicorp cloud does not support running providers using on CGO. CGOFLAG ?= CGO_ENABLED=0 RELEASE = terraform-provider-teleport-v$(VERSION)-$(OS)-$(ARCH)-bin @@ -166,4 +167,4 @@ $(LOCALBIN): bin/tfplugindocs: go.mod $(LOCALBIN) mkdir -p bin - GOBIN=$(LOCALBIN) go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs \ No newline at end of file + GOBIN=$(LOCALBIN) go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs