2017-09-17 22:20:16 +00:00
# Make targets:
#
# all : builds all binaries in development mode, without web assets (default)
# full : builds all binaries for PRODUCTION use
# release: prepares a release tarball
2022-11-28 18:40:24 +00:00
# clean : removes all build artifacts
2017-09-17 22:20:16 +00:00
# test : runs tests
# To update the Teleport version, update VERSION variable:
2016-06-15 17:50:45 +00:00
# Naming convention:
2020-10-13 17:30:07 +00:00
# Stable releases: "1.0.0"
# Pre-releases: "1.0.0-alpha.1", "1.0.0-beta.2", "1.0.0-rc.3"
# Master/dev branch: "1.0.0-dev"
2023-01-19 00:01:11 +00:00
VERSION = 13.0.0-dev
2016-06-14 23:52:32 +00:00
2022-10-31 18:00:55 +00:00
DOCKER_IMAGE ?= teleport
2019-10-08 14:09:56 +00:00
2021-10-13 22:01:30 +00:00
GOPATH ?= $( shell go env GOPATH)
2016-04-18 03:55:46 +00:00
# These are standard autotools variables, don't change them please
2021-06-03 00:26:59 +00:00
i f n e q ( "$(wildcard /bin/bash)" , "" )
2021-08-23 17:53:51 +00:00
SHELL := /bin/bash -o pipefail
2021-06-03 00:26:59 +00:00
e n d i f
2016-03-23 01:22:48 +00:00
BUILDDIR ?= build
2016-03-24 19:32:59 +00:00
BINDIR ?= /usr/local/bin
DATADIR ?= /usr/local/share/teleport
2016-03-22 19:15:17 +00:00
ADDFLAGS ?=
2017-01-13 06:56:53 +00:00
PWD ?= ` pwd `
2022-07-27 11:14:55 +00:00
TELEPORT_DEBUG ?= false
2017-01-19 00:53:19 +00:00
GITTAG = v$( VERSION)
2018-10-30 23:52:18 +00:00
CGOFLAG ?= CGO_ENABLED = 1
2021-02-11 15:14:27 +00:00
2022-11-16 18:33:50 +00:00
# When TELEPORT_DEBUG is true, set flags to produce
# debugger-friendly builds.
i f e q ( "$(TELEPORT_DEBUG)" , "true" )
BUILDFLAGS ?= $( ADDFLAGS) -gcflags= all = "-N -l"
e l s e
BUILDFLAGS ?= $( ADDFLAGS) -ldflags '-w -s' -trimpath
e n d i f
2021-04-01 17:12:53 +00:00
OS ?= $( shell go env GOOS)
ARCH ?= $( shell go env GOARCH)
2019-03-12 22:30:44 +00:00
FIPS ?=
2021-02-11 15:14:27 +00:00
RELEASE = teleport-$( GITTAG) -$( OS) -$( ARCH) -bin
2018-07-31 20:41:33 +00:00
2019-03-12 22:30:44 +00:00
# FIPS support must be requested at build time.
2022-09-22 23:16:51 +00:00
FIPS_MESSAGE := without-FIPS-support
2019-03-12 22:30:44 +00:00
i f n e q ( "$(FIPS)" , "" )
FIPS_TAG := fips
2022-09-22 23:16:51 +00:00
FIPS_MESSAGE := "with-FIPS-support"
2021-02-11 15:14:27 +00:00
RELEASE = teleport-$( GITTAG) -$( OS) -$( ARCH) -fips-bin
2019-03-12 22:30:44 +00:00
e n d i f
2018-09-27 01:21:45 +00:00
# PAM support will only be built into Teleport if headers exist at build time.
2022-09-22 23:16:51 +00:00
PAM_MESSAGE := without-PAM-support
2018-09-27 01:21:45 +00:00
i f n e q ( "$(wildcard /usr/include/security/pam_appl.h)" , "" )
2019-03-12 22:30:44 +00:00
PAM_TAG := pam
2022-09-22 23:16:51 +00:00
PAM_MESSAGE := "with-PAM-support"
2020-07-24 20:46:20 +00:00
e l s e
# PAM headers for Darwin live under /usr/local/include/security instead, as SIP
# prevents us from modifying/creating /usr/include/security on newer versions of MacOS
i f n e q ( "$(wildcard /usr/local/include/security/pam_appl.h)" , "" )
PAM_TAG := pam
2022-09-22 23:16:51 +00:00
PAM_MESSAGE := "with-PAM-support"
2020-07-24 20:46:20 +00:00
e n d i f
2018-09-27 01:21:45 +00:00
e n d i f
2019-11-16 00:39:40 +00:00
# BPF support will only be built into Teleport if headers exist at build time.
2022-09-22 23:16:51 +00:00
BPF_MESSAGE := without-BPF-support
2021-02-11 15:14:27 +00:00
2021-06-01 16:42:46 +00:00
# We don't compile BPF for anything except regular non-FIPS linux/amd64 for now, as other builds
# have compilation issues that require fixing.
2021-04-09 23:20:56 +00:00
with_bpf := no
2021-06-01 16:42:46 +00:00
i f e q ( "$(OS)" , "linux" )
i f e q ( "$(ARCH)" , "amd64" )
2021-04-09 23:20:56 +00:00
i f n e q ( "$(wildcard /usr/include/bpf/libbpf.h)" , "" )
with_bpf := yes
2019-11-16 00:39:40 +00:00
BPF_TAG := bpf
2022-09-22 23:16:51 +00:00
BPF_MESSAGE := "with-BPF-support"
2021-04-09 23:20:56 +00:00
CLANG ?= $( shell which clang || which clang-10)
CLANG_FORMAT ?= $( shell which clang-format || which clang-format-10)
LLVM_STRIP ?= $( shell which llvm-strip || which llvm-strip-10)
KERNEL_ARCH := $( shell uname -m | sed 's/x86_64/x86/' )
INCLUDES :=
2021-07-14 20:27:53 +00:00
ER_BPF_BUILDDIR := lib/bpf/bytecode
RS_BPF_BUILDDIR := lib/restrictedsession/bytecode
2021-04-09 23:20:56 +00:00
# Get Clang's default includes on this system. We'll explicitly add these dirs
# to the includes list when compiling with `-target bpf` because otherwise some
# architecture-specific dirs will be "missing" on some architectures/distros -
# headers such as asm/types.h, asm/byteorder.h, asm/socket.h, asm/sockios.h,
# sys/cdefs.h etc. might be missing.
#
# Use '-idirafter': Don't interfere with include mechanics except where the
# build would have failed anyways.
CLANG_BPF_SYS_INCLUDES = $( shell $( CLANG) -v -E - </dev/null 2>& 1 \
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }' )
2022-09-22 23:16:51 +00:00
STATIC_LIBS += -lbpf -lelf -lz
2019-11-16 00:39:40 +00:00
e n d i f
2021-02-11 15:14:27 +00:00
e n d i f
2021-06-01 16:42:46 +00:00
e n d i f
2019-11-16 00:39:40 +00:00
2021-08-25 18:39:59 +00:00
# Check if rust and cargo are installed before compiling
CHECK_CARGO := $( shell cargo --version 2>/dev/null)
CHECK_RUST := $( shell rustc --version 2>/dev/null)
2022-10-06 08:36:23 +00:00
2021-10-26 15:22:13 +00:00
with_rdpclient := no
2022-09-22 23:16:51 +00:00
RDPCLIENT_MESSAGE := without-Windows-RDP-client
2021-10-26 15:22:13 +00:00
CARGO_TARGET_darwin_amd64 := x86_64-apple-darwin
CARGO_TARGET_darwin_arm64 := aarch64-apple-darwin
CARGO_TARGET_linux_arm64 := aarch64-unknown-linux-gnu
CARGO_TARGET_linux_amd64 := x86_64-unknown-linux-gnu
CARGO_TARGET := --target= ${ CARGO_TARGET_ ${ OS } _ ${ ARCH } }
2021-08-25 18:39:59 +00:00
i f n e q ( $( CHECK_RUST ) , )
i f n e q ( $( CHECK_CARGO ) , )
2021-10-26 15:22:13 +00:00
2022-10-20 22:39:58 +00:00
# Do not build RDP client on ARM or 386.
2022-01-06 19:35:46 +00:00
i f n e q ( "$(ARCH)" , "arm" )
2022-10-20 22:39:58 +00:00
i f n e q ( "$(ARCH)" , "386" )
2021-10-26 15:22:13 +00:00
with_rdpclient := yes
2022-09-22 23:16:51 +00:00
RDPCLIENT_MESSAGE := "with-Windows-RDP-client"
2021-10-26 15:22:13 +00:00
RDPCLIENT_TAG := desktop_access_rdp
2021-08-25 18:39:59 +00:00
e n d i f
2022-10-20 22:39:58 +00:00
e n d i f
2021-08-25 18:39:59 +00:00
e n d i f
2022-01-06 19:35:46 +00:00
e n d i f
2021-08-23 19:50:14 +00:00
2022-04-28 16:32:02 +00:00
# Enable libfido2 for testing?
2022-10-25 16:35:34 +00:00
# Eagerly enable if we detect the package, we want to test as much as possible.
2022-04-28 16:32:02 +00:00
i f e q ( "$(shell pkg-config libfido2 2>/dev/null; echo $$?)" , "0" )
LIBFIDO2_TEST_TAG := libfido2
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
e n d i f
2022-04-28 16:32:02 +00:00
# Build tsh against libfido2?
2022-07-20 14:28:29 +00:00
# FIDO2=yes and FIDO2=static enable static libfido2 builds.
# FIDO2=dynamic enables dynamic libfido2 builds.
2022-09-22 23:16:51 +00:00
LIBFIDO2_MESSAGE := without-libfido2
2022-07-20 14:28:29 +00:00
i f n e q ( , $( filter $ ( FIDO 2) , yes static ) )
2022-09-22 23:16:51 +00:00
LIBFIDO2_MESSAGE := with-libfido2
2022-04-28 16:32:02 +00:00
LIBFIDO2_BUILD_TAG := libfido2 libfido2static
2022-07-20 14:28:29 +00:00
e l s e i f e q ( "$(FIDO2)" , "dynamic" )
2022-09-22 23:16:51 +00:00
LIBFIDO2_MESSAGE := with-libfido2
2022-07-20 14:28:29 +00:00
LIBFIDO2_BUILD_TAG := libfido2
2022-04-28 16:32:02 +00:00
e n d i f
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
2022-05-25 16:52:37 +00:00
# Enable Touch ID builds?
# Only build if TOUCHID=yes to avoid issues when cross-compiling to 'darwin'
# from other systems.
2022-09-22 23:16:51 +00:00
TOUCHID_MESSAGE := without-Touch-ID
2022-05-25 16:52:37 +00:00
i f e q ( "$(TOUCHID)" , "yes" )
2022-09-22 23:16:51 +00:00
TOUCHID_MESSAGE := with-Touch-ID
2022-05-25 16:52:37 +00:00
TOUCHID_TAG := touchid
e n d i f
2022-10-25 16:35:34 +00:00
# Enable PIV for testing?
# Eagerly enable if we detect the dynamic libpcsclite library, we want to test as much as possible.
2022-09-22 23:16:51 +00:00
i f e q ( "$(shell pkg-config libpcsclite 2>/dev/null; echo $$?)" , "0" )
# This test tag should not be used for builds/releases, only tests.
2022-10-25 16:35:34 +00:00
PIV_TEST_TAG := piv
2022-09-22 23:16:51 +00:00
e n d i f
2022-10-25 16:35:34 +00:00
# Build teleport/api with PIV? This requires the libpcsclite library for linux.
2022-09-22 23:16:51 +00:00
#
2023-01-18 19:40:39 +00:00
# PIV=yes and PIV=static enable static piv builds. This is used by the build
2022-10-25 16:35:34 +00:00
# process to link a static library of libpcsclite for piv-go to connect to.
2022-09-22 23:16:51 +00:00
#
2022-10-25 16:35:34 +00:00
# PIV=dynamic enables dynamic piv builds. This can be used for local
2022-09-22 23:16:51 +00:00
# builds and runs utilizing a dynamic libpcsclite library - `apt get install libpcsclite-dev`
2022-10-25 16:35:34 +00:00
PIV_MESSAGE := without-PIV-support
i f n e q ( , $( filter $ ( PIV ) , yes static dynamic ) )
PIV_MESSAGE := with-PIV-support
PIV_BUILD_TAG := piv
i f n e q ( "$(PIV)" , "dynamic" )
2022-09-22 23:16:51 +00:00
# Link static pcsc libary. By default, piv-go will look for the dynamic library.
# https://github.com/go-piv/piv-go/blob/master/piv/pcsc_unix.go#L23
STATIC_LIBS += -lpcsclite
STATIC_LIBS_TSH += -lpcsclite
e n d i f
e n d i f
2021-10-26 15:22:13 +00:00
# Reproducible builds are only available on select targets, and only when OS=linux.
2021-08-23 19:50:14 +00:00
REPRODUCIBLE ?=
i f n e q ( "$(OS)" , "linux" )
REPRODUCIBLE = no
e n d i f
2018-07-31 20:41:33 +00:00
# On Windows only build tsh. On all other platforms build teleport, tctl,
# and tsh.
Certificate renewal bot (#10099)
* Add certificate renewal bot
This adds a new `tbot` tool to continuously renew a set of
certificates after registering with a Teleport cluster using a
similar process to standard node joining.
This makes some modifications to user certificate generation to allow
for certificates that can be renewed beyond their original TTL, and
exposes new gRPC endpoints:
* `CreateBotJoinToken` creates a join token for a bot user
* `GenerateInitialRenewableUserCerts` exchanges a token for a set of
certificates with a new `renewable` flag set
A new `tctl` command, `tctl bots add`, creates a bot user and calls
`CreateBotJoinToken` to issue a token. A bot instance can then be
started using a provided command.
* Cert bot refactoring pass
* Use role requests to split renewable certs from end-user certs
* Add bot configuration file
* Use `teleport.dev/bot` label
* Remove `impersonator` flag on initial bot certs
* Remove unnecessary `renew` package
* Misc other cleanup
* Do not pass through `renewable` flag when role requests are set
This adds additional restrictions on when a certificate's `renewable`
flag is carried over to a new certificate. In particular, it now also
denies the flag when either role requests are present, or the
`disallowReissue` flag has been previously set.
In practice `disallow-reissue` would have prevented any undesired
behavior but this improves consistency and resolves a TODO.
* Various tbot UX improvements; render SSH config
* Fully flesh out config template rendering
* Fix rendering for SSH configuration templates
* Added `String()` impls for destination types
* Improve certificate renewal logging; show more detail
* Properly fall back to default (all) roles
* Add mode hints for files
* Add/update copyright headers
* Add stubs for tbot init and watch commands
* Add gRPC endpoints for managing bots
* Add `CreateBot`, `DeleteBot`, and `GetBotUsers` gRPC endpoints
* Replace `tctl bot (add|rm|ls)` implementations with gRPC calls
* Define a few new constants, `DefaultBotJoinTTL`, `BotLabel`,
`BotGenerationLabel`
* Fix outdated destination flag in example tbot command
* Bugfix pass for demo
* Fixed a few nil pointer derefs when using config from CLI args
* Properly create destination if `--destination-dir` flag is used
* Remove improper default on CLI flag
* `DestinationConfig` is now a list of pointers
* Address first wave of review feedback
Fixes the majority of smaller issues caught by reviewers, thanks all!
* Add doc comments for bot.go functions
* Return the token TTL from CreateBot
* Split initial user cert issuance from `generateUserCerts()`
Issuing initial renewable certificate ended up requiring a lot of
hacks to skip checks that prevented anonymous bots from getting
certs even though we'd verified their identity elsewhere (via token).
This reverts all those hacks and splits initial bot cert logic into a
dedicated `generateInitialRenewableUserCerts()` function which should
make the whole process much easier to follow.
* Set bot traits to silence log messages
* tbot log message consistency pass
* Resolve lints
* Add config tests
* Remove CreateBotJoinToken endpoint
Users should instead use the CreateBot/DeleteBot endpoints.
* Create a fresh private key for every impersonated identity renewal
* Hide `config` subcommand
* Rename bot label prefix to `teleport.internal/`
* Use types.NewRole() to create bot roles
* Clean up error handling in custom YAML unmarshallers
Also, add notes about the supported YAML shapes.
* Fetch proxy host via gRPC Ping() instead of GetProxies()
* Update lib/auth/bot.go
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Fix some review comments
* Add renewable certificate generation checks (#10098)
* Add renewable certificate generation checks
This adds a new validation check for renewable certificates that
maintains a renewal counter as both a certificate extension and a
user label. This counter is used to ensure only a single certificate
lineage can exist: for example, if a renewable certificate is stolen,
only one copy of the certificate can be renewed as the generation
counter will not match
When renewing a certificate, first the generation counter presented
by the user (via their TLS identity) is compared to a value stored
with the associated user (in a new `teleport.dev/bot-generation`
label field). If they aren't equal, the renewal attempt fails.
Otherwise, the generation counter is incremented by 1, stored to the
database using a `CompareAndSwap()` to ensure atomicity, and set on
the generated certificate for use in future renewals.
* Add unit tests for the generation counter
This adds new unit tests to exercise the generation counter checks.
Additionally, it fixes two other renewable cert tests that were
failing.
* Remove certRequestGeneration() function
* Emit audit event when cert generations don't match
* Fully implement `tctl bots lock`
* Show bot name in `tctl bots ls`
* Lock bots when a cert generation mismatch is found
* Make CompareFailed respones from validateGenerationLabel() more actionable
* Update lib/services/local/users.go
Co-authored-by: Nic Klaassen <nic@goteleport.com>
* Backend changes for tbot IoT and AWS joining (#10360)
* backend changes
* add token permission check
* pass ctx from caller
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* fix comment typo
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* use UserMetadata instead of Identity in RenewableCertificateGenerationMismatch event
* Client changes for tbot IoT joining (#10397)
* client changes
* delete replaced APIs
* delete unused tbot/auth.go
* add license header
* don't unecessarily fetch host CA
* log fixes
* s/tunnelling/tunneling/
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* auth server addresses may be proxies
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* comment typo fix
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* move *Server methods out of auth_with_roles.go (#10416)
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Address another batch of review feedback
* Addres another batch of review feedback
Add `Role.SetMetadata()`, simplify more `trace.WrapWithMessage()`
calls, clear some TODOs and lints, and address other misc feedback
items.
* Fix lint
* Add missing doc comments to SaveIdentity / LoadIdentity
* Remove pam tag from tbot build
* Update note about bot lock deletion
* Another pass of review feedback
Ensure all requestable roles exist when creating a bot, adjust the
default renewable cert TTL down to 1 hour, and check types during
`CompareAndSwapUser()`
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-02-19 02:41:45 +00:00
BINARIES = $( BUILDDIR) /teleport $( BUILDDIR) /tctl $( BUILDDIR) /tsh $( BUILDDIR) /tbot
2018-07-31 20:41:33 +00:00
i f e q ( "$(OS)" , "windows" )
BINARIES = $( BUILDDIR) /tsh
e n d i f
2017-01-16 00:27:19 +00:00
2022-09-22 23:16:51 +00:00
# Joins elements of the list in arg 2 with the given separator.
# 1. Element separator.
# 2. The list.
EMPTY :=
SPACE := $( EMPTY) $( EMPTY)
join-with = $( subst $( SPACE) ,$1 ,$( strip $2 ) )
# Separate TAG messages into comma-separated WITH and WITHOUT lists for readability.
COMMA := ,
2022-10-25 16:35:34 +00:00
MESSAGES := $( PAM_MESSAGE) $( FIPS_MESSAGE) $( BPF_MESSAGE) $( RDPCLIENT_MESSAGE) $( LIBFIDO2_MESSAGE) $( TOUCHID_MESSAGE) $( PIV_MESSAGE)
2022-09-22 23:16:51 +00:00
WITH := $( subst -," " ,$( call join-with,$( COMMA) ,$( subst with-,,$( filter with-%,$( MESSAGES) ) ) ) )
WITHOUT := $( subst -," " ,$( call join-with,$( COMMA) ,$( subst without-,,$( filter without-%,$( MESSAGES) ) ) ) )
RELEASE_MESSAGE := " Building with GOOS= $( OS) GOARCH= $( ARCH) REPRODUCIBLE= $( REPRODUCIBLE) and with $( WITH) and without $( WITHOUT) . "
2021-08-23 19:50:14 +00:00
# On platforms that support reproducible builds, ensure the archive is created in a reproducible manner.
2021-08-12 01:43:32 +00:00
TAR_FLAGS ?=
2021-08-23 19:50:14 +00:00
i f e q ( "$(REPRODUCIBLE)" , "yes" )
2021-08-12 01:43:32 +00:00
TAR_FLAGS = --sort= name --owner= root:0 --group= root:0 --mtime= 'UTC 2015-03-02' --format= gnu
e n d i f
2021-06-18 18:52:55 +00:00
VERSRC = version.go gitref.go api/version.go
2017-01-16 00:27:19 +00:00
2018-06-15 22:05:15 +00:00
KUBECONFIG ?=
TEST_KUBE ?=
export
2022-02-15 01:19:33 +00:00
TEST_LOG_DIR = ${ abspath ./test-logs }
2022-06-06 13:06:57 +00:00
CLANG_FORMAT_STYLE = '{ColumnLimit: 100, IndentWidth: 4, Language: Proto}'
2022-12-28 23:16:57 +00:00
# Is this build targeting the same OS & architecture it is being compiled on, or
2023-01-18 19:40:39 +00:00
# will it require cross-compilation? We need to know this (especially for ARM) so we
# can set the cross-compiler path (and possibly feature flags) correctly.
2022-12-28 23:16:57 +00:00
IS_NATIVE_BUILD ?= $( if $( filter $( ARCH) , $( shell go env GOARCH) ) ,"yes" ,"no" )
2022-09-22 23:16:51 +00:00
# Set CGOFLAG and BUILDFLAGS as needed for the OS/ARCH.
i f e q ( "$(OS)" , "linux" )
i f e q ( "$(ARCH)" , "amd64" )
# Link static version of libraries required by Teleport (bpf, pcsc) to reduce system dependencies. Avoid dependencies on dynamic libraries if we already link the static version using --as-needed.
CGOFLAG = CGO_ENABLED = 1 CGO_LDFLAGS = " -Wl,-Bstatic $( STATIC_LIBS) -Wl,-Bdynamic -Wl,--as-needed "
CGOFLAG_TSH = CGO_ENABLED = 1 CGO_LDFLAGS = " -Wl,-Bstatic $( STATIC_LIBS_TSH) -Wl,-Bdynamic -Wl,--as-needed "
e l s e i f e q ( "$(ARCH)" , "arm" )
# ARM builds need to specify the correct C compiler
CGOFLAG = CGO_ENABLED = 1 CC = arm-linux-gnueabihf-gcc
2022-10-03 17:46:23 +00:00
# Add -debugtramp=2 to work around 24 bit CALL/JMP instruction offset.
BUILDFLAGS = $( ADDFLAGS) -ldflags '-w -s -debugtramp=2' -trimpath
2022-09-22 23:16:51 +00:00
e l s e i f e q ( "$(ARCH)" , "arm64" )
2022-12-28 23:16:57 +00:00
# ARM64 requires CGO but does not need to do any special linkage due to its reduced featureset
CGOFLAG = CGO_ENABLED = 1
# If we 're not guaranteed to be building natively on an arm64 system, then we'll
# need to configure the cross compiler.
i f e q ( $( IS_NATIVE_BUILD ) , "no" )
CGOFLAG += CC = aarch64-linux-gnu-gcc
e n d i f
2022-09-22 23:16:51 +00:00
e n d i f
e n d i f
# Windows requires extra parameters to cross-compile with CGO.
i f e q ( "$(OS)" , "windows" )
ARCH ?= amd64
i f n e q ( "$(ARCH)" , "amd64" )
$( error "Building for windows requires ARCH =amd 64")
e n d i f
CGOFLAG = CGO_ENABLED = 1 CC = x86_64-w64-mingw32-gcc CXX = x86_64-w64-mingw32-g++
BUILDFLAGS = $( ADDFLAGS) -ldflags '-w -s' -trimpath -buildmode= exe
e n d i f
CGOFLAG_TSH ?= $( CGOFLAG)
2016-01-17 18:28:34 +00:00
#
2018-07-31 20:41:33 +00:00
# 'make all' builds all 3 executables and places them in the current directory.
2018-02-24 01:23:09 +00:00
#
2023-01-18 22:22:25 +00:00
# IMPORTANT:
# Unless called with the `WEBASSETS_TAG` env variable set to "webassets_embed"
# the binaries will not contain the web UI assets and `teleport` won't start
# without setting the environment variable DEBUG=1.
2016-02-14 01:09:05 +00:00
.PHONY : all
2021-06-18 18:52:55 +00:00
all : version
2018-09-27 01:21:45 +00:00
@echo "---> Building OSS binaries."
2018-03-27 17:43:27 +00:00
$( MAKE) $( BINARIES)
2022-12-20 05:25:56 +00:00
#
# make binaries builds all binaries defined in the BINARIES environment variable
#
.PHONY : binaries
binaries :
$( MAKE) $( BINARIES)
2018-05-19 23:58:14 +00:00
# By making these 3 targets below (tsh, tctl and teleport) PHONY we are solving
# several problems:
# * Build will rely on go build internal caching https://golang.org/doc/go1.10 at all times
# * Manual change detection was broken on a large dependency tree
# If you are considering changing this behavior, please consult with dev team first
.PHONY : $( BUILDDIR ) /tctl
2022-06-25 04:01:21 +00:00
$(BUILDDIR)/tctl :
2022-10-25 16:35:34 +00:00
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " $( PAM_TAG) $( FIPS_TAG) $( PIV_BUILD_TAG) " -o $( BUILDDIR) /tctl $( BUILDFLAGS) ./tool/tctl
2018-03-27 17:43:27 +00:00
2018-05-19 23:58:14 +00:00
.PHONY : $( BUILDDIR ) /teleport
2021-10-01 22:01:17 +00:00
$(BUILDDIR)/teleport : ensure -webassets bpf -bytecode rdpclient
2022-10-25 16:35:34 +00:00
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( WEBASSETS_TAG) $( RDPCLIENT_TAG) $( PIV_BUILD_TAG) " -o $( BUILDDIR) /teleport $( BUILDFLAGS) ./tool/teleport
2018-03-27 17:43:27 +00:00
2022-08-29 06:56:55 +00:00
# NOTE: Any changes to the `tsh` build here must be copied to `windows.go` in Dronegen until
# we can use this Makefile for native Windows builds.
2018-05-19 23:58:14 +00:00
.PHONY : $( BUILDDIR ) /tsh
$(BUILDDIR)/tsh :
2022-10-25 16:35:34 +00:00
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG_TSH) go build -tags " $( FIPS_TAG) $( LIBFIDO2_BUILD_TAG) $( TOUCHID_TAG) $( PIV_BUILD_TAG) " -o $( BUILDDIR) /tsh $( BUILDFLAGS) ./tool/tsh
2016-03-22 19:15:17 +00:00
Certificate renewal bot (#10099)
* Add certificate renewal bot
This adds a new `tbot` tool to continuously renew a set of
certificates after registering with a Teleport cluster using a
similar process to standard node joining.
This makes some modifications to user certificate generation to allow
for certificates that can be renewed beyond their original TTL, and
exposes new gRPC endpoints:
* `CreateBotJoinToken` creates a join token for a bot user
* `GenerateInitialRenewableUserCerts` exchanges a token for a set of
certificates with a new `renewable` flag set
A new `tctl` command, `tctl bots add`, creates a bot user and calls
`CreateBotJoinToken` to issue a token. A bot instance can then be
started using a provided command.
* Cert bot refactoring pass
* Use role requests to split renewable certs from end-user certs
* Add bot configuration file
* Use `teleport.dev/bot` label
* Remove `impersonator` flag on initial bot certs
* Remove unnecessary `renew` package
* Misc other cleanup
* Do not pass through `renewable` flag when role requests are set
This adds additional restrictions on when a certificate's `renewable`
flag is carried over to a new certificate. In particular, it now also
denies the flag when either role requests are present, or the
`disallowReissue` flag has been previously set.
In practice `disallow-reissue` would have prevented any undesired
behavior but this improves consistency and resolves a TODO.
* Various tbot UX improvements; render SSH config
* Fully flesh out config template rendering
* Fix rendering for SSH configuration templates
* Added `String()` impls for destination types
* Improve certificate renewal logging; show more detail
* Properly fall back to default (all) roles
* Add mode hints for files
* Add/update copyright headers
* Add stubs for tbot init and watch commands
* Add gRPC endpoints for managing bots
* Add `CreateBot`, `DeleteBot`, and `GetBotUsers` gRPC endpoints
* Replace `tctl bot (add|rm|ls)` implementations with gRPC calls
* Define a few new constants, `DefaultBotJoinTTL`, `BotLabel`,
`BotGenerationLabel`
* Fix outdated destination flag in example tbot command
* Bugfix pass for demo
* Fixed a few nil pointer derefs when using config from CLI args
* Properly create destination if `--destination-dir` flag is used
* Remove improper default on CLI flag
* `DestinationConfig` is now a list of pointers
* Address first wave of review feedback
Fixes the majority of smaller issues caught by reviewers, thanks all!
* Add doc comments for bot.go functions
* Return the token TTL from CreateBot
* Split initial user cert issuance from `generateUserCerts()`
Issuing initial renewable certificate ended up requiring a lot of
hacks to skip checks that prevented anonymous bots from getting
certs even though we'd verified their identity elsewhere (via token).
This reverts all those hacks and splits initial bot cert logic into a
dedicated `generateInitialRenewableUserCerts()` function which should
make the whole process much easier to follow.
* Set bot traits to silence log messages
* tbot log message consistency pass
* Resolve lints
* Add config tests
* Remove CreateBotJoinToken endpoint
Users should instead use the CreateBot/DeleteBot endpoints.
* Create a fresh private key for every impersonated identity renewal
* Hide `config` subcommand
* Rename bot label prefix to `teleport.internal/`
* Use types.NewRole() to create bot roles
* Clean up error handling in custom YAML unmarshallers
Also, add notes about the supported YAML shapes.
* Fetch proxy host via gRPC Ping() instead of GetProxies()
* Update lib/auth/bot.go
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Fix some review comments
* Add renewable certificate generation checks (#10098)
* Add renewable certificate generation checks
This adds a new validation check for renewable certificates that
maintains a renewal counter as both a certificate extension and a
user label. This counter is used to ensure only a single certificate
lineage can exist: for example, if a renewable certificate is stolen,
only one copy of the certificate can be renewed as the generation
counter will not match
When renewing a certificate, first the generation counter presented
by the user (via their TLS identity) is compared to a value stored
with the associated user (in a new `teleport.dev/bot-generation`
label field). If they aren't equal, the renewal attempt fails.
Otherwise, the generation counter is incremented by 1, stored to the
database using a `CompareAndSwap()` to ensure atomicity, and set on
the generated certificate for use in future renewals.
* Add unit tests for the generation counter
This adds new unit tests to exercise the generation counter checks.
Additionally, it fixes two other renewable cert tests that were
failing.
* Remove certRequestGeneration() function
* Emit audit event when cert generations don't match
* Fully implement `tctl bots lock`
* Show bot name in `tctl bots ls`
* Lock bots when a cert generation mismatch is found
* Make CompareFailed respones from validateGenerationLabel() more actionable
* Update lib/services/local/users.go
Co-authored-by: Nic Klaassen <nic@goteleport.com>
* Backend changes for tbot IoT and AWS joining (#10360)
* backend changes
* add token permission check
* pass ctx from caller
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* fix comment typo
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* use UserMetadata instead of Identity in RenewableCertificateGenerationMismatch event
* Client changes for tbot IoT joining (#10397)
* client changes
* delete replaced APIs
* delete unused tbot/auth.go
* add license header
* don't unecessarily fetch host CA
* log fixes
* s/tunnelling/tunneling/
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* auth server addresses may be proxies
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* comment typo fix
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* move *Server methods out of auth_with_roles.go (#10416)
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Address another batch of review feedback
* Addres another batch of review feedback
Add `Role.SetMetadata()`, simplify more `trace.WrapWithMessage()`
calls, clear some TODOs and lints, and address other misc feedback
items.
* Fix lint
* Add missing doc comments to SaveIdentity / LoadIdentity
* Remove pam tag from tbot build
* Update note about bot lock deletion
* Another pass of review feedback
Ensure all requestable roles exist when creating a bot, adjust the
default renewable cert TTL down to 1 hour, and check types during
`CompareAndSwapUser()`
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-02-19 02:41:45 +00:00
.PHONY : $( BUILDDIR ) /tbot
$(BUILDDIR)/tbot :
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " $( FIPS_TAG) " -o $( BUILDDIR) /tbot $( BUILDFLAGS) ./tool/tbot
2021-04-09 23:20:56 +00:00
#
# BPF support (IF ENABLED)
# Requires a recent version of clang and libbpf installed.
#
i f e q ( "$(with_bpf)" , "yes" )
2021-07-14 20:27:53 +00:00
$(ER_BPF_BUILDDIR) :
mkdir -p $( ER_BPF_BUILDDIR)
$(RS_BPF_BUILDDIR) :
mkdir -p $( RS_BPF_BUILDDIR)
2021-04-09 23:20:56 +00:00
# Build BPF code
2021-07-14 20:27:53 +00:00
$(ER_BPF_BUILDDIR)/%.bpf.o : bpf /enhancedrecording /%.bpf .c $( wildcard bpf /*.h ) | $( ER_BPF_BUILDDIR )
2021-04-09 23:20:56 +00:00
$( CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$( KERNEL_ARCH) $( INCLUDES) $( CLANG_BPF_SYS_INCLUDES) -c $( filter %.c,$^) -o $@
$( LLVM_STRIP) -g $@ # strip useless DWARF info
2021-07-14 20:27:53 +00:00
# Build BPF code
$(RS_BPF_BUILDDIR)/%.bpf.o : bpf /restrictedsession /%.bpf .c $( wildcard bpf /*.h ) | $( RS_BPF_BUILDDIR )
$( CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$( KERNEL_ARCH) $( INCLUDES) $( CLANG_BPF_SYS_INCLUDES) -c $( filter %.c,$^) -o $@
$( LLVM_STRIP) -g $@ # strip useless DWARF info
.PHONY : bpf -rs -bytecode
bpf-rs-bytecode : $( RS_BPF_BUILDDIR ) /restricted .bpf .o
.PHONY : bpf -er -bytecode
bpf-er-bytecode : $( ER_BPF_BUILDDIR ) /command .bpf .o $( ER_BPF_BUILDDIR ) /disk .bpf .o $( ER_BPF_BUILDDIR ) /network .bpf .o $( ER_BPF_BUILDDIR ) /counter_test .bpf .o
2021-04-09 23:20:56 +00:00
.PHONY : bpf -bytecode
2021-07-14 20:27:53 +00:00
bpf-bytecode : bpf -er -bytecode bpf -rs -bytecode
2021-04-09 23:20:56 +00:00
# Generate vmlinux.h based on the installed kernel
.PHONY : update -vmlinux -h
update-vmlinux-h :
bpftool btf dump file /sys/kernel/btf/vmlinux format c >bpf/vmlinux.h
e l s e
.PHONY : bpf -bytecode
bpf-bytecode :
e n d i f
2021-10-26 15:22:13 +00:00
i f e q ( "$(with_rdpclient)" , "yes" )
2021-10-01 22:01:17 +00:00
.PHONY : rdpclient
rdpclient :
2022-11-23 14:32:53 +00:00
i f n e q ( "$(FIPS)" , "" )
cargo build -p rdp-client --features= fips --release $( CARGO_TARGET)
e l s e
2022-01-26 21:07:42 +00:00
cargo build -p rdp-client --release $( CARGO_TARGET)
2022-11-23 14:32:53 +00:00
e n d i f
2021-10-01 22:01:17 +00:00
e l s e
.PHONY : rdpclient
rdpclient :
e n d i f
2016-06-14 23:52:32 +00:00
#
2018-07-31 20:41:33 +00:00
# make full - Builds Teleport binaries with the built-in web assets and
# places them into $(BUILDDIR). On Windows, this target is skipped because
# only tsh is built.
2017-09-17 23:24:11 +00:00
#
.PHONY : full
2022-10-06 08:36:23 +00:00
full : ensure -webassets
2018-07-31 20:41:33 +00:00
i f n e q ( "$(OS)" , "windows" )
2021-03-27 00:37:52 +00:00
$( MAKE) all WEBASSETS_TAG = "webassets_embed"
2018-07-31 20:41:33 +00:00
e n d i f
2016-03-18 21:54:20 +00:00
2020-07-15 00:15:01 +00:00
#
# make full-ent - Builds Teleport enterprise binaries
#
.PHONY : full -ent
2023-01-18 22:22:25 +00:00
full-ent : ensure -webassets -e
2020-07-15 00:15:01 +00:00
i f n e q ( "$(OS)" , "windows" )
2022-10-06 08:36:23 +00:00
@if [ -f e/Makefile ] ; then $( MAKE) -C e full; fi
2020-07-15 00:15:01 +00:00
e n d i f
2018-07-31 20:41:33 +00:00
#
2021-10-13 22:01:30 +00:00
# make clean - Removes all build artifacts.
2018-07-31 20:41:33 +00:00
#
2016-03-19 20:43:23 +00:00
.PHONY : clean
2023-01-18 22:22:25 +00:00
clean : clean -ui
2018-09-27 01:21:45 +00:00
@echo "---> Cleaning up OSS build artifacts."
2016-03-19 20:43:23 +00:00
rm -rf $( BUILDDIR)
2022-07-18 17:06:58 +00:00
# Check if the variable is set to prevent calling remove on the root directory.
i f n e q ( $( ER_BPF_BUILDDIR ) , )
rm -f $( ER_BPF_BUILDDIR) /*.o
e n d i f
i f n e q ( $( RS_BPF_BUILDDIR ) , )
rm -f $( RS_BPF_BUILDDIR) /*.o
e n d i f
2022-01-28 02:34:45 +00:00
-cargo clean
2021-04-01 17:12:53 +00:00
-go clean -cache
2022-07-18 17:06:58 +00:00
rm -f *.gz
rm -f *.zip
2017-09-19 19:17:23 +00:00
rm -f gitref.go
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
rm -rf build.assets/tooling/bin
2016-01-17 22:50:00 +00:00
2023-01-18 22:22:25 +00:00
.PHONY : clean -ui
clean-ui :
rm -rf webassets/*
find . -type d -name node_modules -prune -exec rm -rf { } \;
2017-09-17 23:24:11 +00:00
#
2018-07-31 20:41:33 +00:00
# make release - Produces a binary release tarball.
2018-02-24 01:23:09 +00:00
#
.PHONY :
2017-09-17 23:24:11 +00:00
export
2018-07-31 20:41:33 +00:00
release :
2023-01-18 22:22:25 +00:00
@echo " ---> OSS $( RELEASE_MESSAGE) "
2018-07-31 20:41:33 +00:00
i f e q ( "$(OS)" , "windows" )
$( MAKE) --no-print-directory release-windows
2023-01-12 04:58:50 +00:00
e l s e i f e q ( "$(OS)" , "darwin" )
$( MAKE) --no-print-directory release-darwin
2018-07-31 20:41:33 +00:00
e l s e
$( MAKE) --no-print-directory release-unix
e n d i f
2021-03-23 01:32:45 +00:00
# These are aliases used to make build commands uniform.
.PHONY : release -amd 64
release-amd64 :
$( MAKE) release ARCH = amd64
.PHONY : release -386
release-386 :
$( MAKE) release ARCH = 386
.PHONY : release -arm
release-arm :
$( MAKE) release ARCH = arm
.PHONY : release -arm 64
release-arm64 :
$( MAKE) release ARCH = arm64
2018-07-31 20:41:33 +00:00
#
2022-10-31 18:00:55 +00:00
# make build-archive - Packages the results of a build into a release tarball
2018-07-31 20:41:33 +00:00
#
2022-10-31 18:00:55 +00:00
.PHONY : build -archive
build-archive :
2018-09-27 01:21:45 +00:00
@echo "---> Creating OSS release archive."
2017-09-17 23:24:11 +00:00
mkdir teleport
2017-09-19 19:54:02 +00:00
cp -rf $( BUILDDIR) /* \
2017-09-17 23:24:11 +00:00
examples \
build.assets/install\
README.md \
CHANGELOG.md \
teleport/
echo $( GITTAG) > teleport/VERSION
2021-08-12 01:43:32 +00:00
tar $( TAR_FLAGS) -c teleport | gzip -n > $( RELEASE) .tar.gz
2017-09-17 23:24:11 +00:00
rm -rf teleport
2018-09-27 01:21:45 +00:00
@echo " ---> Created $( RELEASE) .tar.gz. "
2023-01-18 19:40:39 +00:00
2022-10-31 18:00:55 +00:00
#
2023-01-18 19:40:39 +00:00
# make release-unix - Produces binary release tarballs for both OSS and
2022-12-28 23:16:57 +00:00
# Enterprise editions, containing teleport, tctl, tbot and tsh.
2022-10-31 18:00:55 +00:00
#
.PHONY :
release-unix : clean full build -archive
2022-10-06 08:36:23 +00:00
@if [ -f e/Makefile ] ; then $( MAKE) -C e release; fi
2018-07-31 20:41:33 +00:00
2023-01-12 04:58:50 +00:00
.PHONY : release -darwin -unsigned
release-darwin-unsigned : RELEASE :=$( RELEASE ) -unsigned
release-darwin-unsigned : clean full build -archive
.PHONY : release -darwin
release-darwin : ABSOLUTE_BINARY_PATHS :=$( addprefix $ ( CURDIR ) /,$ ( BINARIES ) )
release-darwin : release -darwin -unsigned
2023-01-13 20:57:52 +00:00
# Only run if Apple username/pass for notarization are provided
if [ -n " $$ APPLE_USERNAME " -a -n " $$ APPLE_PASSWORD " ] ; then \
cd ./build.assets/tooling/ && \
go run ./cmd/notarize-apple-binaries/*.go \
--log-level= debug $( ABSOLUTE_BINARY_PATHS) ; \
fi
2023-01-12 04:58:50 +00:00
$( MAKE) build-archive
@if [ -f e/Makefile ] ; then $( MAKE) -C e release; fi
2022-12-28 23:16:57 +00:00
#
# make release-unix-only - Produces an Enterprise binary release tarball containing
# teleport, tctl, and tsh *WITHOUT* also creating an OSS build tarball.
#
.PHONY : release -unix -only
release-unix-only : clean
@if [ -f e/Makefile ] ; then $( MAKE) -C e release; fi
2018-07-31 20:41:33 +00:00
#
2021-09-02 22:34:57 +00:00
# make release-windows-unsigned - Produces a binary release archive containing only tsh.
2018-07-31 20:41:33 +00:00
#
2021-09-02 22:34:57 +00:00
.PHONY : release -windows -unsigned
release-windows-unsigned : clean all
2018-09-27 01:21:45 +00:00
@echo "---> Creating OSS release archive."
2018-07-31 20:41:33 +00:00
mkdir teleport
cp -rf $( BUILDDIR) /* \
README.md \
CHANGELOG.md \
teleport/
2021-09-02 22:34:57 +00:00
mv teleport/tsh teleport/tsh-unsigned.exe
2018-07-31 20:41:33 +00:00
echo $( GITTAG) > teleport/VERSION
2021-09-02 22:34:57 +00:00
zip -9 -y -r -q $( RELEASE) -unsigned.zip teleport/
rm -rf teleport/
@echo " ---> Created $( RELEASE) -unsigned.zip. "
#
# make release-windows - Produces an archive containing a signed release of
# tsh.exe
#
.PHONY : release -windows
release-windows : release -windows -unsigned
@if [ ! -f "windows-signing-cert.pfx" ] ; then \
echo "windows-signing-cert.pfx is missing or invalid, cannot create signed archive." ; \
exit 1; \
fi
rm -rf teleport
@echo " ---> Extracting $( RELEASE) -unsigned.zip "
unzip $( RELEASE) -unsigned.zip
2021-10-01 22:01:17 +00:00
2021-09-02 22:34:57 +00:00
@echo "---> Signing Windows binary."
@osslsigncode sign \
-pkcs12 "windows-signing-cert.pfx" \
-n "Teleport" \
-i https://goteleport.com \
-t http://timestamp.digicert.com \
-h sha2 \
-in teleport/tsh-unsigned.exe \
-out teleport/tsh.exe; \
success = $$ ?; \
rm -f teleport/tsh-unsigned.exe; \
if [ " $$ {success} " -ne 0 ] ; then \
echo "Failed to sign tsh.exe, aborting." ; \
exit 1; \
fi
2018-07-31 20:41:33 +00:00
zip -9 -y -r -q $( RELEASE) .zip teleport/
rm -rf teleport/
2018-09-27 01:21:45 +00:00
@echo " ---> Created $( RELEASE) .zip. "
2017-01-28 02:26:27 +00:00
2020-06-18 00:09:41 +00:00
#
# Remove trailing whitespace in all markdown files under docs/.
#
# Note: this runs in a busybox container to avoid incompatibilities between
# linux and macos CLI tools.
#
.PHONY : docs -fix -whitespace
docs-fix-whitespace :
docker run --rm -v $( PWD) :/teleport busybox \
find /teleport/docs/ -type f -name '*.md' -exec sed -E -i 's/\s+$$//g' '{}' \;
#
# Test docs for trailing whitespace and broken links
#
.PHONY : docs -test
2021-03-10 18:01:48 +00:00
docs-test : docs -test -whitespace
2020-06-18 00:09:41 +00:00
#
# Check for trailing whitespace in all markdown files under docs/
#
.PHONY : docs -test -whitespace
docs-test-whitespace :
if find docs/ -type f -name '*.md' | xargs grep -E '\s+$$' ; then \
echo "trailing whitespace found in docs/ (see above)" ; \
echo "run 'make docs-fix-whitespace' to fix it" ; \
exit 1; \
fi
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
#
# Builds some tooling for filtering and displaying test progress/output/etc
#
2022-02-10 20:49:28 +00:00
TOOLINGDIR := ${ abspath ./build.assets/tooling }
RENDER_TESTS := $( TOOLINGDIR) /bin/render-tests
$(RENDER_TESTS) : $( wildcard $ ( TOOLINGDIR ) /cmd /render -tests /*.go )
cd $( TOOLINGDIR) && go build -o " $@ " ./cmd/render-tests
2023-01-18 18:29:10 +00:00
DIFF_TEST := $( TOOLINGDIR) /bin/difftest
$(DIFF_TEST) : $( wildcard $ ( TOOLINGDIR ) /cmd /difftest /*.go )
cd $( TOOLINGDIR) && go build -o " $@ " ./cmd/difftest
.PHONY : tooling
tooling : $( RENDER_TESTS ) $( DIFF_TEST )
2016-02-16 21:18:58 +00:00
#
2021-03-16 16:58:58 +00:00
# Runs all Go/shell tests, called by CI/CD.
2020-10-02 01:02:02 +00:00
#
2021-03-16 16:58:58 +00:00
.PHONY : test
2023-01-21 01:02:19 +00:00
test : test -helm test -sh test -api test -go test -rust test -operator
2021-03-16 16:58:58 +00:00
2022-02-15 01:19:33 +00:00
$(TEST_LOG_DIR) :
mkdir $( TEST_LOG_DIR)
2022-12-05 18:58:32 +00:00
.PHONY : helmunit /installed
helmunit/installed :
@if ! helm unittest -h >/dev/null; then \
echo 'Helm unittest plugin is required to test Helm charts. Run `helm plugin install https://github.com/quintush/helm-unittest` to install it' ; \
exit 1; \
fi
# The CI environment is responsible for setting HELM_PLUGINS to a directory where
# quintish/helm-unittest is installed.
2022-11-16 00:44:12 +00:00
#
2023-01-18 22:22:25 +00:00
# Github Actions build uses /workspace as homedir and Helm can't pick up plugins by default there,
# so override the plugin location via environemnt variable when running in CI. Github Actions provide CI=true
# environment variable.
2022-03-20 19:01:58 +00:00
.PHONY : test -helm
2022-12-05 18:58:32 +00:00
test-helm : helmunit /installed
helm unittest -3 examples/chart/teleport-cluster
helm unittest -3 examples/chart/teleport-kube-agent
2022-03-20 19:01:58 +00:00
.PHONY : test -helm -update -snapshots
2022-12-05 18:58:32 +00:00
test-helm-update-snapshots : helmunit /installed
helm unittest -3 -u examples/chart/teleport-cluster
helm unittest -3 -u examples/chart/teleport-kube-agent
2022-03-20 19:01:58 +00:00
2021-03-16 16:58:58 +00:00
#
# Runs all Go tests except integration, called by CI/CD.
2016-02-16 21:18:58 +00:00
#
2021-03-16 16:58:58 +00:00
.PHONY : test -go
2023-01-18 18:29:10 +00:00
test-go : test -go -prepare test -go -unit test -go -libfido 2 test -go -touch -id test -go -tsh test -go -chaos
# Runs test prepare steps
.PHONY : test -go -prepare
test-go-prepare : ensure -webassets bpf -bytecode rdpclient $( TEST_LOG_DIR ) $( RENDER_TESTS ) $( VERSRC )
# Runs base unit tests
.PHONY : test -go -unit
test-go-unit : FLAGS ?= -race -shuffle on
test-go-unit : SUBJECT ?= $( shell go list ./... | grep -v -e integration -e tool /tsh -e operator )
test-go-unit :
$( CGOFLAG) go test -cover -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) $( TOUCHID_TAG) $( PIV_TEST_TAG) " $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| ${ RENDER_TESTS }
2023-01-18 18:29:10 +00:00
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
# rdpclient and libfido2 don't play well together, so we run libfido2 tests
# separately.
# TODO(codingllama): Run libfido2 tests along with others once RDP doesn't
# embed openssl/libcrypto.
2023-01-18 18:29:10 +00:00
.PHONY : test -go -libfido 2
test-go-libfido2 : FLAGS ?= -race -shuffle on
test-go-libfido2 : SUBJECT ?= ./lib /auth /webauthncli /...
test-go-libfido2 :
2022-04-28 16:32:02 +00:00
i f n e q ( "$(LIBFIDO2_TEST_TAG)" , "" )
2023-01-18 18:29:10 +00:00
$( CGOFLAG) go test -cover -json -tags " $( LIBFIDO2_TEST_TAG) " $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
| ${ RENDER_TESTS }
e n d i f
2023-01-18 18:29:10 +00:00
2022-05-25 16:52:37 +00:00
# Make sure untagged touchid code build/tests.
2023-01-18 18:29:10 +00:00
.PHONY : test -go -touch -id
test-go-touch-id : FLAGS ?= -race -shuffle on
test-go-touch-id : SUBJECT ?= ./lib /auth /touchid /...
test-go-touch-id :
2022-05-25 16:52:37 +00:00
i f n e q ( "$(TOUCHID_TAG)" , "" )
2023-01-18 18:29:10 +00:00
$( CGOFLAG) go test -cover -json $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
2022-05-25 16:52:37 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
| ${ RENDER_TESTS }
e n d i f
2023-01-18 18:29:10 +00:00
# Runs ci tsh tests
.PHONY : test -go -tsh
test-go-tsh : FLAGS ?= -race -shuffle on
test-go-tsh : SUBJECT ?= github .com /gravitational /teleport /tool /tsh
test-go-tsh :
$( CGOFLAG_TSH) go test -cover -json -tags " $( PAM_TAG) $( FIPS_TAG) $( LIBFIDO2_TEST_TAG) $( TOUCHID_TAG) $( PIV_TEST_TAG) " $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
2022-02-15 16:02:10 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
| ${ RENDER_TESTS }
2023-01-18 18:29:10 +00:00
# Chaos tests have high concurrency, run without race detector and have TestChaos prefix.
.PHONY : test -go -chaos
test-go-chaos : CHAOS_FOLDERS = $( shell find . -type f -name '*chaos *.go ' | xargs dirname | uniq )
test-go-chaos :
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -cover -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) " -test.run= TestChaos $( CHAOS_FOLDERS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /chaos.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| ${ RENDER_TESTS }
2021-04-09 23:20:56 +00:00
#
# Runs all Go tests except integration and chaos, called by CI/CD.
#
UNIT_ROOT_REGEX := ^TestRoot
.PHONY : test -go -root
2022-06-25 04:01:21 +00:00
test-go-root : ensure -webassets bpf -bytecode rdpclient $( TEST_LOG_DIR ) $( RENDER_TESTS )
2022-04-15 22:35:34 +00:00
test-go-root : FLAGS ?= -race -shuffle on
2022-06-09 09:16:52 +00:00
test-go-root : PACKAGES = $( shell go list $ ( ADDFLAGS ) ./... | grep -v -e integration -e operator )
2021-04-09 23:20:56 +00:00
test-go-root : $( VERSRC )
2022-10-05 06:42:49 +00:00
$( CGOFLAG) go test -json -run " $( UNIT_ROOT_REGEX) " -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) " $( PACKAGES) $( FLAGS) $( ADDFLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /unit-root.json \
| ${ RENDER_TESTS }
2016-02-24 07:35:25 +00:00
2022-02-07 18:57:46 +00:00
#
# Runs Go tests on the api module. These have to be run separately as the package name is different.
2021-03-31 00:02:04 +00:00
#
.PHONY : test -api
2022-02-15 01:19:33 +00:00
test-api : $( VERSRC ) $( TEST_LOG_DIR ) $( RENDER_TESTS )
2023-01-18 18:29:10 +00:00
test-api : FLAGS ?= -race -shuffle on
test-api : SUBJECT ?= $( shell cd api && go list ./...)
2023-01-18 19:40:39 +00:00
test-api :
2023-01-18 18:29:10 +00:00
cd api && $( CGOFLAG) go test -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) " $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /api.json \
| ${ RENDER_TESTS }
2021-03-31 00:02:04 +00:00
2022-06-09 09:16:52 +00:00
#
# Runs Teleport Operator tests.
# We have to run them using the makefile to ensure the installation of the k8s test tools (envtest)
#
.PHONY : test -operator
test-operator :
make -C operator test
2022-02-07 18:57:46 +00:00
#
# Runs cargo test on our Rust modules.
# (a no-op if cargo and rustc are not installed)
#
i f n e q ( $( CHECK_RUST ) , )
i f n e q ( $( CHECK_CARGO ) , )
.PHONY : test -rust
test-rust :
cargo test
e l s e
.PHONY : test -rust
test-rust :
e n d i f
e n d i f
2021-03-16 16:58:58 +00:00
# Find and run all shell script unit tests (using https://github.com/bats-core/bats-core)
.PHONY : test -sh
test-sh :
2021-04-08 15:02:29 +00:00
@if ! type bats 2>& 1 >/dev/null; then \
echo "Not running 'test-sh' target as 'bats' is not installed." ; \
if [ " $$ {DRONE} " = "true" ] ; then echo "This is a failure when running in CI." && exit 1; fi ; \
exit 0; \
fi ; \
find . -iname "*.bats" -exec dirname { } \; | uniq | xargs -t -L1 bats $( BATSFLAGS)
2021-03-16 16:58:58 +00:00
2021-11-30 01:12:16 +00:00
.PHONY : run -etcd
run-etcd :
examples/etcd/start-etcd.sh
2016-04-14 21:42:10 +00:00
#
2020-04-17 15:57:10 +00:00
# Integration tests. Need a TTY to work.
2021-02-15 19:43:39 +00:00
# Any tests which need to run as root must be skipped during regular integration testing.
2016-04-14 21:42:10 +00:00
#
.PHONY : integration
2020-04-17 15:57:10 +00:00
integration : FLAGS ?= -v -race
2022-01-13 16:00:33 +00:00
integration : PACKAGES = $( shell go list ./... | grep integration )
2022-02-15 01:19:33 +00:00
integration : $( TEST_LOG_DIR ) $( RENDER_TESTS )
2018-06-15 22:05:15 +00:00
@echo KUBECONFIG is: $( KUBECONFIG) , TEST_KUBE: $( TEST_KUBE)
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -timeout 30m -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) " $( PACKAGES) $( FLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /integration.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| $( RENDER_TESTS) -report-by test
2016-03-23 00:03:58 +00:00
2021-02-15 19:43:39 +00:00
#
# Integration tests which need to be run as root in order to complete successfully
# are run separately to all other integration tests. Need a TTY to work.
#
INTEGRATION_ROOT_REGEX := ^TestRoot
.PHONY : integration -root
integration-root : FLAGS ?= -v -race
2022-01-13 16:00:33 +00:00
integration-root : PACKAGES = $( shell go list ./... | grep integration )
2022-02-15 01:19:33 +00:00
integration-root : $( TEST_LOG_DIR ) $( RENDER_TESTS )
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
$( CGOFLAG) go test -json -run " $( INTEGRATION_ROOT_REGEX) " $( PACKAGES) $( FLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /integration-root.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| $( RENDER_TESTS) -report-by test
2021-02-15 19:43:39 +00:00
2020-04-10 18:37:09 +00:00
#
2021-11-05 19:35:20 +00:00
# Lint the source code.
2021-03-19 16:26:56 +00:00
# By default lint scans the entire repo. Pass GO_LINT_FLAGS='--new' to only scan local
2020-04-10 18:37:09 +00:00
# changes (or last commit).
#
.PHONY : lint
2022-08-29 20:54:32 +00:00
lint : lint -sh lint -helm lint -api lint -go lint -license lint -rust lint -tools lint -protos
2022-02-07 17:03:10 +00:00
.PHONY : lint -tools
2023-01-21 01:02:19 +00:00
lint-tools : lint -build -tooling lint -backport
2021-11-05 19:35:20 +00:00
2022-02-07 18:57:46 +00:00
#
# Runs the clippy linter on our rust modules
# (a no-op if cargo and rustc are not installed)
#
i f n e q ( $( CHECK_RUST ) , )
i f n e q ( $( CHECK_CARGO ) , )
.PHONY : lint -rust
lint-rust :
cargo clippy --locked --all-targets -- -D warnings \
2021-11-05 19:35:20 +00:00
&& cargo fmt -- --check
2022-02-07 18:57:46 +00:00
e l s e
.PHONY : lint -rust
lint-rust :
e n d i f
e n d i f
2020-09-28 23:04:42 +00:00
.PHONY : lint -go
lint-go : GO_LINT_FLAGS ?=
lint-go :
2022-10-25 16:35:34 +00:00
golangci-lint run -c .golangci.yml --build-tags= '$(LIBFIDO2_TEST_TAG) $(TOUCHID_TAG) $(PIV_TEST_TAG)' $( GO_LINT_FLAGS)
2020-09-28 23:04:42 +00:00
2022-10-28 20:20:28 +00:00
.PHONY : fix -imports
fix-imports :
2022-11-04 15:46:46 +00:00
make -C build.assets/ fix-imports
.PHONY : fix -imports /host
fix-imports/host :
@if ! type gci >/dev/null 2>& 1; then \
echo 'gci is not installed or is missing from PATH, consider installing it ("go install github.com/daixiang0/gci@latest") or use "make -C build.assets/ fix-imports"' ; \
exit 1; \
fi
gci write -s 'standard,default,prefix(github.com/gravitational/teleport)' --skip-generated .
2022-10-28 20:20:28 +00:00
2022-02-10 20:49:28 +00:00
.PHONY : lint -build -tooling
lint-build-tooling : GO_LINT_FLAGS ?=
lint-build-tooling :
cd build.assets/tooling && golangci-lint run -c ../../.golangci.yml $( GO_LINT_FLAGS)
2022-02-07 17:03:10 +00:00
.PHONY : lint -backport
lint-backport : GO_LINT_FLAGS ?=
lint-backport :
cd assets/backport && golangci-lint run -c ../../.golangci.yml $( GO_LINT_FLAGS)
2021-03-31 00:02:04 +00:00
# api is no longer part of the teleport package, so golangci-lint skips it by default
.PHONY : lint -api
lint-api : GO_LINT_API_FLAGS ?=
lint-api :
2021-05-20 05:14:12 +00:00
cd api && golangci-lint run -c ../.golangci.yml $( GO_LINT_API_FLAGS)
2021-03-31 00:02:04 +00:00
2020-09-28 23:04:42 +00:00
# TODO(awly): remove the `--exclude` flag after cleaning up existing scripts
.PHONY : lint -sh
lint-sh : SH_LINT_FLAGS ?=
lint-sh :
2022-01-04 22:51:57 +00:00
find . -type f -name '*.sh' | xargs \
2020-09-28 23:04:42 +00:00
shellcheck \
2020-10-07 17:00:02 +00:00
--exclude= SC2086 \
2020-09-28 23:04:42 +00:00
$( SH_LINT_FLAGS)
2020-04-10 18:37:09 +00:00
2020-11-17 14:49:56 +00:00
# lint AWS AMI scripts
# SC1091 prints errors when "source" directives are not followed
find assets/aws/files/bin -type f | xargs \
shellcheck \
--exclude= SC2086 \
--exclude= SC1091 \
2021-02-24 00:45:28 +00:00
--exclude= SC2129 \
2020-11-17 14:49:56 +00:00
$( SH_LINT_FLAGS)
2021-02-08 21:08:05 +00:00
# Lints all the Helm charts found in directories under examples/chart and exits on failure
# If there is a .lint directory inside, the chart gets linted once for each .yaml file in that directory
2021-05-17 14:35:11 +00:00
# We inherit yamllint's 'relaxed' configuration as it's more compatible with Helm output and will only error on
2021-04-08 15:02:29 +00:00
# show-stopping issues. Kubernetes' YAML parser is not particularly fussy.
2021-05-17 14:35:11 +00:00
# If errors are found, the file is printed with line numbers to aid in debugging.
2021-02-08 21:08:05 +00:00
.PHONY : lint -helm
lint-helm :
2021-04-08 15:02:29 +00:00
@if ! type yamllint 2>& 1 >/dev/null; then \
echo "Not running 'lint-helm' target as 'yamllint' is not installed." ; \
if [ " $$ {DRONE} " = "true" ] ; then echo "This is a failure when running in CI." && exit 1; fi ; \
exit 0; \
fi ; \
2021-02-08 21:08:05 +00:00
for CHART in $$ ( find examples/chart -mindepth 1 -maxdepth 1 -type d) ; do \
2021-05-17 14:35:11 +00:00
if [ -d $$ { CHART} /.lint ] ; then \
for VALUES in $$ { CHART} /.lint/*.yaml; do \
export HELM_TEMP = $$ ( mktemp) ; \
echo -n " Using values from ' $$ {VALUES}': " ; \
2021-05-17 19:01:16 +00:00
yamllint -c examples/chart/.lint-config.yaml $$ { VALUES} || { cat -en $$ { VALUES} ; exit 1; } ; \
2021-05-17 14:35:11 +00:00
helm lint --strict $$ { CHART} -f $$ { VALUES} || exit 1; \
helm template test $$ { CHART} -f $$ { VALUES} 1>$$ { HELM_TEMP} || exit 1; \
2021-05-17 19:01:16 +00:00
yamllint -c examples/chart/.lint-config.yaml $$ { HELM_TEMP} || { cat -en $$ { HELM_TEMP} ; exit 1; } ; \
2021-02-08 21:08:05 +00:00
done \
else \
2021-05-17 14:35:11 +00:00
export HELM_TEMP = $$ ( mktemp) ; \
helm lint --strict $$ { CHART} || exit 1; \
helm template test $$ { CHART} 1>$$ { HELM_TEMP} || exit 1; \
2021-05-17 19:01:16 +00:00
yamllint -c examples/chart/.lint-config.yaml $$ { HELM_TEMP} || { cat -en $$ { HELM_TEMP} ; exit 1; } ; \
2021-05-17 14:35:11 +00:00
fi ; \
2021-02-08 21:08:05 +00:00
done
2021-08-30 16:44:09 +00:00
ADDLICENSE := $( GOPATH) /bin/addlicense
ADDLICENSE_ARGS := -c 'Gravitational, Inc' -l apache \
-ignore '**/*.c' \
-ignore '**/*.h' \
-ignore '**/*.html' \
-ignore '**/*.js' \
-ignore '**/*.py' \
-ignore '**/*.sh' \
-ignore '**/*.tf' \
-ignore '**/*.yaml' \
-ignore '**/*.yml' \
-ignore '**/Dockerfile' \
-ignore 'api/version.go' \
2022-08-26 18:11:38 +00:00
-ignore 'docs/pages/includes/**/*.go' \
2021-08-30 16:44:09 +00:00
-ignore 'e/**' \
-ignore 'gitref.go' \
2022-08-26 18:11:38 +00:00
-ignore 'lib/srv/desktop/rdp/rdpclient/target/**' \
2022-02-15 20:44:28 +00:00
-ignore 'lib/teleterm/api/protogen/**' \
2022-12-05 17:13:54 +00:00
-ignore 'lib/prehog/gen/**' \
2023-01-10 17:17:21 +00:00
-ignore 'lib/prehog/gen-js/**' \
2022-08-26 18:11:38 +00:00
-ignore 'lib/web/build/**' \
2021-08-30 16:44:09 +00:00
-ignore 'version.go' \
-ignore 'webassets/**' \
2023-01-18 19:40:39 +00:00
-ignore 'web/**' \
2022-08-26 18:11:38 +00:00
-ignore 'ignoreme'
2021-08-30 16:44:09 +00:00
.PHONY : lint -license
lint-license : $( ADDLICENSE )
$( ADDLICENSE) $( ADDLICENSE_ARGS) -check * 2>/dev/null
.PHONY : fix -license
fix-license : $( ADDLICENSE )
$( ADDLICENSE) $( ADDLICENSE_ARGS) * 2>/dev/null
$(ADDLICENSE) :
cd && go install github.com/google/addlicense@v1.0.0
2022-09-07 10:40:04 +00:00
# This rule updates version files and Helm snapshots based on the Makefile
# VERSION variable.
#
# Used prior to a release by bumping VERSION in this Makefile and then
# running "make update-version".
.PHONY : update -version
update-version : version test -helm -update -snapshots
2021-06-18 18:52:55 +00:00
# This rule triggers re-generation of version files if Makefile changes.
.PHONY : version
2022-09-07 10:40:04 +00:00
version : $( VERSRC )
2021-06-18 18:52:55 +00:00
# This rule triggers re-generation of version files specified if Makefile changes.
2017-01-25 03:36:30 +00:00
$(VERSRC) : Makefile
2016-12-31 08:13:41 +00:00
VERSION = $( VERSION) $( MAKE) -f version.mk setver
2016-06-13 18:27:19 +00:00
2016-06-15 17:50:45 +00:00
# make tag - prints a tag to use with git for the current version
# To put a new release on Github:
# - bump VERSION variable
# - run make setver
# - commit changes to git
# - build binaries with 'make release'
# - run `make tag` and use its output to 'git tag' and 'git push --tags'
2021-07-23 02:31:53 +00:00
.PHONY : update -tag
update-tag :
@test $( VERSION)
git tag $( GITTAG)
git tag api/$( GITTAG)
2023-01-04 23:28:50 +00:00
( cd e && git tag $( GITTAG) && git push origin $( GITTAG) )
2021-07-23 02:31:53 +00:00
git push origin $( GITTAG) && git push origin api/$( GITTAG)
2016-03-23 00:03:58 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : test -package
test-package : remove -temp -files
2021-04-01 17:12:53 +00:00
go test -v ./$( p)
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : test -grep -package
test-grep-package : remove -temp -files
2021-04-01 17:12:53 +00:00
go test -v ./$( p) -check.f= $( e)
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : cover -package
2015-05-04 15:28:32 +00:00
cover-package : remove -temp -files
2021-04-01 17:12:53 +00:00
go test -v ./$( p) -coverprofile= /tmp/coverage.out
go tool cover -html= /tmp/coverage.out
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : profile
2015-03-02 20:11:23 +00:00
profile :
2021-04-01 17:12:53 +00:00
go tool pprof http://localhost:6060/debug/pprof/profile
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : sloccount
2015-03-02 20:11:23 +00:00
sloccount :
2022-01-04 22:51:57 +00:00
find . -o -name "*.go" -print0 | xargs -0 wc -l
2015-05-14 01:40:39 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : remove -temp -files
remove-temp-files :
find . -name flymake_* -delete
2016-10-09 23:00:20 +00:00
2022-12-20 05:25:56 +00:00
#
# print-go-version outputs Go version as a semver without "go" prefix
#
.PHONY : print -go -version
print-go-version :
@$( MAKE) -C build.assets print-go-version | sed "s/go//"
2020-04-25 00:54:49 +00:00
# Dockerized build: useful for making Linux releases on OSX
2016-10-09 23:00:20 +00:00
.PHONY : docker
docker :
2020-04-25 00:54:49 +00:00
make -C build.assets build
2021-12-07 15:46:08 +00:00
# Dockerized build: useful for making Linux binaries on macOS
2020-04-25 00:54:49 +00:00
.PHONY : docker -binaries
2020-07-20 20:18:00 +00:00
docker-binaries : clean
2022-12-12 19:56:19 +00:00
make -C build.assets build-binaries PIV = $( PIV)
2016-12-21 00:39:11 +00:00
# Interactively enters a Docker container (which you can build and run Teleport inside of)
.PHONY : enter
enter :
make -C build.assets enter
2017-05-27 01:03:19 +00:00
2022-04-22 10:50:24 +00:00
# Interactively enters a Docker container, as root (which you can build and run Teleport inside of)
.PHONY : enter -root
enter-root :
make -C build.assets enter-root
2022-04-18 14:07:10 +00:00
# Interactively enters a Docker container (which you can build and run Teleport inside of).
# Similar to `enter`, but uses the centos7 container.
.PHONY : enter /centos 7
enter/centos7 :
make -C build.assets enter/centos7
2022-08-23 19:57:22 +00:00
# Interactively enters a Docker container (which you can build and run Teleport Connect inside of).
# Similar to `enter`, but uses the teleterm container.
.PHONY : enter /teleterm
enter/teleterm :
make -C build.assets enter/teleterm
2022-08-29 20:54:32 +00:00
BUF := buf
# protos/all runs build, lint and format on all protos.
# Use `make grpc` to regenerate protos inside buildbox.
.PHONY : protos /all
protos/all : protos /build protos /lint protos /format
.PHONY : protos /build
protos/build : buf /installed
$( BUF) build
.PHONY : protos /format
protos/format : buf /installed
$( BUF) format -w
.PHONY : protos /lint
protos/lint : buf /installed
$( BUF) lint
2023-01-09 11:31:35 +00:00
$( BUF) lint --config= api/proto/buf-legacy.yaml api/proto
2022-08-29 20:54:32 +00:00
.PHONY : lint -protos
lint-protos : protos /lint
.PHONY : buf /installed
buf/installed :
@if ! type -p $( BUF) >/dev/null; then \
echo 'Buf is required to build/format/lint protos. Follow https://docs.buf.build/installation.' ; \
exit 1; \
fi
2021-12-07 15:46:08 +00:00
# grpc generates GRPC stubs from service definitions.
2022-01-20 01:05:25 +00:00
# This target runs in the buildbox container.
2017-05-27 01:03:19 +00:00
.PHONY : grpc
2021-03-10 19:16:08 +00:00
grpc :
2021-10-28 17:15:47 +00:00
$( MAKE) -C build.assets grpc
2017-05-27 01:03:19 +00:00
2022-08-26 18:11:38 +00:00
# grpc/host generates GRPC stubs.
# Unlike grpc, this target runs locally.
.PHONY : grpc /host
2022-08-29 20:54:32 +00:00
grpc/host : protos /all
2022-08-26 18:11:38 +00:00
@build.assets/genproto.sh
2022-02-22 19:39:35 +00:00
print/env :
env
2022-01-26 21:07:42 +00:00
2022-02-25 11:54:01 +00:00
# grpc-teleterm generates Go, TypeScript and JavaScript gRPC stubs from definitions for Teleport
# Terminal. This target runs in the buildbox-teleterm container.
#
# It exists as a separate target because on M1 MacBooks we must build grpc_node_plugin from source.
# That involves apt-get install of cmake & build-essential as well pulling hundreds of megabytes of
# git repos. It would significantly increase the time it takes to build buildbox for M1 users that
# don't need to generate Teleterm gRPC files.
# TODO(ravicious): incorporate grpc-teleterm into grpc once grpc-tools adds arm64 binary.
# https://github.com/grpc/grpc-node/issues/1405
.PHONY : grpc -teleterm
grpc-teleterm :
$( MAKE) -C build.assets grpc-teleterm
2022-08-26 18:11:38 +00:00
# grpc-teleterm/host generates GRPC stubs.
# Unlike grpc-teleterm, this target runs locally.
.PHONY : grpc -teleterm /host
2022-08-29 20:54:32 +00:00
grpc-teleterm/host : protos /all
2023-01-10 17:17:21 +00:00
$( BUF) generate --template= lib/prehog/buf-teleterm.gen.yaml lib/prehog/proto
2023-01-09 11:31:35 +00:00
$( BUF) generate --template= lib/teleterm/buf.gen.yaml lib/teleterm/api/proto
2022-01-24 19:16:05 +00:00
2017-09-17 23:24:11 +00:00
.PHONY : goinstall
goinstall :
2021-04-01 17:12:53 +00:00
go install $( BUILDFLAGS) \
2017-09-17 23:24:11 +00:00
github.com/gravitational/teleport/tool/tsh \
github.com/gravitational/teleport/tool/teleport \
github.com/gravitational/teleport/tool/tctl
2018-02-24 01:23:09 +00:00
# make install will installs system-wide teleport
2017-09-17 23:24:11 +00:00
.PHONY : install
install : build
@echo "\n** Make sure to run 'make install' as root! **\n"
cp -f $( BUILDDIR) /tctl $( BINDIR) /
cp -f $( BUILDDIR) /tsh $( BINDIR) /
cp -f $( BUILDDIR) /teleport $( BINDIR) /
mkdir -p $( DATADIR)
2020-04-25 00:54:49 +00:00
# Docker image build. Always build the binaries themselves within docker (see
# the "docker" rule) to avoid dependencies on the host libc version.
2018-05-19 23:58:14 +00:00
.PHONY : image
2022-10-31 18:00:55 +00:00
image : OS =linux
image : TARBALL_PATH_SECTION :=-s "$( shell pwd ) "
image : clean docker -binaries build -archive oss -deb
2018-06-20 23:36:54 +00:00
cp ./build.assets/charts/Dockerfile $( BUILDDIR) /
2022-10-31 18:00:55 +00:00
cd $( BUILDDIR) && docker build --no-cache . -t $( DOCKER_IMAGE) :$( VERSION) -$( ARCH) --target teleport \
--build-arg DEB_PATH = " ./teleport_ $( VERSION) _ $( ARCH) .deb "
2022-12-12 19:56:19 +00:00
if [ -f e/Makefile ] ; then $( MAKE) -C e image PIV = $( PIV) ; fi
2018-05-19 23:58:14 +00:00
.PHONY : print -version
print-version :
@echo $( VERSION)
.PHONY : chart -ent
chart-ent :
$( MAKE) -C e chart
2019-07-12 17:47:59 +00:00
RUNTIME_SECTION ?=
TARBALL_PATH_SECTION ?=
i f n e q ( "$(RUNTIME)" , "" )
RUNTIME_SECTION := -r $( RUNTIME)
e n d i f
i f n e q ( "$(OSS_TARBALL_PATH)" , "" )
TARBALL_PATH_SECTION := -s $( OSS_TARBALL_PATH)
e n d i f
# build .pkg
.PHONY : pkg
pkg :
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-06-17 15:05:39 +00:00
cp ./build.assets/build-package.sh ./build.assets/build-common.sh $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
chmod +x $( BUILDDIR) /build-package.sh
# arch and runtime are currently ignored on OS X
# we pass them through for consistency - they will be dropped by the build script
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p pkg -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
if [ -f e/Makefile ] ; then $( MAKE) -C e pkg; fi
2019-12-20 00:42:50 +00:00
# build tsh client-only .pkg
.PHONY : pkg -tsh
pkg-tsh :
2022-05-23 20:56:21 +00:00
./build.assets/build-pkg-tsh.sh -t oss -v $( VERSION) $( TARBALL_PATH_SECTION)
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-05-23 20:56:21 +00:00
mv tsh*.pkg* $( BUILDDIR) /
2019-12-20 00:42:50 +00:00
2019-07-12 17:47:59 +00:00
# build .rpm
.PHONY : rpm
rpm :
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-06-17 15:05:39 +00:00
cp ./build.assets/build-package.sh ./build.assets/build-common.sh $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
chmod +x $( BUILDDIR) /build-package.sh
2021-05-31 16:52:30 +00:00
cp -a ./build.assets/rpm $( BUILDDIR) /
2020-10-31 18:27:00 +00:00
cp -a ./build.assets/rpm-sign $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p rpm -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
if [ -f e/Makefile ] ; then $( MAKE) -C e rpm; fi
2020-10-31 18:27:00 +00:00
# build unsigned .rpm (for testing)
.PHONY : rpm -unsigned
rpm-unsigned :
$( MAKE) UNSIGNED_RPM = true rpm
2022-10-31 18:00:55 +00:00
# build open source .deb only
.PHONY : oss -deb
oss-deb :
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-06-17 15:05:39 +00:00
cp ./build.assets/build-package.sh ./build.assets/build-common.sh $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
chmod +x $( BUILDDIR) /build-package.sh
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p deb -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
2022-10-31 18:00:55 +00:00
# build .deb
.PHONY : deb
deb : oss -deb
2019-07-12 17:47:59 +00:00
if [ -f e/Makefile ] ; then $( MAKE) -C e deb; fi
2022-07-26 21:31:35 +00:00
# check binary compatibility with different OSes
.PHONY : test -compat
test-compat :
./build.assets/build-test-compat.sh
2020-04-15 19:35:26 +00:00
.PHONY : ensure -webassets
ensure-webassets :
@if [ ! -d $( shell pwd ) /webassets/teleport/ ] ; then \
2023-01-18 22:22:25 +00:00
$( MAKE) build-ui; \
2020-04-15 19:35:26 +00:00
fi ;
.PHONY : ensure -webassets -e
ensure-webassets-e :
@if [ ! -d $( shell pwd ) /webassets/e/teleport ] ; then \
2023-01-18 22:22:25 +00:00
$( MAKE) build-ui-e; \
2020-04-15 19:35:26 +00:00
fi ;
.PHONY : init -submodules -e
2023-01-18 22:22:25 +00:00
init-submodules-e :
2020-04-15 19:35:26 +00:00
git submodule init e
2020-04-17 15:57:10 +00:00
git submodule update
2020-07-10 23:42:09 +00:00
2021-03-23 01:32:45 +00:00
# dronegen generates .drone.yml config
2022-08-23 19:57:22 +00:00
#
# Usage:
# - tsh login --proxy=platform.teleport.sh
# - tsh app login drone
2023-01-05 15:46:56 +00:00
# - set $DRONE_TOKEN and $DRONE_SERVER (http://localhost:8080)
# - tsh proxy app --port=8080 drone
2022-08-23 19:57:22 +00:00
# - make dronegen
2021-03-23 01:32:45 +00:00
.PHONY : dronegen
dronegen :
go run ./dronegen
2022-02-01 20:07:23 +00:00
# backport will automatically create backports for a given PR as long as you have the "gh" tool
# installed locally. To backport, type "make backport PR=1234 TO=branch/1,branch/2".
.PHONY : backport
backport :
2022-02-15 01:19:33 +00:00
( cd ./assets/backport && go run main.go -pr= $( PR) -to= $( TO) )
2023-01-18 22:22:25 +00:00
.PHONY : ensure -js -deps
ensure-js-deps :
yarn install --ignore-scripts
.PHONY : build -ui
build-ui : ensure -js -deps
yarn build-ui-oss
.PHONY : build -ui -e
build-ui-e : ensure -js -deps
yarn build-ui-e
.PHONY : docker -ui
docker-ui :
$( MAKE) -C build.assets ui