Fix FF `ci_includes_count_duplicates` condition to check variable type
What does this MR do and why?
Upon rolling out the FF ci_includes_count_duplicates
introduced by Update CI includes counting structure to includ... (!111726 - merged), an incident occurred, which was due to mismatching Feature Flag project actors. This is explained in more detail here.
The specific error that arose was due to .add
being called on an Array
. This MR prevents this issue by implementing a variable type check. This change will only be necessary until ci_includes_count_duplicates
is removed.
Related corrective action issue: https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/17420
How to reproduce the error locally
With the current master branch checked out:
- Create 2 projects
Project 1
andProject 2
. - In
Project 1
, create a filetemplate1.yml
with the following content:
template1-job:
script: echo 'test'
- In
Project 1
, update the.gitlab-ci.yml
file with the following content:
include:
- local: template1.yml
- local: template1.yml
- In
Project 2
, update the.gitlab-ci.yml
to includeProject 1
. Example:
include:
- project: group-a/project-1
file: .gitlab-ci.yml
- Enable FF
ci_includes_count_duplicates
for onlyProject 2
.
Feature.disable(:ci_includes_count_duplicates) # Ensure it is off globally first
Feature.enable(:ci_includes_count_duplicates, Project.find_by(name: 'Project 2'))
- Run the pipeline in
Project 2
. Observe that you get the following error:
How to set up and validate locally
Check out this MR's branch, follow steps 1-6 above and observe that there is no error in Step 6.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #391517 (closed)