UI showing approvals are required and merge is blocked but API returns mergeable.

Summary

We’ve recently configured Atlantis to do CI/CD for our infra-as-code project. It does a number of things, including applying an infrastructure change via chatops in the MR, with centralized credentials. It is supposed to only allow applying if an MR is approved. We have found that it is consistently considering unmergeable MRs as mergeable. It does this determination via the GitLab API. When I run similar requests via the API, I am also getting results indicating the MR can be merged.

Steps to reproduce

  • Conditions: A project with MR Approvals set to: image
  • Symptoms:
    • (a) UI correctly shows MRs without any of the 2 required approvals as unmergeable.
    • (b) the API does not show approvals required before the merge

Example Project

What is the current bug behavior?

Merge requests UI showing approvals required and MR cannot be merged. API responds that MR can be merged. API also shows that there are not approvals. approvals_before_merge is blank.

What is the expected correct behavior?

API should return that the MR cannot be merged/requires approval. API should also return the approval count.

Relevant logs and/or screenshots

image

curl --silent --location --request GET "https://gitlab.com/api/v4/projects/xxxxxxxxx/merge_requests/142" \
--header "Private-Token: ${PRIVATE_TOKEN}" | jq '"merge_status =" + .merge_status + "; approvals_before_merge = " + .approvals_before_merge'
"merge_status =can_be_merged; approvals_before_merge = "

Output of checks

This bug happens on GitLab.com

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

Opened on behalf of a commercial customer https://gitlab.my.salesforce.com/00161000019fvSp (Internal)

Edited by Maxwell Power