Skip to content

fix(options): merge RunTags across config layers instead of replacing#5714

Open
yordis wants to merge 1 commit intografana:masterfrom
yordis:yordis/add-tag-support
Open

fix(options): merge RunTags across config layers instead of replacing#5714
yordis wants to merge 1 commit intografana:masterfrom
yordis:yordis/add-tag-support

Conversation

@yordis
Copy link

@yordis yordis commented Mar 7, 2026

What?

Options.Apply previously replaced RunTags wholesale when a higher-priority layer set any tags. This caused options.tags in a script to be silently discarded whenever --tag or K6_TAGS was also used.

Tags are now merged per-key across all config layers.

Why?

Per the order of precedence, higher-priority layers should win on conflict — not erase everything from lower-priority layers. Every other map-type option (e.g. Thresholds) replaces wholesale because replacement is the right semantic there. For tags the user expectation is additive: script sets env=staging, CLI adds team=backend, both should appear.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

Closes #2694

@yordis yordis requested a review from a team as a code owner March 7, 2026 05:39
@yordis yordis requested review from ankur22 and szkiba and removed request for a team March 7, 2026 05:39
Previously, Options.Apply replaced RunTags wholesale, so any higher-priority
layer (env var or CLI flag) would silently discard all tags set in lower-priority
layers (e.g. options.tags in the script). Tags now merge per-key, with the
higher-priority layer winning on collision, consistent with the documented order
of precedence.

Closes grafana#2694
@yordis yordis force-pushed the yordis/add-tag-support branch from 4e14c5b to cb2e307 Compare March 7, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overwriting test-wide tags at key level

1 participant