raw

package
v0.27.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package raw contains the golang representations of the YAML elements supported in atlantis.yaml. The structs here represent the exact data that comes from the file before it is parsed/validated further.

Index

Constants

View Source
const (
	DefaultWorkspace      = "default"
	ApprovedRequirement   = "approved"
	MergeableRequirement  = "mergeable"
	UnDivergedRequirement = "undiverged"
)
View Source
const (
	ExtraArgsKey        = "extra_args"
	NameArgKey          = "name"
	CommandArgKey       = "command"
	ValueArgKey         = "value"
	OutputArgKey        = "output"
	RunStepName         = "run"
	PlanStepName        = "plan"
	ShowStepName        = "show"
	PolicyCheckStepName = "policy_check"
	ApplyStepName       = "apply"
	InitStepName        = "init"
	EnvStepName         = "env"
	MultiEnvStepName    = "multienv"
	ImportStepName      = "import"
	StateRmStepName     = "state_rm"
)
View Source
const DefaultAbortOnExcecutionOrderFail = false

DefaultAbortOnExcecutionOrderFail being false is the default setting for abort on execution group failiures

View Source
const DefaultEmojiReaction = ""

DefaultEmojiReaction is the default emoji reaction for repos

Variables

View Source
var DefaultAutoDiscoverMode = valid.AutoDiscoverAutoMode
View Source
var DefaultAutoPlanWhenModified = []string{
	"**/*.tf*",
	"**/terragrunt.hcl",
	"**/.terraform.lock.hcl",
}

DefaultAutoPlanWhenModified is the default element in the when_modified list if none is defined.

Functions

func DefaultAutoDiscover added in v0.27.0

func DefaultAutoDiscover() *valid.AutoDiscover

func DefaultAutoPlan

func DefaultAutoPlan() valid.Autoplan

DefaultAutoPlan returns the default autoplan config.

func VersionValidator

func VersionValidator(value interface{}) error

VersionValidator helper function to validate binary version. Function implements ozzo-validation::Rule.Validate interface.

Types

type AutoDiscover added in v0.27.0

type AutoDiscover struct {
	Mode *valid.AutoDiscoverMode `yaml:"mode,omitempty"`
}

func (AutoDiscover) ToValid added in v0.27.0

func (a AutoDiscover) ToValid() *valid.AutoDiscover

func (AutoDiscover) Validate added in v0.27.0

func (a AutoDiscover) Validate() error

type Autoplan

type Autoplan struct {
	WhenModified []string `yaml:"when_modified,omitempty"`
	Enabled      *bool    `yaml:"enabled,omitempty"`
}

func (Autoplan) ToValid

func (a Autoplan) ToValid() valid.Autoplan

func (Autoplan) Validate

func (a Autoplan) Validate() error

type GlobalCfg

type GlobalCfg struct {
	Repos      []Repo              `yaml:"repos" json:"repos"`
	Workflows  map[string]Workflow `yaml:"workflows" json:"workflows"`
	PolicySets PolicySets          `yaml:"policies" json:"policies"`
	Metrics    Metrics             `yaml:"metrics" json:"metrics"`
}

GlobalCfg is the raw schema for server-side repo config.

func (GlobalCfg) ToValid

func (g GlobalCfg) ToValid(defaultCfg valid.GlobalCfg) valid.GlobalCfg

func (GlobalCfg) Validate

func (g GlobalCfg) Validate() error

type Metrics added in v0.19.3

type Metrics struct {
	Statsd     *Statsd     `yaml:"statsd" json:"statsd"`
	Prometheus *Prometheus `yaml:"prometheus" json:"prometheus"`
}

func (Metrics) ToValid added in v0.19.3

func (m Metrics) ToValid() valid.Metrics

func (Metrics) Validate added in v0.19.3

func (m Metrics) Validate() error

type PolicyOwners

type PolicyOwners struct {
	Users []string `yaml:"users,omitempty" json:"users,omitempty"`
	Teams []string `yaml:"teams,omitempty" json:"teams,omitempty"`
}

func (PolicyOwners) ToValid

func (o PolicyOwners) ToValid() valid.PolicyOwners

type PolicySet

type PolicySet struct {
	Path         string       `yaml:"path" json:"path"`
	Source       string       `yaml:"source" json:"source"`
	Name         string       `yaml:"name" json:"name"`
	Owners       PolicyOwners `yaml:"owners,omitempty" json:"owners,omitempty"`
	ApproveCount int          `yaml:"approve_count,omitempty" json:"approve_count,omitempty"`
}

func (PolicySet) ToValid

func (p PolicySet) ToValid() valid.PolicySet

func (PolicySet) Validate

func (p PolicySet) Validate() error

type PolicySets

