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 expectedcurl: (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-versionsThis matches any pipeline type, including tag pipelines. On tag pipelines, $CI_MERGE_REQUEST_PROJECT_PATH is unset, causing:
- A bash syntax error from the unquoted variable in
[ $CI_MERGE_REQUEST_PROJECT_PATH == '...' ] - The wrong
GITLAB_PROJECT_IDbeing used, leading to a 401 from the API
Fix
- Scope the
changesrule to MR pipelines by adding anifcondition - Quote
$CI_MERGE_REQUEST_PROJECT_PATHin all bash comparisons for defensive coding
Example failing job
https://gitlab.com/gitlab-org/security/gitaly/-/jobs/13918003838