Serialize CI_RUNNER_TAGS as valid JSON

What does this MR do and why?

CI_RUNNER_TAGS is documented as a JSON array but currently uses Ruby array inspection.

Ruby's escaping grammar differs from JSON for some supported Runner tags. For example, Ruby renders U+001B ESC with the invalid JSON escape \e.

This MR JSON-encodes each tag while preserving the established ordinary representation and ordering:

["docker", "ruby"]
->
["docker", "ruby"]

The change does not modify Runner tag validation, the Runner API, scheduling, authorization, database behavior, or associations. It adds no query and performs bounded serialization over the existing tag array.

References

Closes #630129 (closed)

Historical format context: #384949 (closed)

Earlier ordinary-representation fix: !179671 (merged)

Screenshots or screen recordings

Not applicable. This changes a predefined CI/CD variable's serialization.

How to set up and validate locally

bundle exec rspec spec/models/ci/runner_spec.rb:1340
bundle exec rspec spec/models/ci/runner_spec.rb
bundle exec rspec spec/models/ci/build_spec.rb:3612
bundle exec rspec spec/requests/api/ci/runners_spec.rb:1012
bundle exec rubocop app/models/ci/runner.rb spec/models/ci/runner_spec.rb
ruby -c app/models/ci/runner.rb
ruby -c spec/models/ci/runner_spec.rb
git diff --check

Final results on this branch based on master f8c963f81fb0d7c50c750c3d4e89904f815ceaf7:

  • Focused regression: 2 examples, 0 failures.
  • Complete Runner model spec: 363 examples, 0 failures.
  • Build-variable example: 1 example, 0 failures.
  • Runner API tag-list update example: 1 example, 0 failures.
  • Supported API, persistence, matching, and transport reproduction: 2 examples, 0 failures.
  • RuboCop: 2 files inspected, no offenses.
  • Ruby syntax and git diff --check: passed.

MR acceptance checklist

Evaluated against the MR acceptance checklist. The diff is limited to Runner predefined-variable serialization and focused model coverage. No documentation change is needed because the existing JSON contract is correct.

AI assistance

AI tooling was used to assist with investigation and drafting. The contributor independently reviewed the implementation, reproduced the bug locally, verified the regression test and fix, and takes responsibility for the submitted changes.

Merge request reports

Loading
Loading