Scope start-rails-specs changes rule to MR pipelines

What does this MR do?

Fixes the start-rails-specs CI job failing on tag pipelines (e.g. v18.11.0-rc42) with:

  • bash: line 216: [: ==: unary operator expected
  • curl: (22) The requested URL returned error: 401

Root cause

The start-rails-specs job has a changes rule for .tool-versions that lacks an if condition:

rules:
  - changes:
      - .tool-versions

This matches any pipeline type, including tag pipelines. On tag pipelines, $CI_MERGE_REQUEST_PROJECT_PATH is unset, causing:

  1. A bash syntax error from the unquoted variable in [ $CI_MERGE_REQUEST_PROJECT_PATH == '...' ]
  2. The wrong GITLAB_PROJECT_ID being used, leading to a 401 from the API

Fix

  1. Scope the changes rule to MR pipelines by adding an if condition
  2. Quote $CI_MERGE_REQUEST_PROJECT_PATH in all bash comparisons for defensive coding

Example failing job

https://gitlab.com/gitlab-org/security/gitaly/-/jobs/13918003838

Merge request reports

Loading