Commit graph

75 commits

Author SHA1 Message Date
fheinecke 633b9582e7
Added multiarch build support for teleport-operator (#16688)
* Added multiarch build support for teleport oss, ent, and fips

* Exported image/imageTag types

* Resigned dronegen

* Removed remainder of testing changes

* Removed changes to submodules

* Reverted dockerfile-fips change

* FIxed docs wording

* Un-exported most constants

* Removed teleport.e makefile deb call

* Moved "sed | cut magic" to files

* Re-added `mkdir -pv /go/cache` to push.go

* Command deterministic order fix

* Added staging-only tag pipeline

* Moved PR to teleport operator to minimize potential issue impact

* Updated promote to pull and push without build

* Made cron triggers not affect canonical tags

* Added check for pre-existing tags on immutable CRs

* Added immutability check to manifests

* Updated staging ecr to only apply $TIMESTAMP tag on cron triggers

* Updated triggerinfo struct to use a triggerflag struct

* Fixed makefile after git mistake

* Makefile fix

* PR fixes

* Moved internal tools Go version to constant

* Separated container images gofile into multiple files

* Moved testing comment

* Added licenses

* Reorganized and added docs for container images

* Moved const to correct file

* Tag trigger logic test

* Testing specific fix

* Moved testing to v10.3.2

* Make semver dirs

* Refactored local registry name/socket

* Merged previous dockerfile changes

* Added TARGETOS TARGETARCH args

* Updatd tag to testing tag

* Promotion logic test

* Promotion fixes

* Testing specific fix

* Removed prerelease check for testing

* Added staging login commands to promote

* Fixed missing credentials on promotion pull

* Rerun tag test with new "full" semver

* Made staging builds only publish full semver

* Added semver logging command

* Empty commit to trigger Drone

* Promotion test

* Fixed preceeding v on promote pull

* Empty commit to trigger Drone

* Re-enabled verify not prerelease step on promote

* Cron trigger test

* Testing fix

* Testing fix 2

* Added sleep timer on docker buildx build

* Testing cleanup
2022-10-19 02:31:22 +00:00
Michael 4d9b78050e
Move enterprise key before Connect binary conditional in mac drone pipe (#17350)
* enterprise key added before connect binary check in pipeline

* updated dronegen

* dronesig
2022-10-12 15:40:45 -05:00
Walt 07cc588735
Fix build-buildboxes timeouts (#17314)
* Refactor build-buildboxes to uses multiple profiles

This greatly reduces the number of steps in the pipeline, allowing drone-runner-kube to successfully schedule the pipeline.

Fixes https://github.com/gravitational/teleport/issues/17310

Furthermore, I also updated un-dronegen'ed pipelines to have same syntax as dronegen'd ones, which is nice for consistency.
2022-10-12 19:59:41 +00:00
Walt 5e5a323ae6
Fix yum repo cleanup (#17334)
Previously, "${ARTIFACT_PATH}" was interpreted as Drone variable
subsitution, resulting in "rm -rf ${ARTIFACT_PATH}/*" becoming
"rm -rf /*", which deleted credentials on the filesystem.
2022-10-12 19:05:54 +00:00
Michael cc1eaf6f75
Add enterprise module support to Connect builds (#17315)
* add windows submodule support for connect builds

* added connect enterprise support to mac builds

* update submodule command

* removed ability to fail webapps.e and recursive

* dronegen
2022-10-12 08:39:53 -05:00
Walt e6e870932e
Add AWS Roles to Drone pipelines (#17274)
This is follow up to #17201, that fixes the buildbox pipeline error seen here:

An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:iam::146628656107:user/teleport_build_user_read_only is not authorized to perform: ecr-public:GetAuthorizationToken on resource: * because no identity-based policy allows the ecr-public:GetAuthorizationToken action

Contributes to gravitational/SecOps#213.
2022-10-11 18:45:04 +00:00
Walt acbf575230
Refactor Drone Pipelines to use AWS role assumption (#17201)
This PR updates our various Drone pipelines to use AWS roles for publishing.

Our AWS FTR requires that we do not use any long lived credentials in our AWS accounts and instead use roles. This means we need to move from attaching policies directly to users to attaching policies to roles and having policyless users assume those roles.

https://aws.amazon.com/partners/foundational-technical-review/

Contributes to https://github.com/gravitational/SecOps/issues/213
2022-10-10 20:32:43 +00:00
Justinas Stankevičius 9515fe88a1
Finalize CI release API integration (#16834)
* Switch to production instance of release server

* Stop ignoring failure in release registration

* Bump relcli to v1.1.70
2022-10-05 12:11:20 +00:00
Walt Della 531bc515ae Fetch tags when promoting rpm/deb
Without this any tag that isn't part of the history on master will fail
to successfully promote.  This breaks most dev builds, which don't end
up as part of master or a release branch.
2022-10-04 14:38:15 -07:00
Walt Della 0bd1d1b3d5 Fix OS package repo promotion issue
Without these changes, the promote step will always fail because of a
mismatch between where the repo is cloned and where it is referenced:

  /go/src/.../teleport.git
vs
  /go/src/.../teleport

(cherry picked from commit b209b98f0d)
2022-10-04 14:38:15 -07:00
Brian Joerger ce20b20753
PIV login enforcement (#15874)
Add private key policy enforcement.

  - Add private key policy cert extensions and enforcement.

  - Add private key policy settings and attestation logic.

  - Wire attestation request through login endpoints.

  - Store attestation data for reissue requests.

  - Add private key policy discovery and logic.

  - Relogin on hardware key policy errors.

  - Include integration with Teleport Connect.
2022-09-30 23:27:48 +00:00
Justinas Stankevičius 2efb0670eb
Clean up old artifacts when retrying a tag build (#16669)
* Port publish-rlz pipeline to dronegen

* Add artifact cleanup pipeline on tag, "before-all"

* Bump relcli in all pipelines

* Add missing license header

* Refactoring to relcli steps per code review

Only functionally-equivalent changes, .drone.yml identical to previous

* Factor out relcli pipeline

* Use docker:cli to pull relcli

* Add "wait for docker" to relcli pipelines
2022-09-28 13:59:33 +03:00
Brian Joerger 7d2bd715c4
Add piv build dependencies (#16424)
* Add piv build dependencies.

  - Add LIBPCSCLITE build tag.

  - Add libpcsclite static linking using gravitational/pcsc fork.

  - Enable use of dynamic pcsc library with LIBPCSCLITE=dynamic.

  - Refactor CGOFLAG in Makefile.

  - Update Centos7 Dockerfile and drone.

* Refactor RELEASE_MESSAGE for readability. Now produces message like: "RELEASE_MESSAGE=Building with GOOS=linux GOARCH=amd64 REPRODUCIBLE= and with PIV support and without PAM support, FIPS support, BPF support, Windows RDP client, libfido2, Touch ID."

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
2022-09-22 23:16:51 +00:00
Justinas Stankevičius c4153b937e
Register Windows native artifacts in release API (#16197)
* Register Windows native artifacts in release API

* Update relcli
2022-09-20 13:42:04 +03:00
Alan Parra a75fcc21d8
Update golangci-lint to 1.49.0 (#16507)
Update metalinter, fix a few lint warnings and replace deprecated linters.

`deadcode`, `structcheck` and `varcheck` are abandoned and now replaced by [`unused`][1].

Since 1.19, `go fmt` reformats godocs according to https://go.dev/doc/comment. I've done a bulk-reformatting of the codebase to keep the linter happy. Backporting is mostly harmless (the exception being `lib/services/role_test.go`, that for some reason breaks the _old_ linter using the new format).

[1]: https://golangci-lint.run/usage/linters/

* Bump golangci-lint version
* Replace abandoned linters
* Fix bodyclose on lib/auth/github.com
* Fix bodyclose on lib/kube/proxy/streamproto/proto_test.go
* Fix bodyclose on lib/srv/alpnproxy/proxy_test.go
* Fix bodyclose on lib/web/conn_upgrade_test.go
* Silence staticcheck on lib/kube/proxy/forwarder_test.go
* Silence staticcheck on lib/utils/certs_test.go
* Address BuildNameToCertificate deprecation warnings
* Run `go fmt ./...`
* Run `go fmt ./...` on api/
* Ignore formatting in role_test.go
* Remove redundant initializers in lib/srv/uacc/
* Update e/
2022-09-19 22:38:59 +00:00
Justinas Stankevičius 62f7537d65
Categorize Teleport Connect linux builds correctly (#16270) 2022-09-09 14:15:54 +00:00
Justinas Stankevičius bd0a5c43d8
Calculate shasums of TCon Linux OS packages (#16253) 2022-09-08 19:50:38 +00:00
Trent Clarke e076f7835c
Adds slack channel alert to Teleport Connect build (#15937)
WARNING: Due to issues with the windows drone executor's poor escaping when it echoes commands, I have moved the error message functionality into the PS build functions in build.assets/windows/build.ps1. This means that any failures that occur during the code checkout step will not be reported.

I'm not sure that this is the correct tradeoff, but it may well suffice for now.
2022-08-31 11:32:31 +10:00
Trent Clarke 1f58333531
Build Teleport Connect for Windows (#15292)
Uses Drone to build Teleport Connect for Windows on a Native 
Windows builder.

This PR adds 2 pipelines to the Drone YAML:

1. `push-build-native-windows-amd64`: Invoked on a push to master, 
   branch/v*, etc., and asserts that Teleport Connect can be built, and
   
2. `build-native-windows-amd64`: Invoked when a branch tag is 
   committed to the teleport Repo. Builds Teleport Connect and uploads 
   it to dronestorage
   
These builds are run on a native windows builder (as opposed to tsh, 
which is built in a linux environment and cross-compiled for Windows)
2022-08-29 16:56:55 +10:00
Rafał Cieślak 4ed203a2a0
dronegen: Enable verbose logs for electron tooling on macOS (#15836) 2022-08-26 15:43:16 +00:00
Rafał Cieślak b4c94ebf9b
Add drone pipeline for building Connect with signed tsh.app (#15763)
* Add proof of concept of Connect pipeline

The proof of concept includes a lot of copy-pasted lines which will get
cleared up in subsequent commits.

* Extract copying artifacts into separate functions

The tag pipeline no longer needs to worry about Connect artifacts.

* Reuse steps to install & cleanup toolchains

* Share toolchain configuration commands between pipelines

* Share build commands among different pipelines

* Download webapps only if a pipeline builds Connect

As seen by the changes to .drone.yml, this removes unnecessary webapps
clones from these tag pipelines: build-darwin-amd64, build-darwin-amd64-pkg,
build-darwin-amd64-pkg-tsh. None of them needs webapps to function anymore
and the pkg pipelines never needed webapps in the first place.
2022-08-24 16:38:42 +02:00
Logan Davis 711ccb2339
Authenticated pulls to build artifacts pipeline (#15781) 2022-08-23 22:45:50 +00:00
Zac Bergquist aaf827d6a4
Fix push builds for Teleport Connect (#15779)
PR #15509 updated the tag pipeline but missed the push pipeline
2022-08-23 14:52:56 -06:00
Zac Bergquist ac4d7fe651
Build Teleport Connect for Linux (#15509)
In order to do so, we add a new make target:

    make teleterm

This (temporarily) assumes that the gravitational/webapps repo is
cloned at the right version as a sibling to the teleport repo.
(We'll be able to get rid of this when we merge webapps into Teleport)

Additionally, update dronegen to include the name of the calling
function that generated the snippet instead of the line number.
This gets rid of lots of superfluous diffs in the generated
.drone.yml file.

Lastly, rewrite the Go program for getting the right webapps version
in bash, because Go is not available at this step of the drone pipeline.

Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2022-08-23 13:57:22 -06:00
Logan Davis 76606fc18b
Update buildbox to push to ECR (#15058) 2022-08-16 21:07:07 +00:00
Logan Davis baa2bb2e12
Update teleport-operator to use amazon ECR for staging registry. (#15275) 2022-08-10 14:50:37 +00:00
Rafał Cieślak a4e35a1ed8
Pick correct cert when signing Connect (#15344) 2022-08-10 13:13:57 +00:00
fheinecke b022fea56b
Added YUM implementation of OS package build tool (#14203)
* Added YUM implementation of OS package build tool

* Addressed PR comments

* Added YUM migrations

* Added curl to YUM dependencies

* Changed pipelines to use golang:1.18.4-bullseye for Go

* Implemented proper repo downloading logic

* Fixed other merge conflicts

* Added artifacts cleanup

* Removed delete on s3 sync

* Added RPM migrations

* v8 migrations

* Partial v8 migration

* Migration remainder

* Reduced requested resources

* Updated resource limits per step

* Added k8s stage resource limits to drone

* Fixed format issue

* Removed resource requests

* Added `depends_on` support to dronegen

* v8.3 migrations

* Fixed parallelism

* Removed migration parallelism

* Fixed RPM base arch lookup

* v6 and v7 YUM migration

* Fixed missing ISA

* Updated repo file path

* Added logging

* Removed vars from repo file

* v8.3 migration first batch

* v8.3 migration second batch

* v9.0 migration

* v9.1 migration

* v9.2 migration

* v9.3 first migration

* v9.3 second migration

* v10.0 migration

* Removed migrations

* Disabled shell linting non-issues

* Fixed linter problem

* More linter fixes
2022-08-02 21:32:59 +00:00
Logan Davis c6a9fa0767
Fix drone publishing for teleport operator (#15065)
Fix teleport-operator
2022-07-30 01:02:58 +00:00
Trent Clarke 605b525d05
Force unlock keychain on Darwin Push Build (#14909)
Code signing is failing on Darwin builds, and the most likely candidate is a locked keychain at build time.

This patch adds an explicit keychain unlock immediately prior to signing in order make sure the signing keys are available.
2022-07-27 04:05:40 +00:00
Logan Davis ce1113fe28
Drone publishing for Amazon ECR (#14347) 2022-07-26 16:14:08 +00:00
Justinas Stankevičius 08dcdcd27b
Fix artifact registration in Releases API for Teleport Connect (#13946)
Fix artifact registration for Teleport Connect
2022-07-26 12:27:39 +00:00
Jakub Nyckowski d03f8db0ca
Use CentOS 7 for building release binaries (#14062)
Switch to CenOS 7 as a base for Teleport releases.

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-07-02 02:11:37 +00:00
fheinecke f688365efa
Added migrations for latest release (#13498)
* Added migrations for latest release

* Removed migrations post run
2022-06-16 23:30:47 +00:00
Alan Parra 29d3f80261
Use make release-windows on Drone, make it similar to make release (#13532)
Switch from `make release-amd64` to make release-windows in Drone builds, making
release builds similar to "regular" builds (that already use
`make release-windows-unsigned`).

Fixes current woes caused by FIDO2=yes in Windows release builds. (Note that
ARCH is implied by the build.)

* Use `make release-windows` on Drone, make it similar to `make release`
* Update .drone.yaml
2022-06-15 19:59:34 +00:00
fheinecke 774e2cad65
Added prerelease check to new APT promotion pipeline (#13209)
* Added prerelease check to new APT promotion pipeline

* Resigned .drone.yml

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-06-08 23:57:25 +00:00
Rafał Cieślak b54fbcde92
dronegen/mac.go: Use make print-version for $VERSION (#13232)
`$WORKSPACE_DIR/go/.version.txt` is available only in tag pipelines, so
we can't read it in pipelines that run on pushes to master.

Instead, let's always use `make print-version`. It'll return the correct
value no matter what pipeline is used.
2022-06-07 13:39:07 +00:00
Rafał Cieślak 3c5eb0989f
dronegen/mac.go: Sync Connect version with Teleport (#13099) 2022-06-07 09:55:32 +00:00
fheinecke 6a693b9ce7
RFD 58: Package Distribution (#10746)
* Wrote RFD and implementation for APT repos.
2022-06-03 14:36:56 -05:00
Zac Bergquist 86f3a3d618
Build Teleport Connect on darwin/amd64 (#12257)
This commit updates drone to build Teleport Connect by:

* cloning `gravitational/webapps` as a sibling directory to
  gravitational/teleport
* checkout out the right version of webapps by running a simple
  Go program (this step is only necessary until we move webapps
  into the teleport repo)
* Running the Teleport Connect build and copying artifacts

Code signing should run on tag builds automatically as part the
electron build, assuming the Apple Account credentials are
properly loaded into the keychain.

Notarization will also happen automatically if both 
`$APPLE_USERNAME` and `$APPLE_PASSWORD` are set.

In order to make the above happen, this patch also includes:

* Installing and removing a per-build Node instance in the 
  toolchain directory on Darwin
* Moving the toolchain temporary directory out of ~/ and into /tmp.

Drone usually sets `$HOME` to a temporary directory for each build,
but unfortunately we need it to point to the actual build user's 
home directory in order for the notarisation tooling to find the
right keychain. Having $HOME point to a long-lived directory risks
both pollution from build detritus and builds stomping on one another.

In an in an attempt to isolate the builds from each other and protect
`~build` as best we can, as much of the build state as possible 
(including ephemeral toolchains) has been moved under `/tmp`.

Co-authored-by: Trent Clarke <trent@goteleport.com>
2022-06-03 12:19:42 +10:00
Alan Parra 7567c5502d
Build tsh with static libfido2 for macOS (#13001)
Add a script to build libfido2 (and its dependencies) on macOS and enable FIDO2
static builds.

I decided to build all dependencies instead of pulling from Homebrew for a few
reasons:

1. There is no libcbor.a in a brew package
2. This captures library versions within the Teleport source code, allowing us
   to build binaries against different versions of libfido2 (and its
   dependencies).

I've also bumped libfido2 to 1.11.0. I've been running it locally and we are
still pre-release, so it seems like a good time to do it.
(See https://developers.yubico.com/libfido2/Release_Notes.html.)

#9160

* Build libfido2 and dependencies for macOS
* Build tsh with static fido2 on Drone
* Bump libfido2 versions in all builds
* Attempt to appease linters
* Use temp dirs inside LIB_CACHE
* Move LIB_CACHE outside of HOME

HOME is reassigned in macOS builders, but we want a "stable" cache
directory. /tmp is used by build-package.sh and build-pkg-tsh.sh.

* Rename script to build-fido2-macos.sh
* Regenerate Drone files
2022-05-31 14:50:56 +00:00
Alan Parra 424afc3d63
Enable touchid builds on Drone (#12794)
Add the TOUCHID=yes Makefile toggle and enable it on Drone.

Complements #12751.

#9160

* Enable touchid builds on Drone
* Update Drone URL in error message
* Run `make dronegen`
2022-05-25 16:52:37 +00:00
Justinas Stankevičius b24b561560
Release pipeline improvements (#10707) 2022-04-06 16:35:45 +03:00
fheinecke 1daf7d2302
[master forward-port] Fixed RPMs using artifacts compiled against a too-new version of glibc (#11026)
* Fixed RPMs using artifacts compiled against a too-new version of glibc

* Fixed RPM naming issue

* Apply suggestions from code review

Co-authored-by: Gus Luxton <gus@goteleport.com>

Co-authored-by: Gus Luxton <gus@goteleport.com>
2022-03-25 20:55:31 +00:00
Zac Bergquist 55cbd0ac97
Remove use of deprecated ioutil package (#11296)
* Remove use of deprecated ioutil package
* Add lint rule to check for ioutil imports
2022-03-21 18:00:34 +00:00
Roman Tkachenko fa93b2775c
Update dronegen to fix build-darwin-amd64-pkg-tsh artifacts path (#10861) 2022-03-04 21:35:37 +00:00
Trent Clarke 3beb29832f
Upgrade buildbox to go 1.17.7 & tag as teleport10 (#10611)
Prior to this patch the teleport buildbox version has been tagged with the Go version for the current release. This bit us during the Teleport 9 development cycle, as both Teleport 8 and 9 use the same version of Go but require different versions of Rust, and we were unable to distinguish between the 2 buildbox versions.

At the time, Teleport 8 was individually patched to create a new `teleport8` buildbox tag, decoupling the buildbox version from the Go version. This was never ported into master and now we find the teleport 9 branch sharing the same buildbox tag as master.

This patch forward-ports all the changes made to `branch/v8` and updates them for master, creating a new `teleport10` buildbox tag. The idea is that we will create a new tag for teleport11 at the same time the release branch for Teleport 10 is mad at some point in the future.

Once this is merged, Drone will create and push new buildbox images, which will become available for CI. A subsequent patch will update the CI scripts to use the new `teleport10` buildbox images.
2022-03-01 15:31:46 +11:00
Walt f1fe4b6fe7
Remove drone step to publish centos6 buildbox (#10432)
This is some cleanup that was missed in
https://github.com/gravitational/teleport/pull/10314, and has been
causing push builds to fail with:

  make: *** No rule to make target 'buildbox-centos6'.  Stop.
2022-02-18 19:01:21 +00:00
Justinas Stankevičius 9d1c6fbb4d
Use tdr in Dronegen (#10453) 2022-02-18 15:31:06 +00:00
Justinas Stankevičius 1dcf165497
Ignore artifact failures in remaining pipelines (#9932) 2022-01-25 11:06:55 -08:00