Skip to content

Commit

Permalink
fix: In Gitlab, if an Atlantis 'Apply' Pipeline Job fails, it cannot …
Browse files Browse the repository at this point in the history
…be Re-Applied on the Same Commit (#4007)

* Fix GitLab CI Must Pass

* Fix projectID

* nolint:staticcheck

* nolint:gosec

* Fix formatting

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
  • Loading branch information
3 people committed Dec 12, 2023
1 parent 4d278ca commit d1661da
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
11 changes: 7 additions & 4 deletions server/events/vcs/gitlab_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,17 @@ func (g *GitlabClient) PullIsMergeable(repo models.Repo, pull models.PullRequest

allowSkippedPipeline := project.AllowMergeOnSkippedPipeline && isPipelineSkipped

ok, err := g.SupportsDetailedMergeStatus()
supportsDetailedMergeStatus, err := g.SupportsDetailedMergeStatus()
if err != nil {
return false, err
}

if ((ok && (mr.DetailedMergeStatus == "mergeable" || mr.DetailedMergeStatus == "ci_still_running")) ||
//nolint:staticcheck // SA1019 this check ensures compatibility with older gitlab versions
(!ok && mr.MergeStatus == "can_be_merged")) &&
if ((supportsDetailedMergeStatus &&
(mr.DetailedMergeStatus == "mergeable" ||
mr.DetailedMergeStatus == "ci_still_running" ||
mr.DetailedMergeStatus == "ci_must_pass")) ||
(!supportsDetailedMergeStatus &&
mr.MergeStatus == "can_be_merged")) && //nolint:staticcheck // Need to reference deprecated field for backwards compatibility
mr.ApprovalsBeforeMerge <= 0 &&
mr.BlockingDiscussionsResolved &&
!mr.WorkInProgress &&
Expand Down

0 comments on commit d1661da

Please sign in to comment.