SKIP_JOB_REGEX partial job name matching breaks CNG mirror pipelines on stable branches
## Summary When triggering a CNG pipeline from a stable branch, the `SKIP_JOB_REGEX` variable can inadvertently skip jobs it was never meant to skip, causing downstream pipeline failures. ## Root cause `SKIP_JOB_REGEX` is built by joining job names with `|` inside a bare regex like `/job-a|job-b|job-c/`. GitLab CI's `=~` operator performs **partial/substring matching**, so a job name that is a substring of another will match it unintentionally: - `gitlab-go` matches `gitlab-gomplate` - `gitaly` matches `gitaly-init-cgroups` When `gitlab-go`'s image already exists in the registry, it is added to the skip list. The resulting regex then also matches `gitlab-gomplate`, setting it to `when: never`. Since `gitlab-base` depends on `gitlab-gomplate`, the pipeline fails. ## Impact CNG mirror pipelines triggered from stable branches fail intermittently depending on which images already exist in the registry. ## Fix 1. Anchor the regex with `^(...)$` so each alternative matches the full job name only. 2. Escape each job name with `Regexp.escape` so metacharacters in a job name cannot alter matching behavior. ```ruby # Before "/#{jobs.join('|')}/" # After "/^(#{jobs.map { |j| Regexp.escape(j) }.join('|')})$/" Both DEFAULT_SKIPPED_JOB_REGEX (constant, used for the standard path) and skip_job_regex (method, used when skipping redundant jobs) were affected and have been corrected. ```
issue