type PolicySets struct {
	Version      *string      `yaml:"conftest_version,omitempty" json:"conftest_version,omitempty"`
	Owners       PolicyOwners `yaml:"owners,omitempty" json:"owners,omitempty"`
	PolicySets   []PolicySet  `yaml:"policy_sets" json:"policy_sets"`
	ApproveCount int          `yaml:"approve_count,omitempty" json:"approve_count,omitempty"`
}

PolicySets is the raw schema for repo-level atlantis.yaml config.

func (PolicySets) ToValid

func (p PolicySets) ToValid() valid.PolicySets

func (PolicySets) Validate

func (p PolicySets) Validate() error

type Project

type Project struct {
	Name                      *string   `yaml:"name,omitempty"`
	Branch                    *string   `yaml:"branch,omitempty"`
	Dir                       *string   `yaml:"dir,omitempty"`
	Workspace                 *string   `yaml:"workspace,omitempty"`
	Workflow                  *string   `yaml:"workflow,omitempty"`
	TerraformVersion          *string   `yaml:"terraform_version,omitempty"`
	Autoplan                  *Autoplan `yaml:"autoplan,omitempty"`
	PlanRequirements          []string  `yaml:"plan_requirements,omitempty"`
	ApplyRequirements         []string  `yaml:"apply_requirements,omitempty"`
	ImportRequirements        []string  `yaml:"import_requirements,omitempty"`
	DependsOn                 []string  `yaml:"depends_on,omitempty"`
	DeleteSourceBranchOnMerge *bool     `yaml:"delete_source_branch_on_merge,omitempty"`
	RepoLocking               *bool     `yaml:"repo_locking,omitempty"`
	ExecutionOrderGroup       *int      `yaml:"execution_order_group,omitempty"`
	PolicyCheck               *bool     `yaml:"policy_check,omitempty"`
	CustomPolicyCheck         *bool     `yaml:"custom_policy_check,omitempty"`
}

func (Project) ToValid

func (p Project) ToValid() valid.Project

func (Project) Validate

func (p Project) Validate() error

type Prometheus added in v0.19.5

type Prometheus struct {
	Endpoint string `yaml:"endpoint" json:"endpoint"`
}

func (*Prometheus) Validate added in v0.19.5

func (p *Prometheus) Validate() error

type Repo

type Repo struct {
	ID                        string         `yaml:"id" json:"id"`
	Branch                    string         `yaml:"branch" json:"branch"`
	RepoConfigFile            string         `yaml:"repo_config_file" json:"repo_config_file"`
	PlanRequirements          []string       `yaml:"plan_requirements" json:"plan_requirements"`
	ApplyRequirements         []string       `yaml:"apply_requirements" json:"apply_requirements"`
	ImportRequirements        []string       `yaml:"import_requirements" json:"import_requirements"`
	PreWorkflowHooks          []WorkflowHook `yaml:"pre_workflow_hooks" json:"pre_workflow_hooks"`
	Workflow                  *string        `yaml:"workflow,omitempty" json:"workflow,omitempty"`
	PostWorkflowHooks         []WorkflowHook `yaml:"post_workflow_hooks" json:"post_workflow_hooks"`
	AllowedWorkflows          []string       `yaml:"allowed_workflows,omitempty" json:"allowed_workflows,omitempty"`
	AllowedOverrides          []string       `yaml:"allowed_overrides" json:"allowed_overrides"`
	AllowCustomWorkflows      *bool          `yaml:"allow_custom_workflows,omitempty" json:"allow_custom_workflows,omitempty"`
	DeleteSourceBranchOnMerge *bool          `yaml:"delete_source_branch_on_merge,omitempty" json:"delete_source_branch_on_merge,omitempty"`
	RepoLocking               *bool          `yaml:"repo_locking,omitempty" json:"repo_locking,omitempty"`
	PolicyCheck               *bool          `yaml:"policy_check,omitempty" json:"policy_check,omitempty"`
	CustomPolicyCheck         *bool          `yaml:"custom_policy_check,omitempty" json:"custom_policy_check,omitempty"`
	AutoDiscover              *AutoDiscover  `yaml:"autodiscover,omitempty" json:"autodiscover,omitempty"`
}

Repo is the raw schema for repos in the server-side repo config.

func (Repo) HasRegexBranch

func (r Repo) HasRegexBranch() bool

HasRegexBranch returns true if a branch regex was set.

func (Repo) HasRegexID

func (r Repo) HasRegexID() bool

HasRegexID returns true if r is configured with a regex id instead of an exact match id.

func (Repo) ToValid

func (r Repo) ToValid(workflows map[string]valid.Workflow, globalPlanReqs []string, globalApplyReqs []string, globalImportReqs []string) valid.Repo

func (Repo) Validate

func (r Repo) Validate() error

type RepoCfg

