Uploader CLI Reference
Trunk Flaky Tests detects and tracks flaky tests in your repos by receiving uploads from your test runs in CI. Trunk Flaky Tests takes the JUnit XML format for uploads. These uploads happen in the CI jobs used to run tests in your nightly CI, post-commit jobs, and your PR checks.
If you're setting up Trunk Flaky Tests for the first time, you can follow the guides for your CI provider and test framework.
Installing the CLI
The CLI should be downloaded as part of your test workflow in your CI system. This can be done with the following command:
and then invoked like this. The trunk
binary will already be marked executable.
Uploading from the CLI
The uploaded tests are processed by Trunk periodically, not in real-time. Wait for at least an hour after the initial upload before they’re displayed in Trunk. Multiple uploads are required before a test can be accurately detected as broken or flaky.
The trunk
command-line tool can upload and analyze test results. All of the following subcommands and arguments are to the trunk flakytests
command.
Run the command line with one of the following commands
Command | Description |
---|---|
| Test the upload process, but do not upload any data. |
| Upload data to Trunk Flaky Tests |
| Print the help message |
The upload
command uses the following arguments
Argument | Description |
---|---|
| a comma separated list of paths containing the test output files. File globs are supported. |
| Trunk Org slug, from the settings page. |
| Trunk Org (not repo) token, from the settings page. |
| Additional detailed description of the |
| Path to the repository root. Defaults to the current directory. |
| Value to override URL of repository. Optional. |
| Value to override SHA of repository head. Optional. |
| Value to override branch of repository head. Optional. |
| Value to override commit epoch of repository head. Optional. |
| Comma separated list of custom tag=value pairs. Optional. |
| Print files which will be uploaded to stdout. |
| Run metrics CLI without uploading to API. Optional. |
| Value to tag team owner of upload. Optional. |
| Value to override CODEOWNERS file or directory path. Optional. |
| Run commands with the quarantining step. |
Troubleshooting
As a general rule you should download the release on every CI run. Do not bake the CLI into a container or VM. This ensures your CI runs are always using the latest build.
The trunk
binary should be run from the repository root. If you need to run the binary from another location, you must provide the path to the repo root using the --repo-root
argument. The --junit-paths
argument accepts the XML file locations as both a list of globs or absolute paths.
Organization not found
If you receive an error that the org slug or API token is not found, double check that the secrets stored in your CI provider are the same as the Organization settings by navigating to Settings -> Manage -> Organization on app.trunk.io.
Make sure you are getting your Organization Slug, not the Organization Name.
Ensure you get your Organization API Token, not your repo token.
Test results aren't uploading
If the test results aren't uploading from your CI system then one possible cause is malformed XML. Try modifying your job to run ./trunk flakytests validate
. Also try using --dry-run
and --print-files
to show which files will be uploaded.
Last updated