You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Overview of the Issue
If an Atlantis 'apply' pipeline job fails, using Gitlab with 'Pipelines must succeed' configured on the repo and Atlantis apply_requirements: mergeable set, Atlantis will reject any attempt to re-run the apply on the same commit with the error 'Pull request must be mergeable before running apply.'
Environment details
Atlantis version: 0.26.0
Atlantis server-side config file:
repos:
- id: /.*/apply_requirements: mergeable
Additional Context
This is due to the GitLab client PullIsMergeable function not considering that a pull request is mergeable if the mr.DetailedMergeStatus has a value of ci_must_pass:
if ((ok&& (mr.DetailedMergeStatus=="mergeable"||mr.DetailedMergeStatus=="ci_still_running")) ||
This will occur if GitLab 'Pipelines must succeed' is configured on the repo and an Atlantis apply pipeline job has previously failed on the commit, therefore as far as GitLab is concerned, not all the CI jobs have succeeded, therefore the DetailedMergeStatus will be ci_must_pass.
The function already individually checks all the commit statuses, and will return false if any other status other than Atlantis Apply statuses do not have a status of success, so allowing this status will not stop other non-Atlantis failed CI checks from preventing an Atlantis apply.
Community Note
Overview of the Issue
If an Atlantis 'apply' pipeline job fails, using Gitlab with 'Pipelines must succeed' configured on the repo and Atlantis
apply_requirements: mergeable
set, Atlantis will reject any attempt to re-run the apply on the same commit with the error 'Pull request must be mergeable before running apply.'Environment details
Atlantis server-side config file:
Additional Context
This is due to the GitLab client
PullIsMergeable
function not considering that a pull request is mergeable if themr.DetailedMergeStatus
has a value ofci_must_pass
:atlantis/server/events/vcs/gitlab_client.go
Line 331 in 6ff0e2f
This will occur if GitLab 'Pipelines must succeed' is configured on the repo and an Atlantis apply pipeline job has previously failed on the commit, therefore as far as GitLab is concerned, not all the CI jobs have succeeded, therefore the
DetailedMergeStatus
will beci_must_pass
.The function already individually checks all the commit statuses, and will return
false
if any other status other than Atlantis Apply statuses do not have a status ofsuccess
, so allowing this status will not stop other non-Atlantis failed CI checks from preventing an Atlantis apply.GitLab Merge Status Reference: https://docs.gitlab.com/ee/api/merge_requests.html#merge-status
The text was updated successfully, but these errors were encountered: