diff --git a/server/events/vcs/gitlab_client.go b/server/events/vcs/gitlab_client.go index f96d964fda..030629c8b8 100644 --- a/server/events/vcs/gitlab_client.go +++ b/server/events/vcs/gitlab_client.go @@ -283,7 +283,7 @@ func (g *GitlabClient) PullIsMergeable(repo models.Repo, pull models.PullRequest // Prevent nil pointer error when mr.HeadPipeline is empty // See: https://github.com/runatlantis/atlantis/issues/1852 commit := pull.HeadCommit - isPipelineSkipped := true + isPipelineSkipped := false if mr.HeadPipeline != nil { commit = mr.HeadPipeline.SHA isPipelineSkipped = mr.HeadPipeline.Status == "skipped" diff --git a/server/events/vcs/gitlab_client_test.go b/server/events/vcs/gitlab_client_test.go index 5d4e6a701b..bca29ab26c 100644 --- a/server/events/vcs/gitlab_client_test.go +++ b/server/events/vcs/gitlab_client_test.go @@ -367,6 +367,27 @@ func TestGitlabClient_PullIsMergeable(t *testing.T) { defaultMr, true, }, + { + fmt.Sprintf("%s/apply: resource/default", vcsStatusName), + models.FailedCommitStatus, + gitlabServerVersions, + noHeadPipelineMR, + true, + }, + { + fmt.Sprintf("%s/apply", vcsStatusName), + models.FailedCommitStatus, + gitlabServerVersions, + noHeadPipelineMR, + true, + }, + { + fmt.Sprintf("%s/plan: resource/default", vcsStatusName), + models.FailedCommitStatus, + gitlabServerVersions, + noHeadPipelineMR, + false, + }, { fmt.Sprintf("%s/plan", vcsStatusName), models.PendingCommitStatus, @@ -376,10 +397,10 @@ func TestGitlabClient_PullIsMergeable(t *testing.T) { }, { fmt.Sprintf("%s/plan", vcsStatusName), - models.FailedCommitStatus, + models.SuccessCommitStatus, gitlabServerVersions, noHeadPipelineMR, - false, + true, }, } for _, serverVersion := range gitlabServerVersions {