Commit Graph
774 Commits
Author SHA1 Message Date
Luke Okraszewski 3677d382d5 [tooling] add benchfind (#62981)
This commit adds benchfind, a cli utility which can be used
to discover Benchmark test targets in a golang tree. The reason
this is useful in a large codebase is that to run `go test -bench ./...`
would require the linking of every test target binary. This can
take 1h+. Previously a `grep` expression was used to find targets:

```sh
grep --exclude-dir api --include "*_test.go" -lr testing.B .  | xargs dirname | xargs go list | sort -u
```

The issue with this is that it can break when the tree contains
other go modules and requires handling of pipefail. Instead a single
utility is provided.

This can now be replaced with:
```sh
benchfind ./...
```

Note that the tool will respect module boundaries, instead of
having to explicitly exclude them, call the CLI multiple times with `-d`
flag.
2026-01-28 10:54:06 +00:00
Luke Okraszewski 9f2498e7cd Exclude gen dirs when finding benchmarks (#62969)
This is a workaround to fix the failing benchmark targets both
locally and ci. Note that trying to run Benchmarks across go modules
will fail which is the underlying failure here. This commit will
unblock ci.
2026-01-22 10:57:55 +00:00
Paul Gottschling c82c0c1ae1 Generate a teleport CLI reference page (#62733)
Add a `cli-docs-teleport` Make target and generate the `teleport` CLI
reference page.

Edit the `teleport` app description to work with both in-app help text
and the generated docs.
2026-01-20 14:36:46 +00:00
Zac Bergquist 07aa756126 Add Rust RDP decoder library (#61858)
This library makes the IronRDP fast path decoder available to Go code
via CGo. There are three build options:

1. A standalone library (for use by tsh), enabled with the rust_rdp_decoder
   build tag.
2. All functionality included in the existing RDP client library,
   enabled with the desktop_access_rdp build tag.
3. A no-op implementation which avoids any Rust dependencies.

The decoder also respects the RDPCLIENT_SKIP_BUILD=1 flag from the makefile,
under the assumption that if you don't have Rust tooling and don't want
to build the RDP client that you also don't want the decoder.
2026-01-18 18:40:04 +00:00
Paul Gottschling 76c8ab4649 Generate a tbot reference page (#62732)
Add a `cli-docs-tbot` Make target and generate the page.

This change adds 19 `tbot` commands not present in the current
reference.

Also make minor changes to the app description so it can apply to both
in-app help text and generated docs.
2026-01-16 18:31:43 +00:00
Edoardo Spadolini 2c221c7905 Disable -buildmode=pie (#62776)
* Disable -buildmode=pie

* Update e
2026-01-12 18:50:00 +00:00
Zac Bergquist 57ea14be8b Fix make build-binaries (#62626)
* Fix make build-binaries

The dockerized build (make -C build.assets build-binaries) fails
with GLIBC errors because it is a multi-stage build that runs
across several different containers.

First, we build the webassets in buildbox-node. Then we build the
Teleport binaries in buildbox-centos7, reusing the webassets built
previously.

The issue arises because buildbox-node runs a newer version of GLIBC
than buildbox-centos7, and we weren't properly cleaning some build
artifacts when switching from one builder to another. As a result,
the centos7 builder would see intermediate artifacts with a dependency
on a GLIBC version that is too new.

Fix the issue by ensuring we run a clean-build after hopping into
the centos7 container.

Closes #62594

* Fix build-enterprise-binaries too
2026-01-07 02:38:18 +00:00
Noah Stride ecb5d66c07 SPIFFE Daemon Set Helm Chart (#61424)
* Skeleton/README

* Update Makefile with new targets

* More makefile changes

* Add Chart.yaml

* Add _helpers.yaml

* Add supporting RBAC

* Add values file and tweak config

* Add ClusterRole/ClusterRoleBinding

* Fix docs on values

* Hack on daemonset definition

* templatize security contexts

* Fix up daemonset labels/matchers

* Add workload api listener to tbot config

* Fix bad service account name

* Support debug mode logs

* Add value for workloadIdentitySelector

* Update documentation

* Add snapshot testsAdd snapshot testsAdd snapshot testsAdd snapshot
testsAdd snapshot testsAdd snapshot testsAdd snapshot testsAdd snapshot
tests

* Add to the chart index

* Fix missing "?" in helm value

* Generate reference doucmentation

* Appease newline linting

* Add note regarding high level of privileges

* Update chart ref
2026-01-02 15:47:40 +00:00
Paul Gottschling c4e5b6c60d Add a resource reference generator (#60395)
* Add a resource reference generator

Closes #16948
Closes #9949

Implements RFD 130.

See the included README for information about how the generator works.

This implementation breaks from, and updates, RFD 130:

- The reference includes separate pages for dynamic resources in order
  to make it easier to read. Edit the RFD to be less specific about the
  output template so this isn't wedded to implementation details.
- The generator uses a YAML configuration file. This is because the
  config ended up including more fields than specified in the RFD, so
  separating the config from the source made sense to give users less
  noise to deal with.
- The generator requires that a user specify the resources to include in
  the reference docs. This makes it easier to start with a smaller, more
  manageable set of resource reference docs.
- Support RFD 153 in the reference generator: RFD 153 resource types
  include unexported fields and include a `Metadata` field from a
  different package than legacy resources types. They also include the
  `Metadata` field with a pointer. Adjust the generator to ignore
  unexported fields in struct declarations, and to treat pointer field
  types the same way as value field types.
- Remove the description of example YAML delimiters. These are no longer
  viable, as we maintain several documentation generators that extract
  comments from the source. Instead, if we can't generate example YAML,
  show a comment in the YAML example advising the reader to read the
  description of a field.

Other changes:

 - Add a Make target for generating dynamic resource reference
   documentation, plus a target for checking that the resource reference
   docs are up to date. Run the checker in the `Lint (Proto)` job.
 - Generate reference docs for Bot, RoleV6, OIDCConnectorV3, and
   SAMLConnectorV2.

* Clean up the resource reference generator

- Remove an unneeded import.
- Use slices.SortFunc instead of sort.Sort for sorting reference entry
  fields.
- Change `errors.Is(err, NotAGenDeclError{})` calls to use `errors.As`.
  While `NotAGenDeclError{}` structs are always empty, using `errors.As`
  ensures the calls still do the same thing if we add fields to the
  type.
2025-11-25 15:27:14 +00:00
Paul Gottschling 626fdf048e Generate an Access Monitoring event reference (#61632)
* Generate an Access Monitoring event reference

Closes #60074

Use the getters we declared to access protobuf-generated event structs
in order to create Athena views for Access Monitoring events, populating
a template with the event structs and including examples of `tctl audit
query exec` queries.

Add Make targets to generate the page and check that it was generated.
Add a step to the `Lint (Proto)` job to check that this was generated.

* Clean up the event schema reference generator

- Remove unnecessary line breaks.
- Move `teleport` requirement into the main `require` block.
- Embed the template.
- Accommodate characters that exceed one byte in `prepareDescription`.
- Use a no-allocation alternative to strings.Join in `colNameList`.
2025-11-24 17:25:28 +00:00
Hugo Shaka 3c4b355560 Strip VCS build information from go builds (#61502)
Scanners such as trivy are misinterpreting the go pseudoversions
describing which commit was used to build the project.
See: https://github.com/aquasecurity/trivy/discussions/9446

This causes false positives and considerable toil for our support team
as every user/customer is seeing trivy reporting that Teleport is
affected by CVE-2022-36633 (it is not).

Trivy doesn't seem to want to fix their tool so we must strip VCS
information from the go binary to stop the false positives.

This actually makes the binaries _less traceable_, but this is the only
workaround to reduce the noise caused by those tools.
2025-11-19 17:28:46 +00:00
Andrew LeFevre 8e41e5da36 add bpf integration tests (#61408) 2025-11-17 20:24:28 +00:00
rosstimothy a986f9fd48 Generate test artifacts (#61296)
Updates test targets to output json and junit files. These files
will be forwarded to a durable storage location in the future to
be consumed for analytical purposes.
2025-11-14 23:19:36 +00:00
Andrew LeFevre d46bec8af0 fixed bpf-bytecode make target exiting with error when not called (#61240) 2025-11-11 20:39:40 +00:00
7a7f08cb39 Replace aquasecurity/libbpfgo with cilium/ebpf (#60541)
* start the refactor away from aquasecurity/libbpfgo to use cilium/ebpf

Remove debug statements and unused code in BPF library

This commit eliminates unnecessary debug log statements from bpf_test.go and removes unused code in disk.go and network.go files within BPF library. The aim is to make codebase cleaner, enhancing readability and maintainability without losing track of functional aspects. It's part of an ongoing effort to maintain optimal code quality across the project.

Revise Dockerfile and Makefile instructions

Adjusted Dockerfile and Makefile commands to optimize build process. The changes ensure better readability and maintainability of code, especially with respect to BPF bytecode and test preparations. A clause was also added to check for the presence of clang before building BPF bytecode.

Refactor BPF code and tests

Refactored BPF source code and its corresponding tests for better readability and efficiency. This includes updating data structures like rawExecEvent, rawOpenEvent, rawConn4Event and rawConn6Event to their more meritorious versions like commandDataT, diskDataT, networkIpv4DataT and networkIpv6DataT respectively. Also, generated concise and clear bindigs for eBPF programs to replace the previous multi-arch setup. Furthermore, correspondingly adapted all related test cases arising in bpf_test.go, command.go and other files.

Remove counter_test from BPF and related test code

This commit removes the file counter_test.bpf.c from the enhanced recording in BPF. Following this file deletion, corresponding test functions in bpf_test.go, that were originally testing the functionality provided by counter_test.bpf.c, have been removed as well.

Refactor BPF test and improve error handling

The commit refactors the BPF test suite to run each test as a sub-test by using t.Run, easing debugging and error tracing. It also simplifies the 'executeCommand' function by removing redundant function calls related to finding executable files, and improves error handling. In 'cgroup.go', the code has been adjusted to retry on EBUSY errors when removing a cgroup, instead of ignoring them.

Update cgroup deletion process and error handling

The changes made introduce a retry mechanism when deleting a cgroup in case the cgroup is busy. This prevents a failed attempt from immediately returning an error. Additionally, error handling has been improved in the 'writePids' function to better handle 'no such process' errors.

Enhance cgroup monitoring in disk.bpf.c

The code has been updated to check if current cgroup is being monitored in the "enter_open" method of "disk.bpf.c". If the cgroup is not marked for monitoring, it will be ignored, enhancing overall cgroup management.

Improve resource handling

This commit introduces a deferred close to the sendEvents function to ensure proper resource handling of the eventBuf object.

Add rlimit package to remove resource limits

Introduced the "github.com/cilium/ebpf/rlimit" package and added a function to remove resource limits for kernels less than 5.11. This operation is necessary for kernels with a lower version because they may face issues when running applications with allocated memory limitations.

Fix a test after rebase

Refactor BPF testing setup and implement session closing

This commit updates the BPF testing structure to remove the context dependency in event generation functions, simplifying the test setup. Additionally, it adds a 'closed' field to the 'open', 'conn', and 'exec' structs alongside mutex protection. This implementation allows checking if a session is closed before any operations, correctly handling already closed sessions. Furthermore, it corrects tracepoints for handling 'openat' and 'openat2' system calls for different platforms. This refactoring effort aims to improve the robustness and readability of the BPF testing suite.

Update conditions for BPF bytecode building

This update modifies the Makefile to add a conditional check for the presence of /usr/include/bpf/bpf_helpers.h. This new requirement must be met along with the existence of /usr/include/linux/bpf.h and the installation of Clang, in order to facilitate the correct build of BPF bytecode. Consequently, this change enhances the reliability of the build process.

Add conditional for bpf_helpers.h in Makefile

This commit adds an additional check in the Makefile for the existence of /usr/include/bpf/bpf_helpers.h. This ensures that BPF bytecode only gets built when both bpf.h and bpf_helpers.h exist, and Clang is installed, improving the build process reliability.

Refactor and improve BPF bytecode generation

This commit refactors and improves the BPF bytecode generation process. It introduces distinct bytecode structures for different architectures, ensuring better compatibility and execution. The BPF test is adjusted due to its tendency to fail unpredictably, hence it's commented out to avoid unnecessary build failures. This commit also eliminates certain redundancies in `common.mk`, improving the clarity of the build process.

Comment out test code in bpf_test.go

The test code in the file bpf_test.go has been commented out. These changes are circumstantial and do not imply that the test code is obsolete or unnecessary. The use of such tests may be needed in future commits or for local development testing and debugging.

Remove libbpf dependency from Vagrantfile and update README

The Vagrantfile and README have been updated to remove the no longer needed libbpf dependency. This change simplifies the project set up by eliminating unused build steps in the Vagrantfile and correcting related instructions in the README. This results in a more streamlined, intuitive build process and reduced potential for code complexity and dependency conflicts.

Remove obsolete dependencies and related code blocks

The 'aquasecurity/libbpfgo' library referencing and the related code blocks have been removed from the test files and core modules. The corresponding setup instructions in the dockerfiles and build scripts have also been eliminated. This update simplifies the build process and overall project structure while reducing unnecessary dependency risks.

Remove aquasecurity/libbpfgo dependency

Remove restricted.bpf.c

Migrate disk events to cilium

Migrate network events to cilium

Remove restricted session

Use cilium/ebpf for BPF

* fix build issues caused by stale branch

Also updated bpf bytecode, updated github.com/cilium/ebpf to 0.19.0,
and updated bpf/README to reflect changes

* fix tests and a bit of cleanup

Also added a subtest and fixed receiving IPv6 network events and
fixed attempting to create tracepoints for syscalls that are not
present on arm64.

* repurpose buffer size configs to set event channel buffer size

* add new GHA job to check that generated eBPF files are up to date

* fix lost event promethus counters and address feedback

* address feedback

* use only unsafe instead of CGO to convert C strings

* rename common_data_t comm -> command

* convert strings in bpf programs from char arrays to u8 or uint8 arrays so we can convert them to Go strings without the use of the unsafe package

---------

Co-authored-by: Jakub Nyckowski <[email protected]>
Co-authored-by: Tim Ross <[email protected]>
2025-11-11 15:33:32 +00:00
rhammonds-teleport 6377a5b119 Upgrade IronRDP Dependency (#59661)
* * Update to latest commit of IronRDP.
* resolve conflicting 'getrandom' dependencies.
* Add necessary RUSTFLAG env var to ironrdp-wasm compilation. Needed by 'getrandom' dependency to enable its wasm_js feature.
* Configure client to use remotefx codec.
* Bump rust toolchain version to 1.86.0.
* Unset existing rustup overrides before building rdpclient or ironrdp wasm module.
* Fix lint warnings after Rust toolchain upgrade.

* Simplify BitmapFrame rendering and fix some rendering glitches that were revealed after updating IronRDP

* fix typo

* Try to determine the active Rust toolchain and print a helpful warning if it does not match the version defined in our toolchain file.
2025-11-05 15:40:02 +00:00
Paul GottschlingandRafał Cieślak 11f1d646eb Add an audit event reference generator (#60290)
* Add an audit event reference generator

Closes #5044
Closes #10350

This change adds a generator for audit event reference documentation
based on Web UI audit event formatters and, if available, test fixtures.

Previous attempts to generate an audit event reference drew from the
Teleport source using `AuditEvent` declarations (#13615) and naming
conventions (#38344), but inconsistencies within the source meant that
the resulting generator was inadequate. The Web UI source files
represent the most complete set of source data we have on audit event
schemas.

Implementation details:

- If an event includes a fixture, use that as an example of its schema.
  For any event formatter with no test fixture, include the event, type,
  code, and description in the reference guide using data from the
  formatter, but don't include an example.
- If one event type includes multiple possible codes, document each code
  in an H3 section.
- Ignore instances of the same code beyond the first occurrence.

Co-authored-by: Rafał Cieślak <[email protected]>

* Get rid of `any` in types

The events map did not define what types it stores, so TypeScript
defaulted it to Map<any, any>. After adjusting this type, it turned out
that there were many functions with worked on Event but were actually
given ReferencePageEventData, so I changed their signatures too.

Types usually start with upper case, hence ReferencePageEventData and
not referencePageEventData.

The `as` in `Object.keys(formatters) as Array<keyof Formatters>` was
not necessary, as TypeScript correctly infers the type here.

* Add more context to the README

* Add shorthand command to build and gen reference

* Check audit event reference docs in CI

Add Make targets for running and checking the audit event reference
docs. Add a step to the GitHub Actions job that runs Web UI linters to
check the audit event reference docs.

---------

Co-authored-by: Rafał Cieślak <[email protected]>
2025-10-29 14:37:41 +00:00
Edoardo Spadolini 19cb4f5515 Add chart for the Relay service (#59454)
* Chart yaml, values and helpers

* address comments

* autogenerated reference docs

* add missing extra labels and annotations for the service

* admonition formatting

* version and image helpers

* join secret name helper

* resources

* update reference

* add linting

* Add helm unittests

* Allow custom key for the trusted CA bundle secret

* Remove check for negative replicaCount value

* Clean up .lint/full.yaml and fill it in a bit more

* Fix selector labels indentation in PDB

* Redo tests avoiding snapshots

* Update exercise-configmap to render the whole chart for linting
2025-10-02 16:17:46 +00:00
rhammonds-teleport f09d381132 Add Rust Toolchain File (#59335)
* Add rust toolchain file

* Determine rust version by checking the top level toolchain file. Remove overrides.

* Remove explicit overrides and target installation from workflows.

* Remove from macOS build docs any language about installing specific rust toolchains or setting overrides. We're relying on the toolchain file and rustup to quietly install and use the toolchain(s) specified by the toolchain file.

* Always re-install wasm-bindgen if the currently installed version is out-of-date

* e submodule invokes the 'rustup-set-version' target, but it is not needed now that we have the toolchain file. Leave this target in for now so that we don't break the build. We can clean it up later.

* Remove target that install wasm toolchain. It is no longer necessary.

* Fix awk expression that extracts rust version from the toolchain file.

* Fix comment and remove explicit rust toolchain install from lint workflow

* We still need to ensure that rustfmt and clippy are installed on machine that runs rust lint.
2025-09-26 16:36:48 +00:00
Zac Bergquist 80bbf6fa8f Pin tool versions using Go tool deps (#59540)
* Pin tool versions using Go tool deps

Use versioned tools rather than installing @latest on every run.
This ensures consistency across developer machines and can also
help protect against supply chain attacks.

Updates usages of gci, goda, and gotestsum.

* make go-generate
2025-09-24 19:18:56 +00:00
Noah Stride 0b000b6d28 Remove DevBox (#59455) 2025-09-23 07:49:19 +00:00
rosstimothy e5ecdd5db7 Prevent using synctest expiremental API (#59187)
Removes support for GOEXPIREMENT=synctest now that e has been
updated to use the stable API introduced in Go 1.25.
2025-09-17 15:51:12 +00:00
rhammonds-teleport 09f6f6c7f7 Remove 'wasm-pack' Build Dependency (#58618)
* Get a Teleport build working without wasm-pack

* * seed docker images with wasm-opt, and wasm-bindgen-cli
* Replace potentially confusing 'CARGO_TARGET_wasm' variable.
* Replace oneoff .gitignore with a corresponding entry in the top level .gitignore.
* Replace 'printf' used to create package.json file with a cleaner multiline string.
* Remove unnecessary 'NEED_VERSION'
* Use awk to find wasm-bindgen version without using 'cargo' since it doesn't seem to be available on ARM64 runners

* Move 'WASM_BINDGEN_VERSION' definition out of versions.mk

* Pass '--locked' flag to wasm-opt install
2025-09-16 17:01:43 +00:00
Zac Bergquist 53bc4998d9 Bump minimum required macOS version to Monterey (#59104)
With the Go 1.25 bump, Teleport now requires macOS 12.
2025-09-16 15:20:25 +00:00
rosstimothy ad08e94b4c chore: Bump Go to 1.25.1 (#58875)
* chore: Bump Go to 1.25.1

Update all Go modules to use Go 1.25.1.

* Use stable synctest API introduced in Go 1.25

All existing tests that used synctest have had their build
constraints removed and have been updated to use synctest.Test
instead of synctest.Run. There are still tests in teleport.e that
needs to be updated before we can remove GOEXPERIMENT=synctest
and retire the synctest build tag.

* Remove coverage from go test invocations

This is a temporary workaround to https://github.com/golang/go/issues/75031.
When the buildboxes have Go 1.25 installed globally this should no
longer be an issue and coverage can be restored.

* Lazily unmount cgroups

Adds the MNT_DETACH flag to the cgroups unmount call to workaround
issues stemming from a behavior chagne in Go 1.25 to support
automatically setting GOMAXPROCS. In doing so the Go runtime
interacts with cgroups to determine what limits should be applied
which interferes with our ability to clean up.

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

* Fix syntest bug with waitgroups

```
=== Failed
=== FAIL: lib/srv/discovery TestDiscoveryServerEKS (unknown)
fatal error: sync: WaitGroup.Add called from multiple synctest bubbles
```

The failure stems from a bug in Go 1.25 and is a result of loading
aws configs which internally use a sync.WaitGroup. This can be worked
around in the short term by mocking out the aws.Config since the test
is configured to use a mock eks client anyway. Other tests may still
run into this issue until Go 1.25.2 - though our relatively small number
of synctest usage at this point may limit our exposure to said bug.
2025-09-15 21:49:53 +00:00
Vadym PopovandHugo Shaka d9dbb64853 Fix client tools managed updates sequential update (#58954)
* Fix CTMU sequential update

* Preserve the archive directory structure

* Disable compression for integration tests launched with the `-race` flag, since this creates a heavy CPU load due to the design of the `compress/gzip` library.
Filter out managed updates integration tests from the Kubernetes integration test suite, because even when executed with the `-run` filter, `TestMain` is still executed and introduces additional load during test initialization.

* Check re-exec env variable to ensure that remote check is not ignored

* Apply suggestions from code review

Co-authored-by: Hugo Shaka <[email protected]>

* Disable deprecated `~/.tsh/bin/tsh` path

---------

Co-authored-by: Hugo Shaka <[email protected]>
2025-09-12 17:46:18 +00:00
rosstimothy 1c45afd832 Fix typo on BPF_TAG (#59043)
This resolves the following error that pops up in CI due to
a typo that added an extra $ to the build tags.

```
  /bin/bash: line 1: BPF_TAG: command not found
```
2025-09-11 23:31:22 +00:00
Marek Smoliński 8e63cbd984 Switch to lib goderive DeepCopy Clone method (#58736) 2025-09-04 15:17:32 +00:00
Marek Smoliński 2384fac58e Add goderive deepcopy (#58588) 2025-09-04 13:01:19 +00:00
rosstimothy 8028596c03 Remove testing symbols from binaries (#57905)
* Add lint to prevent testing symbols in binaries

A new lint-test-symbols Make target has been added, and is
called during linting in CI to prevent testing symbols from
finding their way back into production builds.

* Remove test symbols in binaries

Updates dependencies with test symbols in them to newer versions
which have had the test symbols removed.
2025-08-14 22:42:08 +00:00
Chris Thach 6fa24fc591 Improve development environment setup instructions 👨🏾‍💻 ✍🏾 📜 (#57727)
* docs: update instructions for local build dependencies to improve clarity

* docs: use homebrew as primary dependency installer and simplify MacOS env setup

Signed-off-by: Chris Thach <[email protected]>

* docs: improve consistency

Signed-off-by: Chris Thach <[email protected]>

* docs: revert changes to further simplify changes

Signed-off-by: Chris Thach <[email protected]>

* docs: use versions.mk as source of truth

Signed-off-by: Chris Thach <[email protected]>

* docs: add missing replace instruction

* docs: simplify Go install

Signed-off-by: Chris Thach <[email protected]>

* docs: replace protobuf with buf

Signed-off-by: Chris Thach <[email protected]>

* docs: simplify by making all deps required for dev environment

Signed-off-by: Chris Thach <[email protected]>

* docs: add testing instructions for MacOS environment setup

Signed-off-by: Chris Thach <[email protected]>

* refactor: rely on Make to install deps

Signed-off-by: Chris Thach <[email protected]>

* docs: remove pnpm from root README as its no longer needed to be explicitly installed

* refactor: install buf version in versions.mk

Signed-off-by: Chris Thach <[email protected]>

* fix: bad link for binaryen

---------

Signed-off-by: Chris Thach <[email protected]>
2025-08-12 22:32:52 +00:00
Vadym Popov 590557d5eb Additional packages for client tools and teleport-update (#57579)
* Added separate client tools package for darwin platform (managed updates) and single teleport-update package

* Separate notarization for teleport and teleport-tools packages
2025-08-11 18:16:08 +00:00
Rafał Cieślak 805a96247b Add CI check for pnpm process-icons (#57700) 2025-08-08 15:20:30 +00:00
Paul Gottschling f936040622 Add a make target for running all docs generators (#56189)
Closes #52982

Add a target to the root Makefile, `gen-docs`, to run all docs
generators. This provides a convenience for developers to sync
auto-generated docs with any code changes without worrying about
memorizing commands for specific generators.

Note that, for each of the current generators, there is already a make
target for checking whether the generator has been run, and there is a
GitHub Actions job to execute each target. Since checker executions are
split across different GHA jobs, it doesn't make sense to consolidate
them into a single checker target to run in CI.
2025-07-07 16:29:02 +00:00
Paul Gottschling f104ab66e4 Add a CLI reference generator (#54394)
* Add a CLI reference generator

See #3568

Add a function to update the kingpin usage template for a CLI
application and print a docs page. As a starting point, includes a
`docs` subcommand in `tsh` to call the function for that tool. By
generating CLI documentation, we can ensure that commmand, argument, and
flag usage information is consistent with the terminal help text for a
given CLI. We can also ensure that all changes to a CLI application are
reflected in the documentation.

As an alternative, we could edit `UpdateAppUsageTemplate` in `lib/utils`
to update the usage template to print an MDX page, e.g., using build
tags to print a docs template instead of the default usage template.
This approach would update all CLI tools at once and use a consistent
approach with minimal changes to each CLI tool. However, using a
separate function to take a `*kingpin.Application` and print a docs page
is more straightforward and explicit, even though it does require
editing each CLI tool to call the function.

One shortcoming of generating the CLI reference docs versus our current
manual approach is that it is non-trivial (and potentially impossible)
to use `kingpin`'s usage API to obtain the value types of the
subcommands, flags, and arguments registered against a
`*kingpin.Application`. We can use flag and argument descriptions and
default values to achieve the same purpose.

Another shortcoming is that `kingpin`'s usage API does not print usage
information for arguments, environment variable, etc. that a CLI looks
up directly from the OS, such as the `TELEPORT_CLUSTER` environment
variable for `tsh`.

* Respond to zmb3 and atburke feedback

**Separate docs generation code from production code.**

Add a separate implementation of `UpdateAppUsageTemplate` that requires
the `docs` build tag. Since all Go-based Teleport CLI tools call
`UpdateAppUsageTemplate`, the `docs` build of the function ensure that
the `help` command for Teleport CLI tools prints a docs page.

This change also adds a `cli-docs-tsh` make target to generate a docs
page for `tsh`.

**Escape pipes in `formatHelp`** to avoid breaking table cells.

* Respond to atburke feedback

- Make the main help description more visible. Assume that the main help
  description is not necessarily a complete sentence, adding the text to
  the end of the introductory sentence using a colon.

- Add a make rule for running CLI docs generator tests. Use the `-run`
  flag since the tests are in a package we already run tests for in
  another make rule.

* Respond to zmb3 feedback

- Use Fprintf instead of Buffer.WriteString.
- Use the zero value of bytes.Buffer instead of NewBuffer.
- Rename `.*ToColumns` functions to `.*ToRows` for clarity.
- Use slices.ContainsFunc in anyVisibleFlags.
- Use slices.ContainsFunc in anyEnvVarsForCmd.
- Clean up argsToRows.
- Minor cleanup in TestUpdateAppUsageTemplate.
- Clean up sortCommandsByName (no need to implement sort.Interface).
- Read the docs usage template from disk in UpdateAppUsageTemplate. For
  this to work, add the function updateAppUsageTemplate, which takes an
  io.Reader, and use separate file paths to pass the io.Reader to the
  function in the tests and in UpdateAppUsageTemplate.
- Inline formatFlagForTable and remove unnecessary branching.
- Add an ADDTAGS environment variable to the `test-go-unit` make
  target so it's possible to pass arbitrary build tags, e.g., "docs".
2025-06-27 17:33:14 +00:00
Grzegorz Zdunek 1be524f5b3 Add ZIP target for macOS to support Connect in-app updates (#55676) 2025-06-25 14:32:53 +00:00
Przemko Robakowski 6dc9d18eac Add RDP client to flaky test detector (#55873) 2025-06-18 19:41:17 +00:00
Przemko RobakowskiandZac Bergquist 81d266689a Don't consume messages in readClientKeyboardLayout (#55427)
* Don't consume messages in readClientKeyboardLayout

* Update lib/srv/desktop/tdp/conn.go

Co-authored-by: Zac Bergquist <[email protected]>

* tests

* gci

* add rdp client to unit test

---------

Co-authored-by: Zac Bergquist <[email protected]>
2025-06-18 07:52:56 +00:00
Tiago Silva 22a9c605c8 make: turn *LDFLAGS properly evaluated (#55634)
Currently, `make build/tsh` sets the `KUBECTL_SETVERSION` which is used
to set the kubectl version at compile time. This is used by `tsh kubectl
version` to print the kubectl version it ships.

The issue is `?=` isn't a lazy operator so it means all the flags are
evaluated once during the initial parsing of the makefile. It means that
when the phony executes, although `KUBECTL_SETVERSION` is set, during
the makefile parsing phase it wasn't so we don't pass the build flag.

This PR fixes that by moving the kubectl set code into the init parsing.
This also means we are setting the variable for all binaries but that
shouldn't have any meaningfull impact.

Signed-off-by: Tiago Silva <[email protected]>
2025-06-17 08:26:34 +00:00
Noah Stride fca4d530be MWI: Terraform Provider - Skeleton (#55393)
* Add entrypoint/go.mod

* Add skeleton of Provider struct

* go mod tidy

* Add LICENSE, README

* Add skeleton for ephemeral resource and tests

* go-mod-tidy

* Exclude from flaky test detector like other integrations

* Wire up test actions

* Add skeleton for data source & testing

* Use more terraform-esque language

* Add note to README on WIP status

* Remove replace directives
2025-06-06 16:48:05 +00:00
Cam HutchisonandTim Ross 57cc95f230 build: Update master for v19 (#55410)
* build: Update master for v19

Update the version in `master` to v19 now that the v18 branch has been
cut. This will cause all dev builds to be built with v19.0.0-dev version
prefix and use a teleport19 buildbox. The buildbox has been manually
built prior to this commit being merged to master.

Run `make update-version` to propagate the new version to required
files.

Remove no-longer-necessary steps in the preflight.md docs.

* fix: allow tests to use old client versions

---------

Co-authored-by: Tim Ross <[email protected]>
2025-06-04 17:47:39 +00:00
Andrew LeFevre c21fda1ad3 add SELinux install script to release tarball (#55128) 2025-05-27 23:42:31 +00:00
Hugo Shaka 59ec8e7985 Remove painful crdgen snapshot tests (#55159) 2025-05-27 14:38:28 +00:00
Guillaume J. Charmes 2c73757c8b Pass k8s api group around. (#54760)
* Pass the api group around. Set the default value as wildcard. No behavior/logic change.

* Revert presets back to v7 to pass the merge queue tests.
2025-05-22 23:38:27 +00:00
Yassine Bounekhla 999533b4b7 implement e2e testing for the webui (#54094) 2025-05-16 18:57:02 +00:00
Cam Hutchison 86425559db build: Force installation of wasm-* tools, fix version check (#54824)
Use `--force` when running `cargo install` to build and install
`wasm-pack` and `wasm-bindgen` as if they already exist but are the
wrong version, `cargo` will still not build/install it, saying it's
already installed.

Fix the version check for the tools. The version is the second field
from the output of running them with `--version`. That was the last
field when I last ran it, but sometimes it adds a hash to the end, so we
need to explicitly take the second field, not the last field.

Allow `make ensure-wasm-bindgen` to do something locally when `FORCE` is
set rather than `CI` as `CI` may have other undesirable side-effects.
Only output the message if there is a version mismatch and include an
exact command to run to get the right version installed.
2025-05-16 07:04:47 +00:00
Cam Hutchison 89492b1205 build: Add Makefile target to install wasm-{pack,bindgen} (#54652)
Add a `Makefile` target, `ensure-wasm-deps` to install `wasm-pack` and
`wasm-bindgen` if they are not installed or are the wrong version, but
only on CI for now (if the CI env var is set).

We want to install `wasm-bindgen` ourselves as we want to install it
with `--locked`. `wasm-pack` will install it if it is not present or the
wrong version, but it does not use `--locked` which sometimes causes the
build of `wasm-bindgen` to fail if versions of stuff on crates.io change
or the tea leaves say so. This way is more deterministic and prevents us
breaking from stuff that others do.

Remove the commands from the `build-macos.yaml` workflow that install
`wasm-pack` and `wasm-bindgen` and call the new `Makefile` target
instead. We keep this separate, as even though it is a proper dependency
of building the UI, keeping it separate makes it easier to diagnose
failures in the CI logs.

This currently has the wasm-bindgen-cli package hard-coded to 0.2.99,
which will need to be changed to 0.2.95 for v16 and v17 backports and
0.2.100 for v15. Current issues with this change on the i386 build has
forced this hardcoding for expediency to get a release out. This will be
revisited to be dynamic.
2025-05-10 02:38:28 +00:00
Zac Bergquist a15a952f29 Fix imports (#54493)
This went undetected by linters since the test file is behind
a build tag.

In order to ensure that testing/synctest is recognized by gci as
a standard library package, we need to run it with the GOEXPERIMENT
env var.
2025-05-02 22:12:30 +00:00
fheinecke 416c6b326c Group makefile $(VERSRC) targets (#54288) 2025-04-24 21:27:01 +00:00
Edoardo Spadolini 91741f1abf Tweak api/version.go generation (#54257)
* Delete audit stream version check for v13

* Remove string parsing for bpf min kernel version

* Remove string parsing for min etcd version

* Remove version string parsing for route not found

* Remove string parsing for min mariadb version

* Remove string parsing for min mongodb custom data version

* Remove string parsing for min openat2 kernel version

* Use consts in api/version.go

* Generate api/version.go with a go command

* Avoid using a global variable SemVersion

* Keep but deprecate SemVersion in api

* fix-license
2025-04-24 12:58:05 +00:00