Skip to content

Fix CI text interpolation variable validation

Avielle Wolfe requested to merge 439272-fix-text-interpolation-variables into master

What does this MR do and why?

CI text interpolation is causing variable values to be validated as in their actual type. Before, they were being validated after being cast to a string. This causes errors when running pipelines because the alphanumeric validator used for variable values only considered strings, symbols, and integers to be valid. This commit updates the validator to consider floats and booleans valid as well.

Before After
Screenshot 2024-01-24 at 20.02.35.png Screenshot 2024-01-24 at 20.02.14.png

How to set up and validate locally

  1. Make sure the ci_text_interpolation flag is enabled: Feature.enable(:ci_text_interpolation)

  2. In the CI editor, place this config:

    variables:
      FLOAT_VAR: 9.9
      FALSE_VAR: false
      TRUE_VAR: true
    
    test_job:
      script: ls
  3. See that the syntax is valid 🎉

Related to #439272 (closed)

Merge request reports