Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Gitlab, if an Atlantis 'Apply' Pipeline Job fails, it cannot be Re-Applied on the Same Commit #3999

Closed
X-Guardian opened this issue Nov 22, 2023 · 0 comments · Fixed by #4007
Labels
bug Something isn't working

Comments

@X-Guardian
Copy link
Contributor

Community Note

  • 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.

GitLab Merge Status Reference: https://docs.gitlab.com/ee/api/merge_requests.html#merge-status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant