Skip to content

Commit

Permalink
[teleport-update] Add teleport-update to build and archive (#48839)
Browse files Browse the repository at this point in the history
* Add teleport-update to build and archive

* Add teleport-update to install scripts

* Add build flags without buildmode pie

* Add helper message for install.sh script

* Exclude teleport-update from darwin platform

* Add teleport-update to rpm and deb packages

* Remove teleport-update from deb, rpm packages
Add comment for the buildflags
  • Loading branch information
vapopov authored Nov 13, 2024
1 parent 268d9ca commit 9f3ef20
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ GO_LDFLAGS ?= -w -s $(KUBECTL_SETVERSION)
ifeq ("$(TELEPORT_DEBUG)","true")
BUILDFLAGS ?= $(ADDFLAGS) -gcflags=all="-N -l"
BUILDFLAGS_TBOT ?= $(ADDFLAGS) -gcflags=all="-N -l"
BUILDFLAGS_TELEPORT_UPDATE ?= $(ADDFLAGS) -gcflags=all="-N -l"
else
BUILDFLAGS ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath -buildmode=pie
BUILDFLAGS_TBOT ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath
# teleport-update builds with disabled cgo, buildmode=pie is not required.
BUILDFLAGS_TELEPORT_UPDATE ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath
endif

GO_ENV_OS := $(shell go env GOOS)
Expand Down Expand Up @@ -240,7 +243,8 @@ endif

# On Windows only build tsh. On all other platforms build teleport, tctl,
# and tsh.
BINS_default = teleport tctl tsh tbot fdpass-teleport
BINS_default = teleport tctl tsh tbot fdpass-teleport teleport-update
BINS_darwin = teleport tctl tsh tbot fdpass-teleport
BINS_windows = tsh tctl
BINS = $(or $(BINS_$(OS)),$(BINS_default))
BINARIES = $(addprefix $(BUILDDIR)/,$(BINS))
Expand Down Expand Up @@ -312,6 +316,8 @@ 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
# teleport-update builds with disabled cgo, buildmode=pie is not required.
BUILDFLAGS_TELEPORT_UPDATE = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath
endif

ifeq ("$(OS)","darwin")
Expand Down Expand Up @@ -397,7 +403,7 @@ $(BUILDDIR)/tbot:

.PHONY: $(BUILDDIR)/teleport-update
$(BUILDDIR)/teleport-update:
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -o $(BUILDDIR)/teleport-update $(BUILDFLAGS) ./tool/teleport-update
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -o $(BUILDDIR)/teleport-update $(BUILDFLAGS_TELEPORT_UPDATE) ./tool/teleport-update

TELEPORT_ARGS ?= start
.PHONY: teleport-hot-reload
Expand Down
5 changes: 4 additions & 1 deletion assets/install-scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ install_via_zypper() {
}


# download .tar.gz file via curl/wget, unzip it and run the install sript
# download .tar.gz file via curl/wget, unzip it and run the install script
install_via_curl() {
TEMP_DIR=$(mktemp -d -t teleport-XXXXXXXXXX)

Expand Down Expand Up @@ -387,6 +387,9 @@ install_teleport() {
if type fdpass-teleport &>/dev/null; then
echo " fdpass-teleport - Teleport Machine ID client."
fi
if type teleport-update &>/dev/null; then
echo " teleport-update - Teleport auto-update agent."
fi
}

# The suffix is "-ent" if we are installing a commercial edition of Teleport and
Expand Down
2 changes: 1 addition & 1 deletion build.assets/install
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ VARDIR=/var/lib/teleport
echo "Starting Teleport installation..."
cd $(dirname $0)
mkdir -p $VARDIR $BINDIR
cp -f teleport tctl tsh tbot $BINDIR/ || exit 1
cp -f teleport tctl tsh tbot teleport-update $BINDIR/ || exit 1

#
# What operating system is the user running?
Expand Down
2 changes: 1 addition & 1 deletion lib/web/scripts/node-join/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SYSTEMD_UNIT_PATH="/lib/systemd/system/teleport.service"
TARGET_PORT_DEFAULT=443
TELEPORT_ARCHIVE_PATH='{{.packageName}}'
TELEPORT_BINARY_DIR="/usr/local/bin"
TELEPORT_BINARY_LIST="teleport tctl tsh"
TELEPORT_BINARY_LIST="teleport tctl tsh teleport-update"
TELEPORT_CONFIG_PATH="/etc/teleport.yaml"
TELEPORT_DATA_DIR="/var/lib/teleport"
TELEPORT_DOCS_URL="https://goteleport.com/docs/"
Expand Down

0 comments on commit 9f3ef20

Please sign in to comment.