From 93cdbc7613e59b511cbb05cdaac83d1bf3b471a5 Mon Sep 17 00:00:00 2001 From: Zac Bergquist Date: Mon, 5 Aug 2024 12:23:35 -0600 Subject: [PATCH] integrations: build with -trimpath option --- integrations/access/common.mk | 2 +- integrations/event-handler/Makefile | 2 +- integrations/operator/Makefile | 2 +- integrations/terraform/Makefile | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/integrations/access/common.mk b/integrations/access/common.mk index 77bb7a9adc805..5fc66908c7e16 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 6c9170a52f0d9..d42c472b23c9f 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 '*event-handler*') 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 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 21901e845f308..34d5453c82510 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