Ref in the CI Lint API is ignored

Summary

When using the CI Lint API to check pipeline configurations the documentation states

ref can be specified

When dry_run is true, sets the branch or tag to use. Defaults to the project’s default branch when not set.

Currently the API calls ignore ref completely.

Steps to reproduce

  • in a project create a .gitlab-ci.yml file in the main branch
  • create a branch named test from main
  • edit the .gitlab-ci.yml in the test branch to make it invalid
  • run the following two API calls against this project
  1. https://gitlab.example.com/api/v4/projects/xxxxx/ci/lint?dry_run=true&ref=main
  2. https://gitlab.example.com/api/v4/projects/xxxxx/ci/lint?dry_run=true&ref=test

Example Project

What is the current bug behavior?

Both API calls return the same lint information against the .gitlab-ci.yml in the main branch.

What is the expected correct behavior?

The second API call should check the .gitlab-ci.yml in the test branch instead.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes