config

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InputValidation

func InputValidation(sl validator.StructLevel)

Types

type Account

type Account struct {
	ID                string
	CredsID           string
	CSP               string
	AccountOwnerLabel string
}

Account is a struct that represents details about an Account

type Config

type Config struct {
	// Set by container overrides
	AccountID       string   `mapstructure:"account_id"`       // The cloud account id to deploy to (AWS Account, Azure Subscription or GCP Project)
	TargetAccountID string   `mapstructure:"account_id"`       // The target account being deployed to using the delivery framework (use ACCOUNT_ID env for compatibility)
	RegionalRegions []string `mapstructure:"regional_regions"` // runiac will apply regional step deployments across these regions
	PrimaryRegion   string   `mapstructure:"primary_region" required:"true"`
	DryRun          bool     `mapstructure:"dry_run"` // DryRun will only execute up to Terraform plan, describing what will happen if deployed
	Runner          string   `mapstructure:runner`    // Delivery framework to invoke for executing steps

	UniqueExternalExecutionID string
	DeploymentRing            string `mapstructure:"deployment_ring"`
	SelfDestroy               bool   `mapstructure:"self_destroy"` // Destroy will automatically execute Terraform Destroy after running deployments & tests
	RegionGroup               string
	StepWhitelist             []string        `mapstructure:"step_whitelist"` // Target_Steps is a comma separated list of step ids to reflect the whitelisted steps to be executed, e.g. core#logging#final_destination_bucket, core#logging#bridge_azu
	TargetAll                 bool            // This is a global whitelist and overrules targeted tracks and targeted steps, primarily for dev and testing
	Version                   string          `mapstructure:"version"` // Version override
	MaxRetries                int             `mapstructure:"max_retries"`
	MaxTestRetries            int             `mapstructure:"max_test_retries"`
	LogLevel                  string          `mapstructure:"log_level"`
	CoreAccounts              CoreAccountsMap `mapstructure:"core_accounts"`
	RegionGroups              RegionGroupsMap `mapstructure:"region_grouprs"`
	// Set at task definition creation
	Namespace   string `mapstructure:"namespace"`                   // The namespace to use in the Terraform run.
	Environment string `mapstructure:"environment" required:"true"` // The name of the environment (e.g. pr, nonprod, prod)
	Project     string `mapstructure:"project" required:"true"`
}

Config struct is a representation of the environment variables passed into the container

func GetConfig

func GetConfig() (Config, error)

GetConfig retrieves a deployment config

type CoreAccountsMap

type CoreAccountsMap map[string]Account

func (*CoreAccountsMap) Decode

func (ipd *CoreAccountsMap) Decode(value string) error

type DeployMetadata

type DeployMetadata struct {
	Version   string `json:"version"`
	Region    string `json:"pr_region"`
	BaseImage string `json:"base_image"`
}

DeployMetadata ...

type DeployResult

type DeployResult int
const (
	Fail DeployResult = iota
	Success
	Unstable
	Skipped
	Na // not applicable (e.g. no regional resources exist or step was disabled for execution)
)

func (DeployResult) String

func (d DeployResult) String() string

type Deployment

type Deployment struct {
	Phase         string
	Result        string
	ResultMessage string
	Config        Config
}

Deployment ...

type RegionDeployType

type RegionDeployType int

TFProviderType represents a Terraform provider type

const (
	// Primary region typedeploys to the designated primary region, this usually consists of global resources such as IAM
	// In runiac world, this means it would only deploy the step's parent directory resources
	PrimaryRegionDeployType RegionDeployType = iota
	// Regional region type deploys to each of the targeted regions, this consists of region specific resources and does not include global resources such as IAM
	// In runiac world, this means it would only deploy the step's /regional/ directory resources to each of the targeted regions
	RegionalRegionDeployType
)

func (RegionDeployType) String

func (p RegionDeployType) String() string

type RegionGroupsMap

type RegionGroupsMap map[string]map[string][]string

func (*RegionGroupsMap) Decode

func (ipd *RegionGroupsMap) Decode(value string) error

type RunnerPlugin

type RunnerPlugin interface {
	// Initialize allows a plugin to perform one-time initialization prior to use.
	// Any user-facing output should be sent to the provided`logger` instance.
	Initialize(logger *logrus.Entry)
}

Interface RunnerPlugin describes capacilities and initializtion for runiac plugins.

type Step

type Step struct {
	ID                     string
	Name                   string
	TrackName              string
	Dir                    string
	ProgressionLevel       int // 1, 2, 3...
	RegionalResourcesExist bool
	TestsExist             bool
	RegionalTestsExist     bool // TODO: remove the need for these TestsExists and evaulate in real time during evaluation vs gather?
	DeployConfig           Config
	CommonInputVariables   map[string]string // Common input variables that all steps receive
	Output                 StepOutput
	TestOutput             StepTestOutput
	Runner                 Stepper
}

Step represents a delivery framework step, e.g. the executions needed to implement a track

type StepExecution

type StepExecution struct {
	RegionDeployType           RegionDeployType
	Region                     string `json:"region"`
	Logger                     *logrus.Entry
	Fs                         afero.Fs
	UniqueExternalExecutionID  string
	RegionGroupRegions         []string
	TargetAccountID            string
	RegionGroup                string
	PrimaryRegion              string
	Dir                        string
	Environment                string `json:"environment"`
	AppVersion                 string `json:"app_version"`
	AccountID                  string `json:"account_id"`
	MaxRetries                 int
	MaxTestRetries             int
	CoreAccounts               map[string]Account
	RegionGroups               RegionGroupsMap
	Namespace                  string
	CommonRegion               string
	StepName                   string
	StepID                     string
	DeploymentRing             string
	Project                    string
	TrackName                  string
	DryRun                     bool
	SelfDestroy                bool
	DefaultStepOutputVariables map[string]map[string]string // Previous step output variables are available in this map. K=StepName,V=map[VarName:VarVal]
	OptionalStepParams         map[string]string
	RequiredStepParams         map[string]interface{}
}

type StepOutput

type StepOutput struct {
	Status           DeployResult
	RegionDeployType RegionDeployType
	Region           string
	StepName         string
	StreamOutput     string
	Err              error
	OutputVariables  map[string]interface{}
}

StepOutput represents the output of a step

type StepTestOutput

type StepTestOutput struct {
	StepName     string
	StreamOutput string
	Err          error
}

StepTestOutput represents the output of a step's test

type Stepper

type Stepper interface {
	// ExecuteStep will handle the deployment of this step.  In Terraform this will include init, plan, verify plan, and apply.
	PreExecute(execution StepExecution) (exec StepExecution, err error)
	ExecuteStep(execution StepExecution) (resp StepOutput)
	ExecuteStepTests(execution StepExecution) (resp StepTestOutput)
	ExecuteStepDestroy(execution StepExecution) (output StepOutput)
}

Stepper is an interface for working with delivery framework steps, e.g. the executions needed to implement a track All Step methods will handle logging of errors while logger has appropriate fields set. Therefore, there should be no need to logger Output.Errs from this interface

Jump to

Keyboard shortcuts

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