Skip to content

Commit

Permalink
fix the SEV?
Browse files Browse the repository at this point in the history
  • Loading branch information
smonero committed Jul 23, 2024
1 parent 31f1f02 commit 05d4868
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
5 changes: 5 additions & 0 deletions server/legacy/events/policy_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func (p *ApprovedPolicyFilter) Filter(ctx context.Context, installationToken int
return failedPolicies, nil
}

// Dismiss PR reviews when event came from pull request change/atlantis plan comment
if trigger == command.AutoTrigger || trigger == command.CommentTrigger {
return failedPolicies, nil
}

// Fetch reviewers who approved the PR
approvedReviewers, err := p.prReviewFetcher.ListLatestApprovalUsernames(ctx, installationToken, repo, prNum)
if err != nil {
Expand Down
37 changes: 10 additions & 27 deletions server/legacy/lyft/command/feature_runner.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package command

import (
"github.com/runatlantis/atlantis/server/config/valid"
"github.com/runatlantis/atlantis/server/legacy/events"
"github.com/runatlantis/atlantis/server/legacy/events/command"
"github.com/runatlantis/atlantis/server/logging"
Expand Down Expand Up @@ -61,42 +60,26 @@ type PlatformModeProjectRunner struct { //create object and test

// Plan runs terraform plan for the project described by ctx.
func (p *PlatformModeProjectRunner) Plan(ctx command.ProjectContext) command.ProjectResult {
if ctx.WorkflowModeType == valid.PlatformWorkflowMode {
return p.PlatformModeRunner.Plan(ctx)
}

return p.PrModeRunner.Plan(ctx)
return p.PlatformModeRunner.Plan(ctx)
}

// PolicyCheck evaluates policies defined with Rego for the project described by ctx.
func (p *PlatformModeProjectRunner) PolicyCheck(ctx command.ProjectContext) command.ProjectResult {
if ctx.WorkflowModeType == valid.PlatformWorkflowMode {
return p.PlatformModeRunner.PolicyCheck(ctx)
}

return p.PrModeRunner.PolicyCheck(ctx)
return p.PlatformModeRunner.PolicyCheck(ctx)
}

// Apply runs terraform apply for the project described by ctx.
func (p *PlatformModeProjectRunner) Apply(ctx command.ProjectContext) command.ProjectResult {
if ctx.WorkflowModeType == valid.PlatformWorkflowMode {
return command.ProjectResult{
Command: command.Apply,
RepoRelDir: ctx.RepoRelDir,
Workspace: ctx.Workspace,
ProjectName: ctx.ProjectName,
StatusID: ctx.StatusID,
ApplySuccess: "atlantis apply is disabled for this project. Please track the deployment when the PR is merged. ",
}
return command.ProjectResult{
Command: command.Apply,
RepoRelDir: ctx.RepoRelDir,
Workspace: ctx.Workspace,
ProjectName: ctx.ProjectName,
StatusID: ctx.StatusID,
ApplySuccess: "atlantis apply is disabled for this project. Please track the deployment when the PR is merged. ",
}

return p.PrModeRunner.Apply(ctx)
}

func (p *PlatformModeProjectRunner) Version(ctx command.ProjectContext) command.ProjectResult {
if ctx.WorkflowModeType == valid.PlatformWorkflowMode {
return p.PlatformModeRunner.Version(ctx)
}

return p.PrModeRunner.Version(ctx)
return p.PlatformModeRunner.Version(ctx)
}

0 comments on commit 05d4868

Please sign in to comment.