Skip to content

Fix error when using array for the project keyword

Laura Montemayor requested to merge fix-mask-secret-var into master

What does this MR do and why?

When you use an array in the project keyword for include, like so:

include:
  - project: ["lauraX/public-project"]
    file: test.yml
    ref: master

test:
  script: echo hello

and you use a masked variable, Ci::MaskSecret throws an error because it's trying to gsub an array.

As a temporary fix, we will force the array into a string. For a permanent fix, we will validate that the project keyword use only a string. Issue: TBD

Screenshots or screen recordings

Before After
NO PIPELINE FOR YOU Screen_Shot_2022-06-21_at_8.09.41_PM Pipeline Screen_Shot_2022-06-21_at_8.10.35_PM

How to set up and validate locally

  1. Define a config with an include:project defined in an array:
# public-project
include:
  - project: ["lauraX/included-project"]
    file: test.yml
    ref: master

test:
  script: echo hello
  1. Create a masked variable whose value is the name of the project: Screen_Shot_2022-06-21_at_8.17.47_PM

  2. Run a pipeline

Issue: #360624 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Laura Montemayor

Merge request reports