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-04-18 06:49:34 +00:00
VERSION = 14.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)
2023-01-31 20:06:00 +00:00
# This directory will be the real path of the directory of the first Makefile in the list.
MAKE_DIR := $( dir $( realpath $( firstword $( MAKEFILE_LIST) ) ) )
2023-02-16 18:32:03 +00:00
# If set to 1, webassets are not built.
WEBASSETS_SKIP_BUILD ?= 0
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 `
2023-02-02 05:54:20 +00:00
GIT ?= git
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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# RELEASE_DIR is where the release artifacts (tarballs, pacakges, etc) are put. It
# should be an absolute directory as it is used by e/Makefile too, from the e/ directory.
RELEASE_DIR := $( CURDIR) /$( BUILDDIR) /artifacts
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
2023-05-09 12:38:52 +00:00
GO_ENV_OS := $( shell go env GOOS)
OS ?= $( GO_ENV_OS)
GO_ENV_ARCH := $( shell go env GOARCH)
ARCH ?= $( GO_ENV_ARCH)
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
2023-03-01 19:12:54 +00:00
# Include common makefile shared between OSS and Ent.
i n c l u d e c o m m o n . m k
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
2023-01-25 20:46:31 +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
2023-01-25 20:46:31 +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
2023-01-25 20:46:31 +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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# darwin universal (Intel + Apple Silicon combined) binary support
RELEASE_darwin_arm64 = $( RELEASE_DIR) /teleport-$( GITTAG) -darwin-arm64-bin.tar.gz
RELEASE_darwin_amd64 = $( RELEASE_DIR) /teleport-$( GITTAG) -darwin-amd64-bin.tar.gz
BUILDDIR_arm64 = $( BUILDDIR) /arm64
BUILDDIR_amd64 = $( BUILDDIR) /amd64
# TARBINS is the path of the binaries in the release tarballs
TARBINS = $( addprefix teleport/,$( BINS) )
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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
RUST_TARGET_ARCH ?= $( CARGO_TARGET_$( OS) _$( ARCH) )
2023-04-04 19:32:02 +00:00
# Have cargo use sparse crates.io protocol:
# https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html
# TODO: Delete when it becomes default in Rust 1.70.0
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL = sparse
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 } }
2023-05-18 18:00:06 +00:00
# If set to 1, Windows RDP client is not built.
RDPCLIENT_SKIP_BUILD ?= 0
# Enable Windows RDP client build?
with_rdpclient := no
RDPCLIENT_MESSAGE := without-Windows-RDP-client
i f e q ( $( RDPCLIENT_SKIP_BUILD ) , 0 )
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
2023-01-25 20:46:31 +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
2023-05-18 18:00:06 +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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# Set C_ARCH for building libfido2 and dependencies. ARCH is the Go
# architecture which uses different names for architectures than C
# uses. Export it for the build.assets/build-fido2-macos.sh script.
C_ARCH_amd64 = x86_64
C_ARCH = $( or $( C_ARCH_$( ARCH) ) ,$( ARCH) )
export C_ARCH
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.
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
BINS_default = teleport tctl tsh tbot
BINS_windows = tsh
BINS = $( or $( BINS_$( OS) ) ,$( BINS_default) )
BINARIES = $( addprefix $( BUILDDIR) /,$( BINS) )
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-09-22 23:16:51 +00:00
# Set CGOFLAG and BUILDFLAGS as needed for the OS/ARCH.
i f e q ( "$(OS)" , "linux" )
2023-02-23 17:11:50 +00:00
# True if $ARCH == amd64 || $ARCH == arm64
2023-03-01 19:12:54 +00:00
i f e q ( "$(ARCH)" , "arm64" )
ifeq ( $( IS_NATIVE_BUILD) ,"no" )
CGOFLAG += CC = aarch64-linux-gnu-gcc
2023-02-23 18:44:33 +00:00
endif
2022-09-22 23:16:51 +00:00
e l s e i f e q ( "$(ARCH)" , "arm" )
2023-04-04 19:32:02 +00:00
CGOFLAG = CGO_ENABLED = 1
2023-03-14 18:00:20 +00:00
2022-09-22 23:16:51 +00:00
# ARM builds need to specify the correct C compiler
2023-03-14 18:00:20 +00:00
i f e q ( $( IS_NATIVE_BUILD ) , "no" )
CC = arm-linux-gnueabihf-gcc
e n d i f
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 n d i f
2023-02-23 18:44:33 +00:00
e n d i f # OS == linux
2022-09-22 23:16:51 +00:00
# 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)
2023-05-05 02:09:37 +00:00
# Map ARCH into the architecture flag for electron-builder if they
# are different to the Go $(ARCH) we use as an input.
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
ELECTRON_BUILDER_ARCH_amd64 = x64
2023-05-05 02:09:37 +00:00
ELECTRON_BUILDER_ARCH = $( or $( ELECTRON_BUILDER_ARCH_$( ARCH) ) ,$( ARCH) )
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
2016-01-17 18:28:34 +00:00
#
2023-02-10 19:15:54 +00:00
# 'make all' builds all 4 executables and places them in the current directory.
2018-02-24 01:23:09 +00:00
#
2023-02-10 19:15:54 +00:00
# NOTE: Works the same as `make`. Left for legacy reasons.
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
2023-02-10 19:15:54 +00:00
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " webassets_embed $( 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 )
2023-02-13 14:15:54 +00:00
$( CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$( KERNEL_ARCH) -I/usr/libbpf-${ LIBBPF_VER } /include $( INCLUDES) $( CLANG_BPF_SYS_INCLUDES) -c $( filter %.c,$^) -o $@
2021-04-09 23:20:56 +00:00
$( 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 )
2023-02-13 14:15:54 +00:00
$( CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$( KERNEL_ARCH) -I/usr/libbpf-${ LIBBPF_VER } /include $( INCLUDES) $( CLANG_BPF_SYS_INCLUDES) -c $( filter %.c,$^) -o $@
2021-07-14 20:27:53 +00:00
$( 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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# Build libfido2 and dependencies for MacOS. Uses exported C_ARCH variable defined earlier.
.PHONY : build -fido 2
build-fido2 :
./build.assets/build-fido2-macos.sh build
.PHONY : print -fido 2-pkg -path
print-fido2-pkg-path :
@./build.assets/build-fido2-macos.sh pkg_config_path
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
2023-02-16 18:32:03 +00:00
full : WEBASSETS_SKIP_BUILD = 0
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" )
2023-02-16 18:32:03 +00:00
export WEBASSETS_SKIP_BUILD = 0
2023-02-10 19:15:54 +00:00
$( MAKE) all
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
#
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# RELEASE_DIR is where release artifact files are put, such as tarballs, packages, etc.
$(RELEASE_DIR) :
mkdir $@
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: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
build-archive : | $( RELEASE_DIR )
2018-09-27 01:21:45 +00:00
@echo "---> Creating OSS release archive."
2017-09-17 23:24:11 +00:00
mkdir teleport
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
cp -rf $( BINARIES) \
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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
cp $( RELEASE) .tar.gz $( RELEASE_DIR)
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-03-27 03:11:35 +00:00
i n c l u d e d a r w i n - s i g n i n g . m k
2023-01-12 04:58:50 +00:00
.PHONY : release -darwin -unsigned
release-darwin-unsigned : RELEASE :=$( RELEASE ) -unsigned
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
release-darwin-unsigned : full build -archive
2023-01-12 04:58:50 +00:00
.PHONY : release -darwin
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
i f n e q ( $( ARCH ) , u n i v e r s a l )
2023-01-12 04:58:50 +00:00
release-darwin : ABSOLUTE_BINARY_PATHS :=$( addprefix $ ( CURDIR ) /,$ ( BINARIES ) )
release-darwin : release -darwin -unsigned
2023-03-27 18:07:02 +00:00
$( NOTARIZE_BINARIES)
2023-01-12 04:58:50 +00:00
$( MAKE) build-archive
@if [ -f e/Makefile ] ; then $( MAKE) -C e release; fi
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
e l s e
# release-darwin for ARCH == universal does not build binaries, but instead
# combines previously-built binaries. For this, it depends on the ARM64 and
# AMD64 signed tarballs being built into $(RELEASE_DIR). The dependencies
# expressed here will not make that happen as this is typically done on CI
# where these two tarballs are built in separate pipelines, and copied in for
# the universal build.
#
# For local manual runs, create these tarballs with:
# make ARCH=arm64 release-darwin
# make ARCH=amd64 release-darwin
# Ensure you have the rust toolchains for these installed by running
# make ARCH=arm64 rustup-install-target-toolchain
# make ARCH=amd64 rustup-install-target-toolchain
release-darwin : $( RELEASE_darwin_arm 64) $( RELEASE_darwin_amd 64)
mkdir -p $( BUILDDIR_arm64) $( BUILDDIR_amd64)
tar -C $( BUILDDIR_arm64) -xzf $( RELEASE_darwin_arm64) --strip-components= 1 $( TARBINS)
tar -C $( BUILDDIR_amd64) -xzf $( RELEASE_darwin_amd64) --strip-components= 1 $( TARBINS)
lipo -create -output $( BUILDDIR) /teleport $( BUILDDIR_arm64) /teleport $( BUILDDIR_amd64) /teleport
lipo -create -output $( BUILDDIR) /tctl $( BUILDDIR_arm64) /tctl $( BUILDDIR_amd64) /tctl
lipo -create -output $( BUILDDIR) /tsh $( BUILDDIR_arm64) /tsh $( BUILDDIR_amd64) /tsh
lipo -create -output $( BUILDDIR) /tbot $( BUILDDIR_arm64) /tbot $( BUILDDIR_amd64) /tbot
$( MAKE) ARCH = universal build-archive
@if [ -f e/Makefile ] ; then $( MAKE) -C e release; fi
e n d i f
2023-01-12 04:58:50 +00:00
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
2023-03-29 04:41:50 +00:00
#
# make release-connect produces a release package of Teleport Connect.
# It is used only for MacOS releases. Windows releases do not use this
# Makefile. Linux uses the `teleterm` target in build.assets/Makefile.
#
# Only export the CSC_NAME (developer key ID) when the recipe is run, so
# that we do not shell out and run the `security` command if not necessary.
#
# Either CONNECT_TSH_BIN_PATH or CONNECT_TSH_APP_PATH environment variable
# should be defined for the `yarn package-term` command to succeed. CI sets
# this appropriately depending on whether a push build is running, or a
# proper release (a proper release needs the APP_PATH as that points to
# the complete signed package). See web/packages/teleterm/README.md for
# details.
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
2023-03-29 04:41:50 +00:00
.PHONY : release -connect
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
release-connect : | $( RELEASE_DIR )
2023-03-29 04:41:50 +00:00
$( eval export CSC_NAME)
yarn install --frozen-lockfile
yarn build-term
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
yarn package-term -c.extraMetadata.version= $( VERSION) --$( ELECTRON_BUILDER_ARCH)
# Only copy proper builds with tsh.app to $(RELEASE_DIR)
# Drop -universal "arch" from dmg name when copying to $(RELEASE_DIR)
if [ -n " $$ CONNECT_TSH_APP_PATH " ] ; then \
TARGET_NAME = " Teleport Connect- $( VERSION) - $( ARCH) .dmg " ; \
if [ " $( ARCH) " = 'universal' ] ; then \
TARGET_NAME = " $$ {TARGET_NAME/-universal/} " ; \
fi ; \
cp web/packages/teleterm/build/release/" Teleport Connect- $( VERSION) - $( ELECTRON_BUILDER_ARCH) .dmg " " $( RELEASE_DIR) / $$ {TARGET_NAME} " ; \
fi
2023-03-29 04:41:50 +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
2023-06-09 02:38:22 +00:00
RERUN := $( TOOLINGDIR) /bin/rerun
$(RERUN) : $( wildcard $ ( TOOLINGDIR ) /cmd /rerun /*.go )
cd $( TOOLINGDIR) && go build -o " $@ " ./cmd/rerun
2023-01-18 18:29:10 +00:00
.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
2023-03-22 19:39:07 +00:00
test-go-unit : SUBJECT ?= $( shell go list ./... | grep -v -e integration -e tool /tsh -e integrations /operator -e integrations /access -e integrations /lib )
2023-01-18 18:29:10 +00:00
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
2023-06-07 19:02:10 +00:00
test-go-tsh : SUBJECT ?= github .com /gravitational /teleport /tool /tsh /...
2023-01-18 18:29:10 +00:00
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
2023-03-06 17:59:02 +00:00
test-go-root : PACKAGES = $( shell go list $ ( ADDFLAGS ) ./... | grep -v -e integration -e integrations /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 :
2023-03-06 17:59:02 +00:00
make -C integrations/operator test
2023-03-06 18:40:28 +00:00
#
# Runs Go tests on the integrations/kube-agent-updater module. These have to be run separately as the package name is different.
#
.PHONY : test -kube -agent -updater
test-kube-agent-updater : $( VERSRC ) $( TEST_LOG_DIR ) $( RENDER_TESTS )
test-kube-agent-updater : FLAGS ?= -race -shuffle on
test-kube-agent-updater : SUBJECT ?= $( shell cd integrations /kube -agent -updater && go list ./...)
test-kube-agent-updater :
cd integrations/kube-agent-updater && $( CGOFLAG) go test -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) " $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
| tee $( TEST_LOG_DIR) /kube-agent-updater.json \
| ${ RENDER_TESTS }
2022-06-09 09:16:52 +00:00
2023-03-22 19:39:07 +00:00
.PHONY : test -access -integrations
test-access-integrations :
make -C integrations test-access
.PHONY : test -integrations -lib
test-integrations-lib :
make -C integrations test-lib
2023-03-22 16:36:21 +00:00
#
# Runs Go tests on the examples/teleport-usage module. These have to be run separately as the package name is different.
#
.PHONY : test -teleport -usage
test-teleport-usage : $( VERSRC ) $( TEST_LOG_DIR ) $( RENDER_TESTS )
test-teleport-usage : FLAGS ?= -race -shuffle on
test-teleport-usage : SUBJECT ?= $( shell cd examples /teleport -usage && go list ./...)
test-teleport-usage :
cd examples/teleport-usage && $( CGOFLAG) go test -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) " $( PACKAGES) $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
| tee $( TEST_LOG_DIR) /teleport-usage.json \
| ${ RENDER_TESTS }
2023-06-09 02:38:22 +00:00
#
# Flaky test detection. Usually run from CI nightly, overriding these default parameters
# This runs the same tests as test-go-unit but repeatedly to try to detect flaky tests.
#
.PHONY : test -go -flaky
FLAKY_RUNS ?= 3
FLAKY_TIMEOUT ?= 1h
FLAKY_TOP_N ?= 20
FLAKY_SUMMARY_FILE ?= /tmp/flaky-report.txt
test-go-flaky : FLAGS ?= -race -shuffle on
test-go-flaky : SUBJECT ?= $( shell go list ./... | grep -v -e integration -e tool /tsh -e integrations /operator -e integrations /access -e integrations /lib )
test-go-flaky : GO_BUILD_TAGS ?= $( PAM_TAG ) $( FIPS_TAG ) $( BPF_TAG ) $( RDPCLIENT_TAG ) $( TOUCHID_TAG ) $( PIV_TEST_TAG )
test-go-flaky : RENDER_FLAGS ?= -report -by flakiness -summary -file $( FLAKY_SUMMARY_FILE ) -top $( FLAKY_TOP_N )
test-go-flaky : test -go -prepare $( RERUN )
$( CGOFLAG) $( RERUN) -n $( FLAKY_RUNS) -t $( FLAKY_TIMEOUT) \
go test -count= 1 -cover -json -tags " $( GO_BUILD_TAGS) " $( SUBJECT) $( FLAGS) $( ADDFLAGS) \
| $( RENDER_TESTS) $( RENDER_FLAGS)
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
2023-03-22 19:39:07 +00:00
integration : PACKAGES = $( shell go list ./... | grep 'integration \( [^s ]\|$ $ \) ' | grep -v integrations /lib /testing /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
2023-05-12 16:38:16 +00:00
#
# Integration tests that run Kubernetes tests in order to complete successfully
# are run separately to all other integration tests.
#
INTEGRATION_KUBE_REGEX := TestKube.*
.PHONY : integration -kube
integration-kube : FLAGS ?= -v -race
integration-kube : PACKAGES = $( shell go list ./... | grep 'integration \( [^s ]\|$ $ \) ')
integration-kube : $( TEST_LOG_DIR ) $( RENDER_TESTS )
@echo KUBECONFIG is: $( KUBECONFIG) , TEST_KUBE: $( TEST_KUBE)
$( CGOFLAG) go test -json -run " $( INTEGRATION_KUBE_REGEX) " $( PACKAGES) $( FLAGS) \
| tee $( TEST_LOG_DIR) /integration-kube.json \
| $( RENDER_TESTS) -report-by test
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
2023-03-06 17:59:02 +00:00
integration-root : PACKAGES = $( shell go list ./... | grep 'integration \( [^s ]\|$ $ \) ')
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
2023-03-22 13:05:02 +00:00
lint : lint -sh lint -helm lint -api lint -kube -agent -updater 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
2023-03-10 15:35:47 +00:00
gci write -s standard -s default -s '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)
2023-03-22 13:05:02 +00:00
.PHONY : lint -kube -agent -updater
lint-kube-agent-updater : GO_LINT_API_FLAGS ?=
lint-kube-agent-updater :
cd integrations/kube-agent-updater && 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 :
2023-05-28 22:50:35 +00:00
find . -type f \( -name '*.sh' -or -name '*.sh.tmpl' \) -not -path "*/node_modules/*" | xargs \
2020-09-28 23:04:42 +00:00
shellcheck \
2020-10-07 17:00:02 +00:00
--exclude= SC2086 \
2023-06-05 23:11:56 +00:00
--exclude= SC1091 \
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' \
2023-05-18 23:22:14 +00:00
-ignore '**/*.sql' \
2021-08-30 16:44:09 +00:00
-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/**' \
2023-02-03 14:47:06 +00:00
-ignore 'gen/**' \
2021-08-30 16:44:09 +00:00
-ignore 'gitref.go' \
2022-08-26 18:11:38 +00:00
-ignore 'lib/srv/desktop/rdp/rdpclient/target/**' \
-ignore 'lib/web/build/**' \
2021-08-30 16:44:09 +00:00
-ignore 'version.go' \
-ignore 'webassets/**' \
2023-02-07 16:27:31 +00:00
-ignore '**/node_modules/**' \
-ignore 'web/packages/design/src/assets/icomoon/style.css' \
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
2023-04-02 16:50:57 +00:00
update-tag : TAG_REMOTE ?= origin
2021-07-23 02:31:53 +00:00
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) )
2023-04-02 16:50:57 +00:00
git push $( TAG_REMOTE) $( GITTAG) && git push $( TAG_REMOTE) 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
2023-05-22 21:32:46 +00:00
.PHONY : enter /grpcbox
enter/grpcbox :
make -C build.assets enter/grpcbox
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
2023-05-30 20:19:12 +00:00
.PHONY : protos /breaking
protos/breaking : BASE =origin /master
protos/breaking : buf /installed
@echo Checking compatibility against BASE = $( BASE)
buf breaking . --against '.git#branch=$(BASE)'
2022-08-29 20:54:32 +00:00
.PHONY : lint -protos
lint-protos : protos /lint
2023-05-30 20:19:12 +00:00
.PHONY : lint -breaking
lint-breaking : protos /breaking
2022-08-29 20:54:32 +00:00
.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
2023-02-02 05:54:20 +00:00
# protos-up-to-date checks if the generated GRPC stubs are up to date.
# This target runs in the buildbox container.
.PHONY : protos -up -to -date
protos-up-to-date :
$( MAKE) -C build.assets protos-up-to-date
# protos-up-to-date/host checks if the generated GRPC stubs are up to date.
# Unlike protos-up-to-date, this target runs locally.
.PHONY : protos -up -to -date /host
protos-up-to-date/host : must -start -clean /host grpc /host
@if ! $( GIT) diff --quiet; then \
echo 'Please run make grpc.' ; \
exit 1; \
fi
.PHONY : must -start -clean /host
must-start-clean/host :
@if ! $( GIT) diff --quiet; then \
echo 'This must be run from a repo with no unstaged commits.' ; \
exit 1; \
fi
2022-02-22 19:39:35 +00:00
print/env :
env
2022-01-26 21:07:42 +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 \
2023-02-02 08:28:09 +00:00
github.com/gravitational/teleport/tool/tctl \
github.com/gravitational/teleport/tool/tbot
2017-09-17 23:24:11 +00:00
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) /
2023-02-02 08:28:09 +00:00
cp -f $( BUILDDIR) /tbot $( BINDIR) /
2017-09-17 23:24:11 +00:00
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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
pkg : | $( RELEASE_DIR )
2023-03-27 03:11:35 +00:00
$( eval export DEVELOPER_ID_APPLICATION DEVELOPER_ID_INSTALLER)
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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# runtime is currently ignored on OS X
# we pass it through for consistency - it will be dropped by the build script
2023-04-03 00:30:48 +00:00
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p pkg -b $( TELEPORT_BUNDLEID) -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
cp $( BUILDDIR) /teleport-*.pkg $( RELEASE_DIR)
2019-07-12 17:47:59 +00:00
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
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
pkg-tsh : | $( RELEASE_DIR )
2023-03-27 03:11:35 +00:00
$( eval export DEVELOPER_ID_APPLICATION DEVELOPER_ID_INSTALLER)
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
./build.assets/build-pkg-tsh.sh -t oss -v $( VERSION) -b $( TSH_BUNDLEID) -a $( ARCH) $( 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) /
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
cp $( BUILDDIR) /tsh-*.pkg $( RELEASE_DIR)
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 :
2023-03-03 15:14:25 +00:00
@if [ [ " ${ WEBASSETS_SKIP_BUILD } " -eq 1 ] ] ; then mkdir -p webassets/teleport && mkdir -p webassets/teleport/app && cp web/packages/build/index.ejs webassets/teleport/index.html; \
2023-02-16 18:32:03 +00:00
else MAKE = " $( MAKE) " " $( MAKE_DIR) /build.assets/build-webassets-if-changed.sh " OSS webassets/oss-sha build-ui web; fi
2020-04-15 19:35:26 +00:00
.PHONY : ensure -webassets -e
ensure-webassets-e :
2023-03-03 15:14:25 +00:00
@if [ [ " ${ WEBASSETS_SKIP_BUILD } " -eq 1 ] ] ; then mkdir -p webassets/teleport && mkdir -p webassets/e/teleport/app && cp web/packages/build/index.ejs webassets/e/teleport/index.html; \
2023-02-16 18:32:03 +00:00
else MAKE = " $( MAKE) " " $( MAKE_DIR) /build.assets/build-webassets-if-changed.sh " Enterprise webassets/e/e-sha build-ui-e web e/web; fi
2020-04-15 19:35:26 +00:00
.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
2023-02-10 21:40:55 +00:00
# - tsh apps 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 :
2023-02-16 18:32:03 +00:00
@if [ [ " ${ WEBASSETS_SKIP_BUILD } " -eq 1 ] ] ; then mkdir -p webassets/teleport && touch webassets/teleport/index.html; \
else yarn install --ignore-scripts; fi
2023-01-18 22:22:25 +00:00
.PHONY : build -ui
build-ui : ensure -js -deps
2023-02-16 18:32:03 +00:00
@[ " ${ WEBASSETS_SKIP_BUILD } " -eq 1 ] || yarn build-ui-oss
2023-01-18 22:22:25 +00:00
.PHONY : build -ui -e
build-ui-e : ensure -js -deps
2023-02-16 18:32:03 +00:00
@[ " ${ WEBASSETS_SKIP_BUILD } " -eq 1 ] || yarn build-ui-e
2023-01-18 22:22:25 +00:00
.PHONY : docker -ui
docker-ui :
$( MAKE) -C build.assets ui
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
# rustup-install-target-toolchain ensures the required rust compiler is
# installed to build for $(ARCH)/$(OS) for the version of rust we use, as
# defined in build.assets/Makefile. It assumes that `rustup` is already
# installed for managing the rust toolchain.
.PHONY : rustup -install -target -toolchain
2023-05-09 22:21:45 +00:00
rustup-install-target-toolchain : RUST_VERSION := $( shell $ ( MAKE ) --no -print -directory -C build .assets print -rust -version )
build: Support arm64 and universal binaries for MacOS (#25460)
* build: Support ARM64 (cross)builds of fido2 et al
Add support for building/cross-building the fido2 libraries (cbor,
openssl and fido2), supporting ARM64 builds. This is done by adding the
appropriate flags to the library builds in `build-fido2-macos.sh` based
on the `C_ARCH` environment variable. If unset then the host
architecture is used. The `Makefile` defined `C_ARCH` based on the
`ARCH` variable, mapping it to an appropriate value for the C compiler.
Building the libraries should now be done through the new `build-fido2`
target, and getting the pkg-config path should be done with the
`print-fido2-pkg-path`. This is instead of calling the
`build-fido2-macos.sh` script directly as the `Makefile` takes care of
setting the `C_ARCH` environment variable appropriately.
* build: Add make target to install rust cross toolchain
Add the `rustup-set-target-toolchain` target to the Makefile to ensure
the right rust toolchain is installed for the version of Rust we use as
well as the target architecture we wish to generate code for, based on
the `ARCH` variable. This is intended to be used by CI jobs to ensure
they build with the correct toolchain.
* build: Support building MacOS packages for ARM64
Remove the restriction that allows only AMD64 packages to be built on
MacOS for the teleport and tsh packages. This is via the existing `-a`
flag to `build-package.sh` and a newly added `-a` flag to
`build-pkg-tsh.sh`.
This adds the architecture to the filename of the package to distinguish
the packages for different architectures.
Update the comments in the Makefile mentioning that `arch` is ignored.
build: add architecture to package names
* build: Build Teleport Connect with target architecture
When packaging Teleport Connect with electron-builder, pass an
architecture flag so that we can cross-build Teleport Connect. This will
allow us to build MacOS ARM64 binaries on the AMD64 runners.
Add the architecture to the `dmg` filename via the electron-builder
config, so that the filenames for different architectures don't clash.
* build: Copy Mac release artifacts to release directory
Copy the Mac release artifacts to a release artifact directory so that
the CI scripts do not have to. This makes it clearer what is and is not
a release artifact and puts the logic in the Makefile instead of the CI
yaml, so it can more easily be tested locally and to make it easier to
migrate to the next CI system.
This will also be useful for building universal binaries for Mac as the
CI system can put the architecture-specific binaries from a previous
workflow job into a common location.
We should look at copying all release artifacts for the other builds
(Linux tarballs and packages, etc) into this directory too. It may help
with unifying the GitHub Actions release workflows.
* build: Add MacOS universal builds
Add support for ARCH=universal on Darwin to produce universal (fat)
binaries from pre-built arm64 and amd64 binaries.
Packages (pkg) and disk images (dmg) for containing universal binaries
are named without an architecture in the filename, as that is the
current naming for the current AMD64-only releases. These universal ones
will replace those AMD64-only ones providing a single release artifact
working across architectures.
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
* build: Do not clean before release-darwin
Remove the `clean` prerequisite from the `release-darwin-unsigned`
target as it is not needed when building on GitHub Actions, as it starts
with a fresh slate each run. We do not make releases manually so we
don't need to ensure a clean working directory there either.
Not doing a clean makes it easier to build a MacOS universal release as
it depends on the architecture-specific tarballs from a previous release
build. We would need to manually save the tarballs from the first
architecture release build as they would get deleted by the `clean` from
the second. So just stop cleaning as it is not needed.
---------
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2023-05-04 20:47:49 +00:00
rustup-install-target-toolchain :
rustup override set $( RUST_VERSION)
rustup target add $( RUST_TARGET_ARCH)