diff --git a/Makefile b/Makefile index d7630e92d4e01..f0c73e1b17a96 100644 --- a/Makefile +++ b/Makefile @@ -45,8 +45,10 @@ GO_LDFLAGS ?= -w -s $(KUBECTL_SETVERSION) # debugger-friendly builds. ifeq ("$(TELEPORT_DEBUG)","true") BUILDFLAGS ?= $(ADDFLAGS) -gcflags=all="-N -l" +BUILDFLAGS_TBOT ?= $(ADDFLAGS) -gcflags=all="-N -l" else BUILDFLAGS ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath -buildmode=pie +BUILDFLAGS_TBOT ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath endif GO_ENV_OS := $(shell go env GOOS) @@ -278,6 +280,7 @@ $(error "Building for windows requires ARCH=amd64") endif CGOFLAG = CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath -buildmode=pie +BUILDFLAGS_TBOT = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath endif ifeq ("$(OS)","darwin") @@ -348,8 +351,14 @@ $(BUILDDIR)/tsh: GOOS=$(OS) GOARCH=$(ARCH) $(CGOFLAG_TSH) go build -tags "$(FIPS_TAG) $(LIBFIDO2_BUILD_TAG) $(TOUCHID_TAG) $(PIV_BUILD_TAG) $(KUSTOMIZE_NO_DYNAMIC_PLUGIN)" -o $(BUILDDIR)/tsh $(BUILDFLAGS) ./tool/tsh .PHONY: $(BUILDDIR)/tbot +$(BUILDDIR)/tbot: CGO_ENABLED ?= 0 $(BUILDDIR)/tbot: - GOOS=$(OS) GOARCH=$(ARCH) $(CGOFLAG) go build -tags "$(FIPS_TAG) $(KUSTOMIZE_NO_DYNAMIC_PLUGIN)" -o $(BUILDDIR)/tbot $(BUILDFLAGS) ./tool/tbot +# The -buildmode=pie flag requires external cgo linking. +ifeq ("$(CGO_ENABLED)", "1") + GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=1 go build -tags "$(FIPS_TAG) $(KUSTOMIZE_NO_DYNAMIC_PLUGIN)" -o $(BUILDDIR)/tbot $(BUILDFLAGS_TBOT) -buildmode=pie ./tool/tbot +else + GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -tags "$(FIPS_TAG) $(KUSTOMIZE_NO_DYNAMIC_PLUGIN)" -o $(BUILDDIR)/tbot $(BUILDFLAGS_TBOT) ./tool/tbot +endif TELEPORT_ARGS ?= start .PHONY: teleport-hot-reload diff --git a/e b/e index 72a1adfff4840..09982e6426bf7 160000 --- a/e +++ b/e @@ -1 +1 @@ -Subproject commit 72a1adfff4840ed7acb0c55bca4372a02e71db22 +Subproject commit 09982e6426bf794f8678b4a8ae222a60fc256433 diff --git a/integrations/teleport-spacelift-runner/Dockerfile b/integrations/teleport-spacelift-runner/Dockerfile index 19655bd0d9ae4..6482e96742079 100644 --- a/integrations/teleport-spacelift-runner/Dockerfile +++ b/integrations/teleport-spacelift-runner/Dockerfile @@ -30,12 +30,9 @@ RUN make build/tbot FROM $BASE_IMAGE # https://github.com/spacelift-io/runner-terraform/blob/main/Dockerfile -# Switch to root so we can invoke gcompat +# Switch to root so we can invoke chmod USER root -# Install gcompat to allow glibc compiled tbot to run on Spacelift. -RUN apk add --no-cache gcompat=1.1.0-r1 - # Copy in `tbot` COPY --from=builder /workspace/build/tbot /usr/local/bin RUN chmod 755 /usr/local/bin/tbot