[18.10] Scope start-rails-specs changes rule to MR pipelines

What does this MR do and why?

This MR backports !8673 (merged) to fix the start-rails-specs CI job failing on tag pipelines with:

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

The start-rails-specs job had a changes rule for .tool-versions without an if condition, causing it to match tag pipelines where $CI_MERGE_REQUEST_PROJECT_PATH is unset.

Fix:

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

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

  • Clean cherry-pick from ffacaf39b

Merge request reports

Loading