type RepoCfg struct {
	Version                    *int                `yaml:"version,omitempty"`
	Projects                   []Project           `yaml:"projects,omitempty"`
	Workflows                  map[string]Workflow `yaml:"workflows,omitempty"`
	PolicySets                 PolicySets          `yaml:"policies,omitempty"`
	AutoDiscover               *AutoDiscover       `yaml:"autodiscover,omitempty"`
	Automerge                  *bool               `yaml:"automerge,omitempty"`
	ParallelApply              *bool               `yaml:"parallel_apply,omitempty"`
	ParallelPlan               *bool               `yaml:"parallel_plan,omitempty"`
	DeleteSourceBranchOnMerge  *bool               `yaml:"delete_source_branch_on_merge,omitempty"`
	EmojiReaction              *string             `yaml:"emoji_reaction,omitempty"`
	AllowedRegexpPrefixes      []string            `yaml:"allowed_regexp_prefixes,omitempty"`
	AbortOnExcecutionOrderFail *bool               `yaml:"abort_on_execution_order_fail,omitempty"`
}

RepoCfg is the raw schema for repo-level atlantis.yaml config.

func (RepoCfg) ToValid

func (r RepoCfg) ToValid() valid.RepoCfg

func (RepoCfg) Validate

func (r RepoCfg) Validate() error

type Stage

type Stage struct {
	Steps []Step `yaml:"steps,omitempty" json:"steps,omitempty"`
}

func (Stage) ToValid

func (s Stage) ToValid() valid.Stage

func (Stage) Validate

func (s Stage) Validate() error

type Statsd added in v0.19.3

type Statsd struct {
	Port string `yaml:"port" json:"port"`
	Host string `yaml:"host" json:"host"`
}

func (*Statsd) Validate added in v0.19.3

func (s *Statsd) Validate() error

type Step

type Step struct {
	// Key will be set in case #1 and #3 above to the key. In case #2, there
	// could be multiple keys (since the element is a map) so we don't set Key.
	Key *string
	// EnvOrRun will be set in case #2 above.
	EnvOrRun map[string]map[string]string
	// Map will be set in case #3 above.
	Map map[string]map[string][]string
	// StringVal will be set in case #4 above.
	StringVal map[string]string
}

Step represents a single action/command to perform. In YAML, it can be set as 1. A single string for a built-in command:

  • init
  • plan
  • policy_check

2. A map for an env step with name and command or value, or a run step with a command and output config

  • env: name: test command: echo 312 value: value
  • run: command: my custom command output: hide

3. A map for a built-in command and extra_args:

  • plan: extra_args: [-var-file=staging.tfvars]

4. A map for a custom run command:

  • run: my custom command

Here we parse step in the most generic fashion possible. See fields for more details.

func (*Step) MarshalJSON

func (s *Step) MarshalJSON() ([]byte, error)

func (Step) MarshalYAML

func (s Step) MarshalYAML() (interface{}, error)

func (Step) ToValid

func (s Step) ToValid() valid.Step

func (*Step) UnmarshalJSON

func (s *Step) UnmarshalJSON(data []byte) error

func (*Step) UnmarshalYAML

func (s *Step) UnmarshalYAML(unmarshal func(interface{}) error) error

func (Step) Validate

func (s Step) Validate() error

type Workflow

type Workflow struct {
	Apply       *Stage `yaml:"apply,omitempty" json:"apply,omitempty"`
	Plan        *Stage `yaml:"plan,omitempty" json:"plan,omitempty"`
	PolicyCheck *Stage `yaml:"policy_check,omitempty" json:"policy_check,omitempty"`
	Import      *Stage `yaml:"import,omitempty" json:"import,omitempty"`
	StateRm     *Stage `yaml:"state_rm,omitempty" json:"state_rm,omitempty"`
}

func (Workflow) ToValid

func (w Workflow) ToValid(name string) valid.Workflow

func (Workflow) Validate

func (w Workflow) Validate() error

type WorkflowHook

type WorkflowHook struct {
	StringVal map[string]string
}

WorkflowHook represents a single action/command to perform. In YAML, it can be set as A map for a custom run commands:

  • run: my custom command

func (*WorkflowHook) MarshalJSON

func (s *WorkflowHook) MarshalJSON() ([]byte, error)

func (WorkflowHook) MarshalYAML

func (s WorkflowHook) MarshalYAML() (interface{}, error)

func (WorkflowHook) ToValid

func (s WorkflowHook) ToValid() *valid.WorkflowHook

func (*WorkflowHook) UnmarshalJSON

func (s *WorkflowHook) UnmarshalJSON(data []byte) error

func (*WorkflowHook) UnmarshalYAML

func (s *WorkflowHook) UnmarshalYAML(unmarshal func(interface{}) error) error

func (WorkflowHook) Validate

func (s WorkflowHook) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL