From 09782c4b6d76eca8dcfba246802195eba817cd61 Mon Sep 17 00:00:00 2001 From: Pratik Mallya Date: Sun, 3 Feb 2019 22:53:29 -0800 Subject: [PATCH 1/2] Allow "Mergeable" apply requirement to work Get the Mergeable status of the PR before updating the Status. This allows for the Status to be a required Status for merging the PR. This allows us to use the atlantis status as a Required status, which is the configuration often used, since most deployments want to ensure tf plans have all been successfully applied before merging Issue: https://github.com/runatlantis/atlantis/issues/453 --- server/events/command_context.go | 3 + server/events/command_runner.go | 14 +- server/events/models/models.go | 6 +- server/events/project_command_builder.go | 1 + server/events/project_command_runner.go | 11 +- server/events/project_command_runner_test.go | 124 +++++++++++------- .../mocks/mock_pull_mergeable_checker.go | 106 --------------- .../events/runtime/pull_mergeable_checker.go | 11 -- server/server.go | 3 +- 9 files changed, 98 insertions(+), 181 deletions(-) delete mode 100644 server/events/runtime/mocks/mock_pull_mergeable_checker.go delete mode 100644 server/events/runtime/pull_mergeable_checker.go diff --git a/server/events/command_context.go b/server/events/command_context.go index 497adcd504..5c9a7d2e02 100644 --- a/server/events/command_context.go +++ b/server/events/command_context.go @@ -32,4 +32,7 @@ type CommandContext struct { // User is the user that triggered this command. User models.User Log *logging.SimpleLogger + // Mergeable tells us whether Pull is mergeable before changing the status of the Pull + // PullMergeable is true if Pull is able to be merged. + PullMergeable bool } diff --git a/server/events/command_runner.go b/server/events/command_runner.go index 2e28507185..fe9ab68b13 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -15,6 +15,7 @@ package events import ( "fmt" + "github.com/google/go-github/github" "github.com/lkysow/go-gitlab" "github.com/pkg/errors" @@ -167,7 +168,18 @@ func (c *DefaultCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHead if !c.validateCtxAndComment(ctx) { return } - if err = c.CommitStatusUpdater.Update(baseRepo, pull, models.PendingCommitStatus, cmd.CommandName()); err != nil { + + if cmd.CommandName() == ApplyCommand { + ctx.PullMergeable, err = c.VCSClient.PullIsMergeable(baseRepo, pull) + if err != nil { + // On error we continue the request with mergeable assumed false. + // We want to continue because not all apply's will need this status, + // only if they rely on the mergeability requirement. + ctx.PullMergeable = false + ctx.Log.Warn("unable to get mergeable status: %s. Continuing with mergeable assumed false", err) + } + } + if err = c.CommitStatusUpdater.Update(ctx.BaseRepo, ctx.Pull, models.PendingCommitStatus, cmd.CommandName()); err != nil { ctx.Log.Warn("unable to update commit status: %s", err) } diff --git a/server/events/models/models.go b/server/events/models/models.go index a9eee5a141..968e7acd40 100644 --- a/server/events/models/models.go +++ b/server/events/models/models.go @@ -293,8 +293,10 @@ type ProjectCommandContext struct { // If the pull request branch is from the same repository then HeadRepo will // be the same as BaseRepo. // See https://help.github.com/articles/about-pull-request-merges/. - HeadRepo Repo - Log *logging.SimpleLogger + HeadRepo Repo + Log *logging.SimpleLogger + // PullMergeable is true if the pull request for this project is able to be merged. + PullMergeable bool Pull PullRequest ProjectConfig *valid.Project // RePlanCmd is the command that users should run to re-plan this project. diff --git a/server/events/project_command_builder.go b/server/events/project_command_builder.go index fb113ec5c7..e98350bec8 100644 --- a/server/events/project_command_builder.go +++ b/server/events/project_command_builder.go @@ -321,6 +321,7 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *CommandContex GlobalConfig: globalCfg, RePlanCmd: p.CommentBuilder.BuildPlanComment(repoRelDir, workspace, projectName, commentFlags), ApplyCmd: p.CommentBuilder.BuildApplyComment(repoRelDir, workspace, projectName), + PullMergeable: ctx.PullMergeable, }, nil } diff --git a/server/events/project_command_runner.go b/server/events/project_command_runner.go index f2ec230ef5..77789d86a7 100644 --- a/server/events/project_command_runner.go +++ b/server/events/project_command_runner.go @@ -83,7 +83,6 @@ type DefaultProjectCommandRunner struct { ApplyStepRunner StepRunner RunStepRunner StepRunner PullApprovedChecker runtime.PullApprovedChecker - PullMergeableChecker runtime.PullMergeableChecker WorkingDir WorkingDir Webhooks WebhooksSender WorkingDirLocker WorkingDirLocker @@ -144,7 +143,7 @@ func (p *DefaultProjectCommandRunner) doPlan(ctx models.ProjectCommandContext) ( return nil, "", cloneErr } projAbsPath := filepath.Join(repoDir, ctx.RepoRelDir) - if _, err := os.Stat(projAbsPath); os.IsNotExist(err) { + if _, err = os.Stat(projAbsPath); os.IsNotExist(err) { return nil, "", DirNotExistErr{RepoRelDir: ctx.RepoRelDir} } @@ -209,7 +208,7 @@ func (p *DefaultProjectCommandRunner) doApply(ctx models.ProjectCommandContext) return "", "", err } absPath := filepath.Join(repoDir, ctx.RepoRelDir) - if _, err := os.Stat(absPath); os.IsNotExist(err) { + if _, err = os.Stat(absPath); os.IsNotExist(err) { return "", "", DirNotExistErr{RepoRelDir: ctx.RepoRelDir} } @@ -238,11 +237,7 @@ func (p *DefaultProjectCommandRunner) doApply(ctx models.ProjectCommandContext) return "", "Pull request must be approved before running apply.", nil } case raw.MergeableApplyRequirement: - mergeable, err := p.PullMergeableChecker.PullIsMergeable(ctx.BaseRepo, ctx.Pull) // nolint: vetshadow - if err != nil { - return "", "", errors.Wrap(err, "checking if pull request is mergeable") - } - if !mergeable { + if !ctx.PullMergeable { return "", "Pull request must be mergeable before running apply.", nil } } diff --git a/server/events/project_command_runner_test.go b/server/events/project_command_runner_test.go index 390f81ed21..ef1caf4f7e 100644 --- a/server/events/project_command_runner_test.go +++ b/server/events/project_command_runner_test.go @@ -134,17 +134,16 @@ func TestDefaultProjectCommandRunner_Plan(t *testing.T) { mockLocker := mocks.NewMockProjectLocker() runner := events.DefaultProjectCommandRunner{ - Locker: mockLocker, - LockURLGenerator: mockURLGenerator{}, - InitStepRunner: mockInit, - PlanStepRunner: mockPlan, - ApplyStepRunner: mockApply, - RunStepRunner: mockRun, - PullApprovedChecker: nil, - PullMergeableChecker: nil, - WorkingDir: mockWorkingDir, - Webhooks: nil, - WorkingDirLocker: events.NewDefaultWorkingDirLocker(), + Locker: mockLocker, + LockURLGenerator: mockURLGenerator{}, + InitStepRunner: mockInit, + PlanStepRunner: mockPlan, + ApplyStepRunner: mockApply, + RunStepRunner: mockRun, + PullApprovedChecker: nil, + WorkingDir: mockWorkingDir, + Webhooks: nil, + WorkingDirLocker: events.NewDefaultWorkingDirLocker(), } repoDir, cleanup := TempDir(t) @@ -236,10 +235,8 @@ func TestDefaultProjectCommandRunner_ApplyNotApproved(t *testing.T) { func TestDefaultProjectCommandRunner_ApplyNotMergeable(t *testing.T) { RegisterMockTestingT(t) mockWorkingDir := mocks.NewMockWorkingDir() - mockMergeable := mocks2.NewMockPullMergeableChecker() runner := &events.DefaultProjectCommandRunner{ WorkingDir: mockWorkingDir, - PullMergeableChecker: mockMergeable, WorkingDirLocker: events.NewDefaultWorkingDirLocker(), RequireMergeableOverride: true, } @@ -247,7 +244,6 @@ func TestDefaultProjectCommandRunner_ApplyNotMergeable(t *testing.T) { tmp, cleanup := TempDir(t) defer cleanup() When(mockWorkingDir.GetWorkingDir(ctx.BaseRepo, ctx.Pull, ctx.Workspace)).ThenReturn(tmp, nil) - When(mockMergeable.PullIsMergeable(ctx.BaseRepo, ctx.Pull)).ThenReturn(false, nil) res := runner.Apply(ctx) Equals(t, "Pull request must be mergeable before running apply.", res.Failure) @@ -255,18 +251,21 @@ func TestDefaultProjectCommandRunner_ApplyNotMergeable(t *testing.T) { func TestDefaultProjectCommandRunner_Apply(t *testing.T) { cases := []struct { - description string - projCfg *valid.Project - globalCfg *valid.Config - expSteps []string - expOut string + description string + projCfg *valid.Project + globalCfg *valid.Config + expSteps []string + expOut string + expFailure string + pullMergeable bool }{ { - description: "use defaults", - projCfg: nil, - globalCfg: nil, - expSteps: []string{"apply"}, - expOut: "apply", + description: "use defaults", + projCfg: nil, + globalCfg: nil, + expSteps: []string{"apply"}, + expOut: "apply", + pullMergeable: true, }, { description: "no workflow, use defaults", @@ -281,8 +280,9 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { }, }, }, - expSteps: []string{"apply"}, - expOut: "apply", + expSteps: []string{"apply"}, + expOut: "apply", + pullMergeable: true, }, { description: "no workflow, approval required, use defaults", @@ -299,8 +299,9 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { }, }, }, - expSteps: []string{"approve", "apply"}, - expOut: "apply", + expSteps: []string{"approve", "apply"}, + expOut: "apply", + pullMergeable: true, }, { description: "no workflow, mergeable required, use defaults", @@ -317,8 +318,29 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { }, }, }, - expSteps: []string{"mergeable", "apply"}, - expOut: "apply", + expSteps: []string{"apply"}, + expOut: "apply", + pullMergeable: true, + }, + { + description: "no workflow, mergeable required, use defaults, commit unmergeable", + projCfg: &valid.Project{ + Dir: ".", + ApplyRequirements: []string{"mergeable"}, + }, + globalCfg: &valid.Config{ + Version: 2, + Projects: []valid.Project{ + { + Dir: ".", + ApplyRequirements: []string{"mergeable"}, + }, + }, + }, + expSteps: []string{""}, + expOut: "", + expFailure: "Pull request must be mergeable before running apply.", + pullMergeable: false, }, { description: "no workflow, mergeable and approved required, use defaults", @@ -335,8 +357,9 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { }, }, }, - expSteps: []string{"mergeable", "approved", "apply"}, - expOut: "apply", + expSteps: []string{"approved", "apply"}, + expOut: "apply", + pullMergeable: true, }, { description: "workflow without apply stage set", @@ -359,8 +382,9 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { }, }, }, - expSteps: []string{"apply"}, - expOut: "apply", + expSteps: []string{"apply"}, + expOut: "apply", + pullMergeable: true, }, { description: "workflow with custom apply stage", @@ -396,8 +420,9 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { }, }, }, - expSteps: []string{"run", "apply", "plan", "init"}, - expOut: "run\napply\nplan\ninit", + expSteps: []string{"run", "apply", "plan", "init"}, + expOut: "run\napply\nplan\ninit", + pullMergeable: true, }, } @@ -409,23 +434,21 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { mockApply := mocks.NewMockStepRunner() mockRun := mocks.NewMockStepRunner() mockApproved := mocks2.NewMockPullApprovedChecker() - mockMergeable := mocks2.NewMockPullMergeableChecker() mockWorkingDir := mocks.NewMockWorkingDir() mockLocker := mocks.NewMockProjectLocker() mockSender := mocks.NewMockWebhooksSender() runner := events.DefaultProjectCommandRunner{ - Locker: mockLocker, - LockURLGenerator: mockURLGenerator{}, - InitStepRunner: mockInit, - PlanStepRunner: mockPlan, - ApplyStepRunner: mockApply, - RunStepRunner: mockRun, - PullApprovedChecker: mockApproved, - PullMergeableChecker: mockMergeable, - WorkingDir: mockWorkingDir, - Webhooks: mockSender, - WorkingDirLocker: events.NewDefaultWorkingDirLocker(), + Locker: mockLocker, + LockURLGenerator: mockURLGenerator{}, + InitStepRunner: mockInit, + PlanStepRunner: mockPlan, + ApplyStepRunner: mockApply, + RunStepRunner: mockRun, + PullApprovedChecker: mockApproved, + WorkingDir: mockWorkingDir, + Webhooks: mockSender, + WorkingDirLocker: events.NewDefaultWorkingDirLocker(), } repoDir, cleanup := TempDir(t) defer cleanup() @@ -441,23 +464,22 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { Workspace: "default", GlobalConfig: c.globalCfg, RepoRelDir: ".", + PullMergeable: c.pullMergeable, } When(mockInit.Run(ctx, nil, repoDir)).ThenReturn("init", nil) When(mockPlan.Run(ctx, nil, repoDir)).ThenReturn("plan", nil) When(mockApply.Run(ctx, nil, repoDir)).ThenReturn("apply", nil) When(mockRun.Run(ctx, nil, repoDir)).ThenReturn("run", nil) When(mockApproved.PullIsApproved(ctx.BaseRepo, ctx.Pull)).ThenReturn(true, nil) - When(mockMergeable.PullIsMergeable(ctx.BaseRepo, ctx.Pull)).ThenReturn(true, nil) res := runner.Apply(ctx) Equals(t, c.expOut, res.ApplySuccess) + Equals(t, c.expFailure, res.Failure) for _, step := range c.expSteps { switch step { case "approved": mockApproved.VerifyWasCalledOnce().PullIsApproved(ctx.BaseRepo, ctx.Pull) - case "mergeable": - mockMergeable.VerifyWasCalledOnce().PullIsMergeable(ctx.BaseRepo, ctx.Pull) case "init": mockInit.VerifyWasCalledOnce().Run(ctx, nil, repoDir) case "plan": diff --git a/server/events/runtime/mocks/mock_pull_mergeable_checker.go b/server/events/runtime/mocks/mock_pull_mergeable_checker.go deleted file mode 100644 index 3ef3eb93fe..0000000000 --- a/server/events/runtime/mocks/mock_pull_mergeable_checker.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -// Source: github.com/runatlantis/atlantis/server/events/runtime (interfaces: PullMergeableChecker) - -package mocks - -import ( - pegomock "github.com/petergtz/pegomock" - models "github.com/runatlantis/atlantis/server/events/models" - "reflect" - "time" -) - -type MockPullMergeableChecker struct { - fail func(message string, callerSkip ...int) -} - -func NewMockPullMergeableChecker() *MockPullMergeableChecker { - return &MockPullMergeableChecker{fail: pegomock.GlobalFailHandler} -} - -func (mock *MockPullMergeableChecker) PullIsMergeable(baseRepo models.Repo, pull models.PullRequest) (bool, error) { - if mock == nil { - panic("mock must not be nil. Use myMock := NewMockPullMergeableChecker().") - } - params := []pegomock.Param{baseRepo, pull} - result := pegomock.GetGenericMockFrom(mock).Invoke("PullIsMergeable", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) - var ret0 bool - var ret1 error - if len(result) != 0 { - if result[0] != nil { - ret0 = result[0].(bool) - } - if result[1] != nil { - ret1 = result[1].(error) - } - } - return ret0, ret1 -} - -func (mock *MockPullMergeableChecker) VerifyWasCalledOnce() *VerifierPullMergeableChecker { - return &VerifierPullMergeableChecker{ - mock: mock, - invocationCountMatcher: pegomock.Times(1), - } -} - -func (mock *MockPullMergeableChecker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierPullMergeableChecker { - return &VerifierPullMergeableChecker{ - mock: mock, - invocationCountMatcher: invocationCountMatcher, - } -} - -func (mock *MockPullMergeableChecker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierPullMergeableChecker { - return &VerifierPullMergeableChecker{ - mock: mock, - invocationCountMatcher: invocationCountMatcher, - inOrderContext: inOrderContext, - } -} - -func (mock *MockPullMergeableChecker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierPullMergeableChecker { - return &VerifierPullMergeableChecker{ - mock: mock, - invocationCountMatcher: invocationCountMatcher, - timeout: timeout, - } -} - -type VerifierPullMergeableChecker struct { - mock *MockPullMergeableChecker - invocationCountMatcher pegomock.Matcher - inOrderContext *pegomock.InOrderContext - timeout time.Duration -} - -func (verifier *VerifierPullMergeableChecker) PullIsMergeable(baseRepo models.Repo, pull models.PullRequest) *PullMergeableChecker_PullIsMergeable_OngoingVerification { - params := []pegomock.Param{baseRepo, pull} - methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsMergeable", params, verifier.timeout) - return &PullMergeableChecker_PullIsMergeable_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} -} - -type PullMergeableChecker_PullIsMergeable_OngoingVerification struct { - mock *MockPullMergeableChecker - methodInvocations []pegomock.MethodInvocation -} - -func (c *PullMergeableChecker_PullIsMergeable_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - baseRepo, pull := c.GetAllCapturedArguments() - return baseRepo[len(baseRepo)-1], pull[len(pull)-1] -} - -func (c *PullMergeableChecker_PullIsMergeable_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { - params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) - if len(params) > 0 { - _param0 = make([]models.Repo, len(params[0])) - for u, param := range params[0] { - _param0[u] = param.(models.Repo) - } - _param1 = make([]models.PullRequest, len(params[1])) - for u, param := range params[1] { - _param1[u] = param.(models.PullRequest) - } - } - return -} diff --git a/server/events/runtime/pull_mergeable_checker.go b/server/events/runtime/pull_mergeable_checker.go deleted file mode 100644 index 51a9a267a3..0000000000 --- a/server/events/runtime/pull_mergeable_checker.go +++ /dev/null @@ -1,11 +0,0 @@ -package runtime - -import ( - "github.com/runatlantis/atlantis/server/events/models" -) - -//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_pull_mergeable_checker.go PullMergeableChecker - -type PullMergeableChecker interface { - PullIsMergeable(baseRepo models.Repo, pull models.PullRequest) (bool, error) -} diff --git a/server/server.go b/server/server.go index 2f69bdbd8b..3e33f96a7a 100644 --- a/server/server.go +++ b/server/server.go @@ -30,7 +30,7 @@ import ( "syscall" "time" - "github.com/elazarl/go-bindata-assetfs" + assetfs "github.com/elazarl/go-bindata-assetfs" "github.com/gorilla/mux" "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/events" @@ -263,7 +263,6 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) { DefaultTFVersion: defaultTfVersion, }, PullApprovedChecker: vcsClient, - PullMergeableChecker: vcsClient, WorkingDir: workingDir, Webhooks: webhooksManager, WorkingDirLocker: workingDirLocker, From 4e429581b03a6117f733fc4ae5f3976522fe190d Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Mon, 11 Feb 2019 14:41:10 -0600 Subject: [PATCH 2/2] Refactor changes to get mergeability early --- server/events/command_context.go | 6 ++++-- server/events/command_runner.go | 9 +++++++-- server/events/project_command_builder.go | 2 ++ server/events/project_command_runner_test.go | 2 +- server/server.go | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/server/events/command_context.go b/server/events/command_context.go index 5c9a7d2e02..5a2bcfe0b7 100644 --- a/server/events/command_context.go +++ b/server/events/command_context.go @@ -32,7 +32,9 @@ type CommandContext struct { // User is the user that triggered this command. User models.User Log *logging.SimpleLogger - // Mergeable tells us whether Pull is mergeable before changing the status of the Pull - // PullMergeable is true if Pull is able to be merged. + // PullMergeable is true if Pull is able to be merged. This is available in + // the CommandContext because we want to collect this information before we + // set our own build statuses which can affect mergeability if users have + // required the Atlantis status to be successful prior to merging. PullMergeable bool } diff --git a/server/events/command_runner.go b/server/events/command_runner.go index fe9ab68b13..380d14f70b 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -15,7 +15,6 @@ package events import ( "fmt" - "github.com/google/go-github/github" "github.com/lkysow/go-gitlab" "github.com/pkg/errors" @@ -170,6 +169,10 @@ func (c *DefaultCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHead } if cmd.CommandName() == ApplyCommand { + // Get the mergeable status before we set any build statuses of our own. + // We do this here because when we set a "Pending" status, if users have + // required the Atlantis status checks to pass, then we've now changed + // the mergeability status of the pull request. ctx.PullMergeable, err = c.VCSClient.PullIsMergeable(baseRepo, pull) if err != nil { // On error we continue the request with mergeable assumed false. @@ -178,8 +181,10 @@ func (c *DefaultCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHead ctx.PullMergeable = false ctx.Log.Warn("unable to get mergeable status: %s. Continuing with mergeable assumed false", err) } + ctx.Log.Info("pull request mergeable status: %t", ctx.PullMergeable) } - if err = c.CommitStatusUpdater.Update(ctx.BaseRepo, ctx.Pull, models.PendingCommitStatus, cmd.CommandName()); err != nil { + + if err = c.CommitStatusUpdater.Update(baseRepo, pull, models.PendingCommitStatus, cmd.CommandName()); err != nil { ctx.Log.Warn("unable to update commit status: %s", err) } diff --git a/server/events/project_command_builder.go b/server/events/project_command_builder.go index e98350bec8..18c118c998 100644 --- a/server/events/project_command_builder.go +++ b/server/events/project_command_builder.go @@ -144,6 +144,7 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *CommandContext, Verbose: verbose, RePlanCmd: p.CommentBuilder.BuildPlanComment(mp.Path, DefaultWorkspace, "", commentFlags), ApplyCmd: p.CommentBuilder.BuildApplyComment(mp.Path, DefaultWorkspace, ""), + PullMergeable: ctx.PullMergeable, }) } } else { @@ -173,6 +174,7 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *CommandContext, Verbose: verbose, RePlanCmd: p.CommentBuilder.BuildPlanComment(mp.Dir, mp.Workspace, mp.GetName(), commentFlags), ApplyCmd: p.CommentBuilder.BuildApplyComment(mp.Dir, mp.Workspace, mp.GetName()), + PullMergeable: ctx.PullMergeable, }) } } diff --git a/server/events/project_command_runner_test.go b/server/events/project_command_runner_test.go index ef1caf4f7e..cccfde694f 100644 --- a/server/events/project_command_runner_test.go +++ b/server/events/project_command_runner_test.go @@ -323,7 +323,7 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { pullMergeable: true, }, { - description: "no workflow, mergeable required, use defaults, commit unmergeable", + description: "no workflow, mergeable required, pull not mergeable", projCfg: &valid.Project{ Dir: ".", ApplyRequirements: []string{"mergeable"}, diff --git a/server/server.go b/server/server.go index 3e33f96a7a..fb16cbd992 100644 --- a/server/server.go +++ b/server/server.go @@ -30,7 +30,7 @@ import ( "syscall" "time" - assetfs "github.com/elazarl/go-bindata-assetfs" + "github.com/elazarl/go-bindata-assetfs" "github.com/gorilla/mux" "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/events"