mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 11:58:36 +00:00
* Adding policy_check support into yaml config * Added policy check model and runtime structs * Adding BuildPolicyCheckCommand to ProjectCommandBuilder * Return incorrectly deleted code * Remove BuildAutoPolicyPlanCommand from ProjectCommandBuilder * Split runAutoCommand into two functions runAutoPlanCommand - does what originally RunAutoplancommand was doing except now it returns CommandResult and []models.ProjectCommandContext runAutoPolicyCheckCommand - accepts CommandContext, CommandResult, and []models.ProjectCommandContext as arguments and runs PolicyCheckStep runner * Refactor RunCommentCommand * Remove BuildPolicyCheckCommand and rename StepCmdExec back to TerraformExec * Add policy step runner logic and conftest interfaces. * Add show step runner to policy check stage. * Adding models.PolicyCheckCommand to buildCtx This also means buildPlanAllCommands call buildCtx twice once with models.PlanCommand and once with models.PolicyCheckCommand * Adding new project_command_builder that supports policy_check * Refactoring PolicyCheck specific logic into a PolicyCheckProjectCommandBuilder * Moving events.CommandContext to models.CommandContext this will allow me to remove buildCtx method and move ProjectCommandContext creation into models package * Policy Owners might be different types, for that reason we are refactoring Owners into its own struct with specific keys defining different owner types Co-authored-by: Nish Krishnan <nishk@lyft.com> Co-authored-by: Nish Krishnan <nishkrishnan@users.noreply.github.com>
51 lines
1.9 KiB
Go
51 lines
1.9 KiB
Go
// Copyright 2017 HootSuite Media Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the License);
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an AS IS BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
// Modified hereafter by contributors to runatlantis/atlantis.
|
|
package events
|
|
|
|
import (
|
|
"github.com/runatlantis/atlantis/server/events/models"
|
|
"github.com/runatlantis/atlantis/server/logging"
|
|
)
|
|
|
|
// CommandTrigger represents the how the command was triggered
|
|
type CommandTrigger int
|
|
|
|
const (
|
|
// Commands that are automatically triggered (ie. automatic plans)
|
|
Auto CommandTrigger = iota
|
|
|
|
// Commands that are triggered by comments (ie. atlantis plan)
|
|
Comment
|
|
)
|
|
|
|
// CommandContext represents the context of a command that should be executed
|
|
// for a pull request.
|
|
type CommandContext struct {
|
|
// HeadRepo is the repository that is getting merged into the BaseRepo.
|
|
// 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 models.Repo
|
|
Pull models.PullRequest
|
|
// User is the user that triggered this command.
|
|
User models.User
|
|
Log *logging.SimpleLogger
|
|
// 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
|
|
|
|
Trigger CommandTrigger
|
|
}
|