Add --tag option to set tag for a run #530
Conversation
Adds support for upload-level tagging when uploading test results to Test Engine, bringing feature parity with test-collector-buildkite-plugin. Tags are passed as key=value pairs via --upload-tags (repeatable) or BUILDKITE_TEST_ENGINE_UPLOAD_TAGS (comma-separated). They are sent as tags[key]=value fields in the multipart upload body. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The plural on repeated And further, I'm not sure we need to specify that it's an upload tag here. They're just tags that end up on all the executions. So maybe just That'd be my preference ☝🏼 |
Keep BUILDKITE_TEST_ENGINE_UPLOAD_TAGS env var plural to match convention of other multi-value env vars. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Will people confuse this as "run tests that has these tags"? We have |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--tag to set tag for a run --tag option to set tag for a run
There was a problem hiding this comment.
Small, focused addition and the upload path looks correct — tags[key]=value mirrors the existing run_env[...] multipart fields, and the env-var binding test plus the multipart-body test cover the main paths.
One non-blocking note inline about comma handling in tag values.
The one open item is really the flag name (--tag vs something more specific) — you and @pda are already on that thread, so I'll leave that call to you two rather than pile on.
Note: this PR has no risk: label.
Want to dig deeper? The full session log is attached to this Buildkite build. Download the session file and open a new pi session with it:
Download the buildsworth logs from build 480, then answer my questions about the findings.
Summary
--tagflag andBUILDKITE_TEST_ENGINE_TAGSenv var tobktec runto tag the run when uploading to Test Enginekey=valuepairs sent astags[key]=valuemultipart fields in the upload bodytest-collector-buildkite-pluginfor upload-level taggingUsage
Notes for reviewer
Actionis needed becauseDisableSliceFlagSeparator: trueon theruncommand prevents the CLI library from splitting env var values automatically. There's no per-flag override for this in urfave/cli/v3.Actioncallback incli.go, not inmain.go.te-6006-update-bktec-docs— a merge conflict is expected there, just keep whichever version includes the--upload-tagsdocs.Closes TE-6027