Skip to content

Fix checking the gitlab_ci_yml of a project

Furkan Ayhan requested to merge 26169-fix-and-refactor-gitlab_ci_yml into master

What does this MR do and why?

We currently use repository.gitlab_ci_yml.present? to check if a project has a .gitlab-ci.yml file in HEAD. However, this is not a correct approach because a project can have a custom CI config file set.

In this change, we are introducing has_ci_config_file? to check if a project has a set CI config file in its repository HEAD. This is both a bug fix and a refactoring.

If the feature flag rollout becomes successful, then we can also remove the gitlab_ci_yml method in the next iteration.

This change is behind a feature flag ci_refactor_has_ci_config_file (gitlab-com/gl-infra/production#17406 (closed)).

Related to #26169

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots

  1. Create a project with a custom CI config file.

Screenshot_2024-01-19_at_11.35.00

  1. Check these areas;

A. Project repository page

Before enabling the FF ci_refactor_has_ci_config_file;

Screenshot_2024-01-19_at_11.37.40

After enabling the FF ci_refactor_has_ci_config_file;

Screenshot_2024-01-19_at_11.46.08

B. Project security configuration page

Before enabling the FF ci_refactor_has_ci_config_file;

Screenshot_2024-01-19_at_11.43.50

After enabling the FF ci_refactor_has_ci_config_file;

Screenshot_2024-01-19_at_11.45.49

Edited by Furkan Ayhan

Merge request reports