config

package
v0.45.3-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnalysisStrategyThreshold      = "THRESHOLD"
	AnalysisStrategyPrevious       = "PREVIOUS"
	AnalysisStrategyCanaryBaseline = "CANARY_BASELINE"
	AnalysisStrategyCanaryPrimary  = "CANARY_PRIMARY"

	AnalysisDeviationEither = "EITHER"
	AnalysisDeviationHigh   = "HIGH"
	AnalysisDeviationLow    = "LOW"
)
View Source
const (
	// EventWatcherHandlerTypeGitUpdate represents the handler type for git updating.
	EventWatcherHandlerTypeGitUpdate = "GIT_UPDATE"
)
View Source
const (
	K8sResourcePatchOpYAMLReplace = "yaml-replace"
)
View Source
const (
	SharedConfigurationDirName = ".pipe"
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func FeatureFlagEnabled added in v0.40.0

func FeatureFlagEnabled(flag FeatureFlag) bool

Types

type AnalysisExpected

type AnalysisExpected struct {
	Min *float64 `json:"min"`
	Max *float64 `json:"max"`
}

AnalysisExpected defines the range used for metrics analysis.

func (*AnalysisExpected) InRange

func (e *AnalysisExpected) InRange(value float64) bool

InRange returns true if the given value is within the range.

func (*AnalysisExpected) String

func (e *AnalysisExpected) String() string

func (*AnalysisExpected) Validate

func (e *AnalysisExpected) Validate() error

type AnalysisHTTP

type AnalysisHTTP struct {
	URL    string `json:"url"`
	Method string `json:"method"`
	// Custom headers to set in the request. HTTP allows repeated headers.
	Headers          []AnalysisHTTPHeader `json:"headers"`
	ExpectedCode     int                  `json:"expectedCode"`
	ExpectedResponse string               `json:"expectedResponse"`
	Interval         Duration             `json:"interval"`
	// Maximum number of failed checks before the response is considered as failure.
	FailureLimit int `json:"failureLimit"`
	// If true, it considers as success when no data returned from the analysis provider.
	// Default is false.
	SkipOnNoData bool     `json:"skipOnNoData"`
	Timeout      Duration `json:"timeout"`
}

AnalysisHTTP contains common configurable values for deployment analysis with http.

func (*AnalysisHTTP) Validate

func (a *AnalysisHTTP) Validate() error

type AnalysisHTTPHeader

type AnalysisHTTPHeader struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type AnalysisLog

type AnalysisLog struct {
	Query    string   `json:"query"`
	Interval Duration `json:"interval"`
	// Maximum number of failed checks before the query result is considered as failure.
	FailureLimit int `json:"failureLimit"`
	// If true, it considers as success when no data returned from the analysis provider.
	// Default is false.
	SkipOnNoData bool `json:"skipOnNoData"`
	// How long after which the query times out.
	Timeout  Duration `json:"timeout"`
	Provider string   `json:"provider"`
}

AnalysisLog contains common configurable values for deployment analysis with log.

func (*AnalysisLog) Validate

func (a *AnalysisLog) Validate() error

type AnalysisMetrics

type AnalysisMetrics struct {
	// The strategy name. One of THRESHOLD or PREVIOUS or CANARY_BASELINE or CANARY_PRIMARY is available.
	// Defaults to THRESHOLD.
	Strategy string `json:"strategy" default:"THRESHOLD"`
	// The unique name of provider defined in the Piped Configuration.
	// Required field.
	Provider string `json:"provider"`
	// A query performed against the Analysis Provider.
	// Required field.
	Query string `json:"query"`
	// The expected query result.
	// Required field for the THRESHOLD strategy.
	Expected AnalysisExpected `json:"expected"`
	// Run a query at this intervals.
	// Required field.
	Interval Duration `json:"interval"`
	// Acceptable number of failures. For instance, If 1 is set,
	// the analysis will be considered a failure after 2 failures.
	// Default is 0.
	FailureLimit int `json:"failureLimit"`
	// If true, it considers as a success when no data returned from the analysis provider.
	// Default is false.
	SkipOnNoData bool `json:"skipOnNoData"`
	// How long after which the query times out.
	// Default is 30s.
	Timeout Duration `json:"timeout" default:"30s"`

	// The stage fails on deviation in the specified direction. One of LOW or HIGH or EITHER is available.
	// This can be used only for PREVIOUS, CANARY_BASELINE or CANARY_PRIMARY. Defaults to EITHER.
	Deviation string `json:"deviation" default:"EITHER"`
	// The custom arguments to be populated for the Canary query.
	// They can be referred as {{ .VariantArgs.xxx }}.
	CanaryArgs map[string]string `json:"canaryArgs"`
	// The custom arguments to be populated for the Baseline query.
	// They can be referred as {{ .VariantArgs.xxx }}.
	BaselineArgs map[string]string `json:"baselineArgs"`
	// The custom arguments to be populated for the Primary query.
	// They can be referred as {{ .VariantArgs.xxx }}.
	PrimaryArgs map[string]string `json:"primaryArgs"`
}

AnalysisMetrics contains common configurable values for deployment analysis with metrics.

func (*AnalysisMetrics) Validate

func (m *AnalysisMetrics) Validate() error

type AnalysisProviderDatadogConfig

type AnalysisProviderDatadogConfig struct {
	// The address of Datadog API server.
	// Only "datadoghq.com", "us3.datadoghq.com", "datadoghq.eu", "ddog-gov.com" are available.
	// Defaults to "datadoghq.com"
	Address string `json:"address,omitempty"`
	// Required: The path to the api key file.
	APIKeyFile string `json:"apiKeyFile"`
	// Required: The path to the application key file.
	ApplicationKeyFile string `json:"applicationKeyFile"`
	// Base64 API Key for Datadog API server.
	APIKeyData string `json:"apiKeyData,omitempty"`
	// Base64 Application Key for Datadog API server.
	ApplicationKeyData string `json:"applicationKeyData,omitempty"`
}

func (*AnalysisProviderDatadogConfig) Mask added in v0.33.0

func (*AnalysisProviderDatadogConfig) Validate

func (a *AnalysisProviderDatadogConfig) Validate() error

type AnalysisProviderPrometheusConfig

type AnalysisProviderPrometheusConfig struct {
	Address string `json:"address"`
	// The path to the username file.
	UsernameFile string `json:"usernameFile,omitempty"`
	// The path to the password file.
	PasswordFile string `json:"passwordFile,omitempty"`
}

func (*AnalysisProviderPrometheusConfig) Mask added in v0.33.0

func (*AnalysisProviderPrometheusConfig) Validate

type AnalysisProviderStackdriverConfig

type AnalysisProviderStackdriverConfig struct {
	// The path to the service account file.
	ServiceAccountFile string `json:"serviceAccountFile"`
}

func (*AnalysisProviderStackdriverConfig) Mask added in v0.33.0

func (*AnalysisProviderStackdriverConfig) Validate

type AnalysisStageOptions

type AnalysisStageOptions struct {
	// How long the analysis process should be executed.
	Duration Duration `json:"duration"`
	// TODO: Consider about how to handle a pod restart
	// possible count of pod restarting
	RestartThreshold int                          `json:"restartThreshold"`
	Metrics          []TemplatableAnalysisMetrics `json:"metrics"`
	Logs             []TemplatableAnalysisLog     `json:"logs"`
	Https            []TemplatableAnalysisHTTP    `json:"https"`
}

AnalysisStageOptions contains all configurable values for a K8S_ANALYSIS stage.

func (*AnalysisStageOptions) Validate

func (a *AnalysisStageOptions) Validate() error

type AnalysisTemplateRef

type AnalysisTemplateRef struct {
	Name    string            `json:"name"`
	AppArgs map[string]string `json:"appArgs"`
}

func (*AnalysisTemplateRef) Validate

func (a *AnalysisTemplateRef) Validate() error

type AnalysisTemplateSpec

type AnalysisTemplateSpec struct {
	Metrics map[string]AnalysisMetrics `json:"metrics"`
	Logs    map[string]AnalysisLog     `json:"logs"`
	HTTPs   map[string]AnalysisHTTP    `json:"https"`
}

func LoadAnalysisTemplate

func LoadAnalysisTemplate(repoRoot string) (*AnalysisTemplateSpec, error)

LoadAnalysisTemplate finds the config file for the analysis template in the .pipe directory first up. And returns parsed config, ErrNotFound is returned if not found.

func (*AnalysisTemplateSpec) Validate

func (s *AnalysisTemplateSpec) Validate() error

type Attachment added in v0.44.0

type Attachment struct {
	// Map of name to refer with the file path which contain embedding source data.
	Sources map[string]string `json:"sources"`
	// List of files to be embedded before using.
	Targets []string `json:"targets"`
}

func (*Attachment) Validate added in v0.44.0

func (e *Attachment) Validate() error

type ChainApplicationMatcher

type ChainApplicationMatcher struct {
	Name   string            `json:"name"`
	Kind   string            `json:"kind"`
	Labels map[string]string `json:"labels"`
}

ChainApplicationMatcher provides filters used to find the right applications to trigger as a part of the deployment chain.

func (*ChainApplicationMatcher) Validate

func (m *ChainApplicationMatcher) Validate() error

type CloudRunApplicationSpec

type CloudRunApplicationSpec struct {
	GenericApplicationSpec
	// Input for CloudRun deployment such as docker image...
	Input CloudRunDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync CloudRunSyncStageOptions `json:"quickSync"`
}

CloudRunApplicationSpec represents an application configuration for CloudRun application.

func (*CloudRunApplicationSpec) Validate

func (s *CloudRunApplicationSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type CloudRunDeploymentInput

type CloudRunDeploymentInput struct {
	// The name of service manifest file placing in application directory.
	// Default is service.yaml
	ServiceManifestFile string `json:"serviceManifestFile"`
	// Automatically reverts to the previous state when the deployment is failed.
	// Default is true.
	AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
}

type CloudRunPromoteStageOptions

type CloudRunPromoteStageOptions struct {
	// Percentage of traffic should be routed to the new version.
	Percent Percentage `json:"percent"`
}

CloudRunPromoteStageOptions contains all configurable values for a CLOUDRUN_PROMOTE stage.

type CloudRunSyncStageOptions

type CloudRunSyncStageOptions struct {
}

CloudRunSyncStageOptions contains all configurable values for a CLOUDRUN_SYNC stage.

type Config

type Config struct {
	Kind       Kind
	APIVersion string

	KubernetesApplicationSpec *KubernetesApplicationSpec
	TerraformApplicationSpec  *TerraformApplicationSpec
	CloudRunApplicationSpec   *CloudRunApplicationSpec
	LambdaApplicationSpec     *LambdaApplicationSpec
	ECSApplicationSpec        *ECSApplicationSpec

	PipedSpec            *PipedSpec
	ControlPlaneSpec     *ControlPlaneSpec
	AnalysisTemplateSpec *AnalysisTemplateSpec
	EventWatcherSpec     *EventWatcherSpec
	// contains filtered or unexported fields
}

Config represents configuration data load from file. The spec is depend on the kind of configuration.

func DecodeYAML

func DecodeYAML(data []byte) (*Config, error)

DecodeYAML unmarshals config YAML data to config struct. It also validates the configuration after decoding.

func LoadFromYAML

func LoadFromYAML(file string) (*Config, error)

LoadFromYAML reads and decodes a yaml file to construct the Config.

func (*Config) GetGenericApplication

func (c *Config) GetGenericApplication() (GenericApplicationSpec, bool)

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the way to unmarshal json data into Config struct. Firstly, this unmarshal to a generic config and then unmarshal the spec which depend on the kind of configuration.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the value of all fields.

type ControlPlaneCache

type ControlPlaneCache struct {
	TTL Duration `json:"ttl"`
}

func (ControlPlaneCache) TTLDuration

func (c ControlPlaneCache) TTLDuration() time.Duration

type ControlPlaneDataStore

type ControlPlaneDataStore struct {
	// The datastore type.
	Type model.DataStoreType

	// The configuration in the case of Cloud Firestore.
	FirestoreConfig *DataStoreFireStoreConfig
	// The configuration in the case of general MySQL.
	MySQLConfig *DataStoreMySQLConfig
}

func (*ControlPlaneDataStore) UnmarshalJSON

func (d *ControlPlaneDataStore) UnmarshalJSON(data []byte) error

type ControlPlaneFileStore

type ControlPlaneFileStore struct {
	// The filestore type.
	Type model.FileStoreType

	// The configuration in the case of Google Cloud Storage.
	GCSConfig *FileStoreGCSConfig `json:"gcs"`
	// The configuration in the case of Amazon S3.
	S3Config *FileStoreS3Config `json:"s3"`
	// The configuration in the case of Minio.
	MinioConfig *FileStoreMinioConfig `json:"minio"`
}

func (*ControlPlaneFileStore) UnmarshalJSON

func (f *ControlPlaneFileStore) UnmarshalJSON(data []byte) error

type ControlPlaneInsightCollector

type ControlPlaneInsightCollector struct {
	Application InsightCollectorApplication `json:"application"`
	Deployment  InsightCollectorDeployment  `json:"deployment"`
}

type ControlPlaneProject

type ControlPlaneProject struct {
	// The unique identifier of the project.
	Id string `json:"id"`
	// The description about the project.
	Desc string `json:"desc"`
	// Static admin account of the project.
	StaticAdmin ProjectStaticUser `json:"staticAdmin"`
}

type ControlPlaneSpec

type ControlPlaneSpec struct {
	// The address to the control plane.
	// This is required if SSO is enabled.
	Address string `json:"address"`
	// A randomly generated string used to sign oauth state.
	StateKey string `json:"stateKey"`
	// The configuration of datastore for control plane.
	Datastore ControlPlaneDataStore `json:"datastore"`
	// The configuration of filestore for control plane.
	Filestore ControlPlaneFileStore `json:"filestore"`
	// The configuration of cache for control plane.
	Cache ControlPlaneCache `json:"cache"`
	// The configuration of insight collector.
	InsightCollector ControlPlaneInsightCollector `json:"insightCollector"`
	// List of debugging/quickstart projects defined in Control Plane configuration.
	// Please note that do not use this to configure the projects running in the production.
	Projects []ControlPlaneProject `json:"projects"`
	// List of shared SSO configurations that can be used by any projects.
	SharedSSOConfigs []SharedSSOConfig `json:"sharedSSOConfigs"`
}

ControlPlaneSpec defines all configuration for all control-plane components.

func (*ControlPlaneSpec) FindProject

func (s *ControlPlaneSpec) FindProject(id string) (ControlPlaneProject, bool)

FindProject finds and returns a specific project in the configured list.

func (*ControlPlaneSpec) ProjectMap

func (s *ControlPlaneSpec) ProjectMap() map[string]ControlPlaneProject

func (*ControlPlaneSpec) SharedSSOConfigMap

func (s *ControlPlaneSpec) SharedSSOConfigMap() map[string]*model.ProjectSSOConfig

func (*ControlPlaneSpec) Validate

func (s *ControlPlaneSpec) Validate() error

type CustomSyncOptions added in v0.43.0

type CustomSyncOptions struct {
	Timeout Duration          `json:"timeout" default:"6h"`
	Envs    map[string]string `json:"envs"`
	Run     string            `json:"run"`
}

func (*CustomSyncOptions) Validate added in v0.43.0

func (c *CustomSyncOptions) Validate() error

type DataStoreFireStoreConfig

type DataStoreFireStoreConfig struct {
	// The root path element considered as a logical namespace, e.g. `pipecd`.
	Namespace string `json:"namespace"`
	// The second path element considered as a logical environment, e.g. `dev`.
	// All pipecd collections will have path formatted according to `{namespace}/{environment}/{collection-name}`.
	Environment string `json:"environment"`
	// The prefix for collection name.
	// This can be used to avoid conflicts with existing collections in your Firestore database.
	CollectionNamePrefix string `json:"collectionNamePrefix"`
	// The name of GCP project hosting the Firestore.
	Project string `json:"project"`
	// The path to the service account file for accessing Firestores.
	CredentialsFile string `json:"credentialsFile"`
}

type DataStoreMySQLConfig

type DataStoreMySQLConfig struct {
	// The url of MySQL. All of credentials can be specified via this field.
	URL string `json:"url"`
	// The name of the database.
	// For those who don't want to include the database in the URL.
	Database string `json:"database"`
	// The path to the username file.
	// For those who don't want to include the username in the URL.
	UsernameFile string `json:"usernameFile"`
	// The path to the password file.
	// For those who don't want to include the password in the URL.
	PasswordFile string `json:"passwordFile"`
}

type DeploymentChain

type DeploymentChain struct {
	// ApplicationMatchers provides list of ChainApplicationMatcher which contain filters to be used
	// to find applications to deploy as chain node. It's required to not empty.
	ApplicationMatchers []ChainApplicationMatcher `json:"applications"`
}

DeploymentChain provides all configurations used to trigger a chain of deployments.

func (*DeploymentChain) Validate

func (dc *DeploymentChain) Validate() error

type DeploymentChainTriggerCondition

type DeploymentChainTriggerCondition struct {
	CommitPrefix string `json:"commitPrefix"`
}

func (*DeploymentChainTriggerCondition) Validate

func (c *DeploymentChainTriggerCondition) Validate() error

type DeploymentCommitMatcher

type DeploymentCommitMatcher struct {
	// It makes sure to perform syncing if the commit message matches this regular expression.
	QuickSync string `json:"quickSync"`
	// It makes sure to perform pipeline if the commit message matches this regular expression.
	Pipeline string `json:"pipeline"`
}

DeploymentCommitMatcher provides a way to decide how to deploy.

type DeploymentNotification

type DeploymentNotification struct {
	// List of users to be notified for each event.
	Mentions []NotificationMention `json:"mentions"`
}

DeploymentNotification represents the way to send to users.

func (*DeploymentNotification) FindSlackAccounts

func (n *DeploymentNotification) FindSlackAccounts(event model.NotificationEventType) []string

type DeploymentPipeline

type DeploymentPipeline struct {
	Stages []PipelineStage `json:"stages"`
}

DeploymentPipeline represents the way to deploy the application. The pipeline is triggered by changes in any of the following objects: - Target PodSpec (Target can be Deployment, DaemonSet, StatefulSet) - ConfigMaps, Secrets that are mounted as volumes or envs in the deployment.

type DeploymentPlanner

type DeploymentPlanner struct {
	// Disable auto-detecting to use QUICK_SYNC or PROGRESSIVE_SYNC.
	// Always use the speficied pipeline for all deployments.
	AlwaysUsePipeline bool `json:"alwaysUsePipeline"`
}

type DriftDetection added in v0.43.0

type DriftDetection struct {
	// IgnoreFields are a list of 'apiVersion:kind:namespace:name#fieldPath'
	IgnoreFields []string `json:"ignoreFields"`
}

func (*DriftDetection) Validate added in v0.43.0

func (dd *DriftDetection) Validate() error

type Duration

type Duration time.Duration

func (Duration) Duration

func (d Duration) Duration() time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type ECSApplicationSpec

type ECSApplicationSpec struct {
	GenericApplicationSpec
	// Input for ECS deployment such as where to fetch source code...
	Input ECSDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync ECSSyncStageOptions `json:"quickSync"`
}

ECSApplicationSpec represents an application configuration for ECS application.

func (*ECSApplicationSpec) Validate

func (s *ECSApplicationSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type ECSCanaryCleanStageOptions

type ECSCanaryCleanStageOptions struct {
}

ECSCanaryCleanStageOptions contains all configurable values for a ECS_CANARY_CLEAN stage.

type ECSCanaryRolloutStageOptions

type ECSCanaryRolloutStageOptions struct {
	// Scale represents the amount of desired task that should be rolled out as CANARY variant workload.
	Scale Percentage `json:"scale"`
}

ECSCanaryRolloutStageOptions contains all configurable values for a ECS_CANARY_ROLLOUT stage.

type ECSDeploymentInput

type ECSDeploymentInput struct {
	// The Amazon Resource Name (ARN) that identifies the cluster.
	ClusterArn string `json:"clusterArn"`
	// The launch type on which to run your task.
	// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html
	// Default is FARGATE
	LaunchType string `json:"launchType" default:"FARGATE"`
	// VpcConfiguration ECSVpcConfiguration `json:"awsvpcConfiguration"`
	AwsVpcConfiguration ECSVpcConfiguration `json:"awsvpcConfiguration"`
	// The name of service definition file placing in application directory.
	ServiceDefinitionFile string `json:"serviceDefinitionFile"`
	// The name of task definition file placing in application directory.
	// Default is taskdef.json
	TaskDefinitionFile string `json:"taskDefinitionFile" default:"taskdef.json"`
	// ECSTargetGroups
	TargetGroups ECSTargetGroups `json:"targetGroups"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is true.
	AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
}

func (*ECSDeploymentInput) IsStandaloneTask added in v0.41.3

func (in *ECSDeploymentInput) IsStandaloneTask() bool

type ECSPrimaryRolloutStageOptions

type ECSPrimaryRolloutStageOptions struct {
}

ECSPrimaryRolloutStageOptions contains all configurable values for a ECS_PRIMARY_ROLLOUT stage.

type ECSSyncStageOptions

type ECSSyncStageOptions struct {
}

ECSSyncStageOptions contains all configurable values for a ECS_SYNC stage.

type ECSTargetGroups

type ECSTargetGroups struct {
	Primary json.RawMessage `json:"primary"`
	Canary  json.RawMessage `json:"canary"`
}

type ECSTrafficRoutingStageOptions

type ECSTrafficRoutingStageOptions struct {
	// Canary represents the amount of traffic that the rolled out CANARY variant will serve.
	Canary Percentage `json:"canary"`
	// Primary represents the amount of traffic that the rolled out CANARY variant will serve.
	Primary Percentage `json:"primary"`
}

ECSTrafficRoutingStageOptions contains all configurable values for ECS_TRAFFIC_ROUTING stage.

func (ECSTrafficRoutingStageOptions) Percentage

func (opts ECSTrafficRoutingStageOptions) Percentage() (primary, canary int)

type ECSVpcConfiguration added in v0.41.3

type ECSVpcConfiguration struct {
	Subnets        []string
	AssignPublicIP string
	SecurityGroups []string
}

type EventWatcherConfig added in v0.34.0

type EventWatcherConfig struct {
	// Matcher represents which event will be handled.
	Matcher EventWatcherMatcher `json:"matcher"`
	// Handler represents how the matched event will be handled.
	Handler EventWatcherHandler `json:"handler"`
}

type EventWatcherEvent

type EventWatcherEvent struct {
	// The event name.
	Name string `json:"name"`
	// Additional attributes of event. This can make an event definition
	// unique even if the one with the same name exists.
	Labels map[string]string `json:"labels"`
	// List of places where will be replaced when the new event matches.
	Replacements []EventWatcherReplacement `json:"replacements"`
}

EventWatcherEvent defines which file will be replaced when the given event happened.

func (*EventWatcherEvent) Validate

func (e *EventWatcherEvent) Validate() error

type EventWatcherHandler added in v0.34.0

type EventWatcherHandler struct {
	// The handler type of event watcher.
	Type EventWatcherHandlerType `json:"type,omitempty"`
	// The config for event watcher handler.
	Config EventWatcherHandlerConfig `json:"config"`
}

type EventWatcherHandlerConfig added in v0.34.0

type EventWatcherHandlerConfig struct {
	// The commit message used to push after replacing values.
	// Default message is used if not given.
	CommitMessage string `json:"commitMessage,omitempty"`
	// List of places where will be replaced when the new event matches.
	Replacements []EventWatcherReplacement `json:"replacements"`
}

type EventWatcherHandlerType added in v0.34.0

type EventWatcherHandlerType string

EventWatcherHandlerType represents the type of an event watcher handler.

type EventWatcherMatcher added in v0.34.0

type EventWatcherMatcher struct {
	// The handled event name.
	Name string `json:"name"`
	// Additional attributes of event. This can make an event definition
	// unique even if the one with the same name exists.
	Labels map[string]string `json:"labels"`
}

type EventWatcherReplacement

type EventWatcherReplacement struct {
	// The path to the file to be updated.
	File string `json:"file"`
	// The field to be updated. Only one of these can be used.
	//
	// The YAML path to the field to be updated. It requires to start
	// with `$` which represents the root element. e.g. `$.foo.bar[0].baz`.
	YAMLField string `json:"yamlField"`
	// The JSON path to the field to be updated.
	JSONField string `json:"jsonField"`
	// The HCL path to the field to be updated.
	HCLField string `json:"HCLField"`
	// The regex string specifying what should be replaced.
	// Only the first capturing group enclosed by `()` will be replaced with the new value.
	// e.g. "host.xz/foo/bar:(v[0-9].[0-9].[0-9])"
	Regex string `json:"regex"`
}

type EventWatcherSpec

type EventWatcherSpec struct {
	Events []EventWatcherEvent `json:"events"`
}

func LoadEventWatcher

func LoadEventWatcher(repoRoot string, includePatterns, excludePatterns []string) (*EventWatcherSpec, error)

LoadEventWatcher gives back parsed EventWatcher config after merging config files placed under the .pipe directory. With "includes" and "excludes", you can filter the files included the result. "excludes" are prioritized if both "excludes" and "includes" are given. ErrNotFound is returned if not found.

func (*EventWatcherSpec) Validate

func (s *EventWatcherSpec) Validate() error

type FeatureFlag added in v0.40.0

type FeatureFlag string
const (
	FeatureFlagInsights FeatureFlag = "PIPECD_FEATURE_FLAG_INSIGHTS"
)

type FileStoreGCSConfig

type FileStoreGCSConfig struct {
	// The bucket name to store artifacts and logs in the piped.
	Bucket string `json:"bucket"`
	// The path to the credentials file for accessing GCS.
	CredentialsFile string `json:"credentialsFile"`
}

type FileStoreMinioConfig

type FileStoreMinioConfig struct {
	// The address of Minio.
	Endpoint string `json:"endpoint"`
	// The bucket name to store.
	Bucket string `json:"bucket"`
	// The path to the access key file.
	AccessKeyFile string `json:"accessKeyFile"`
	// The path to the secret key file.
	SecretKeyFile string `json:"secretKeyFile"`
	// Whether the given bucket should be made automatically if not exists.
	AutoCreateBucket bool `json:"autoCreateBucket"`
}

type FileStoreS3Config

type FileStoreS3Config struct {
	// The bucket name to store artifacts and logs in the piped.
	Bucket string `json:"bucket"`
	// The aws region of S3 bucket.
	Region string `json:"region"`
	// The aws profile name.
	Profile string `json:"profile"`
	// The path to the credentials file for accessing AWS.
	CredentialsFile string `json:"credentialsFile"`
	// The IAM role arn to use when assuming an role.
	RoleARN string `json:"roleARN"`
	// Path to the WebIdentity token the SDK should use to assume a role with.
	TokenFile string `json:"tokenFile"`
}

type GenericApplicationSpec

type GenericApplicationSpec struct {
	// The application name.
	// This is required if you set the application through the application configuration file.
	Name string `json:"name"`
	// Additional attributes to identify applications.
	Labels map[string]string `json:"labels"`
	// Notes on the Application.
	Description string `json:"description"`

	// Configuration used while planning deployment.
	Planner DeploymentPlanner `json:"planner"`
	// Forcibly use QuickSync or Pipeline when commit message matched the specified pattern.
	CommitMatcher DeploymentCommitMatcher `json:"commitMatcher"`
	// Pipeline for deploying progressively.
	Pipeline *DeploymentPipeline `json:"pipeline"`
	// The trigger configuration use to determine trigger logic.
	Trigger Trigger `json:"trigger"`
	// Configuration to be used once the deployment is triggered successfully.
	PostSync *PostSync `json:"postSync"`
	// The maximum length of time to execute deployment before giving up.
	// Default is 6h.
	Timeout Duration `json:"timeout,omitempty" default:"6h"`
	// List of encrypted secrets and targets that should be decoded before using.
	Encryption *SecretEncryption `json:"encryption"`
	// List of files that should be attached to application manifests before using.
	Attachment *Attachment `json:"attachment"`
	// Additional configuration used while sending notification to external services.
	DeploymentNotification *DeploymentNotification `json:"notification"`
	// List of the configuration for event watcher.
	EventWatcher []EventWatcherConfig `json:"eventWatcher"`
	// Configuration for drift detection
	DriftDetection *DriftDetection `json:"driftDetection"`
}

func LoadApplication added in v0.33.0

func LoadApplication(repoPath, configRelPath string, appKind model.ApplicationKind) (*GenericApplicationSpec, error)

func (GenericApplicationSpec) GetStage

func (s GenericApplicationSpec) GetStage(index int32) (PipelineStage, bool)

func (GenericApplicationSpec) HasStage

func (s GenericApplicationSpec) HasStage(stage model.Stage) bool

HasStage checks if the given stage is included in the pipeline.

func (*GenericApplicationSpec) Validate

func (s *GenericApplicationSpec) Validate() error

type HelmChartRegistry added in v0.32.0

type HelmChartRegistry struct {
	// The registry type. Currently, only OCI is supported.
	Type HelmChartRegistryType `json:"type" default:"OCI"`

	// The address to the Helm chart registry.
	Address string `json:"address"`
	// Username used for the registry authentication.
	Username string `json:"username,omitempty"`
	// Password used for the registry authentication.
	Password string `json:"password,omitempty"`
}

func (*HelmChartRegistry) IsOCI added in v0.32.0

func (r *HelmChartRegistry) IsOCI() bool

func (*HelmChartRegistry) Mask added in v0.33.0

func (r *HelmChartRegistry) Mask()

func (*HelmChartRegistry) Validate added in v0.32.0

func (r *HelmChartRegistry) Validate() error

type HelmChartRegistryType added in v0.32.0

type HelmChartRegistryType string
const (
	OCIHelmChartRegistry HelmChartRegistryType = "OCI"
)

The registry types that hosts Helm charts.

type HelmChartRepository

type HelmChartRepository struct {
	// The repository type. Currently, HTTP and GIT are supported.
	// Default is HTTP.
	Type HelmChartRepositoryType `json:"type" default:"HTTP"`

	// Configuration for HTTP type.
	// The name of the Helm chart repository.
	Name string `json:"name,omitempty"`
	// The address to the Helm chart repository.
	Address string `json:"address,omitempty"`
	// Username used for the repository backed by HTTP basic authentication.
	Username string `json:"username,omitempty"`
	// Password used for the repository backed by HTTP basic authentication.
	Password string `json:"password,omitempty"`
	// Whether to skip TLS certificate checks for the repository or not.
	Insecure bool `json:"insecure"`

	// Configuration for GIT type.
	// Remote address of the Git repository used to clone Helm charts.
	// e.g. git@github.com:org/repo.git
	GitRemote string `json:"gitRemote,omitempty"`
	// The path to the private ssh key file used while cloning Helm charts from above Git repository.
	SSHKeyFile string `json:"sshKeyFile,omitempty"`
}

func (*HelmChartRepository) IsGitRepository

func (r *HelmChartRepository) IsGitRepository() bool

func (*HelmChartRepository) IsHTTPRepository

func (r *HelmChartRepository) IsHTTPRepository() bool

func (*HelmChartRepository) Mask added in v0.33.0

func (r *HelmChartRepository) Mask()

func (*HelmChartRepository) Validate

func (r *HelmChartRepository) Validate() error

type HelmChartRepositoryType

type HelmChartRepositoryType string
const (
	HTTPHelmChartRepository HelmChartRepositoryType = "HTTP"
	GITHelmChartRepository  HelmChartRepositoryType = "GIT"
)

type InputHelmChart

type InputHelmChart struct {
	// Git remote address where the chart is placing.
	// Empty means the same repository.
	GitRemote string `json:"gitRemote"`
	// The commit SHA or tag for remote git.
	Ref string `json:"ref"`
	// Relative path from the repository root directory to the chart directory.
	Path string `json:"path"`

	// The name of an added Helm Chart Repository.
	Repository string `json:"repository"`
	Name       string `json:"name"`
	Version    string `json:"version"`
	// Whether to skip TLS certificate checks for the repository or not.
	// This option will automatically set the value of HelmChartRepository.Insecure.
	Insecure bool `json:"-"`
}

type InputHelmOptions

type InputHelmOptions struct {
	// The release name of helm deployment.
	// By default the release name is equal to the application name.
	ReleaseName string `json:"releaseName"`
	// List of value files should be loaded.
	ValueFiles []string `json:"valueFiles"`
	// List of file path for values.
	SetFiles map[string]string
	// Set of supported Kubernetes API versions.
	APIVersions []string `json:"apiVersions"`
	// Kubernetes version used for Capabilities.KubeVersion
	KubeVersion string `json:"kubeVersion"`
}

type InsightCollectorApplication

type InsightCollectorApplication struct {
	Enabled *bool `json:"enabled" default:"true"`
	// Default is running every hour.
	Schedule string `json:"schedule" default:"0 * * * *"`
}

type InsightCollectorDeployment

type InsightCollectorDeployment struct {
	Enabled *bool `json:"enabled" default:"true"`
	// Default is running every hour.
	Schedule      string `json:"schedule" default:"30 * * * *"`
	ChunkMaxCount int    `json:"chunkMaxCount" default:"1000"`
}

type IstioTrafficRouting

type IstioTrafficRouting struct {
	// List of routes in the VirtualService that can be changed to update traffic routing.
	// Empty means all routes should be updated.
	EditableRoutes []string `json:"editableRoutes"`
	// TODO: Add a validate to ensure this was configured or using the default value by service name.
	// The service host.
	Host string `json:"host"`
	// The reference to VirtualService manifest.
	// Empty means the first VirtualService resource will be used.
	VirtualService K8sResourceReference `json:"virtualService"`
}

type K8sBaselineCleanStageOptions

type K8sBaselineCleanStageOptions struct {
}

K8sBaselineCleanStageOptions contains all configurable values for a K8S_BASELINE_CLEAN stage.

type K8sBaselineRolloutStageOptions

type K8sBaselineRolloutStageOptions struct {
	// How many pods for BASELINE workloads.
	// An integer value can be specified to indicate an absolute value of pod number.
	// Or a string suffixed by "%" to indicate an percentage value compared to the pod number of PRIMARY.
	// Default is 1 pod.
	Replicas Replicas `json:"replicas"`
	// Suffix that should be used when naming the BASELINE variant's resources.
	// Default is "baseline".
	Suffix string `json:"suffix"`
	// Whether the BASELINE service should be created.
	CreateService bool `json:"createService"`
}

K8sBaselineRolloutStageOptions contains all configurable values for a K8S_BASELINE_ROLLOUT stage.

type K8sCanaryCleanStageOptions

type K8sCanaryCleanStageOptions struct {
}

K8sCanaryCleanStageOptions contains all configurable values for a K8S_CANARY_CLEAN stage.

type K8sCanaryRolloutStageOptions

type K8sCanaryRolloutStageOptions struct {
	// How many pods for CANARY workloads.
	// An integer value can be specified to indicate an absolute value of pod number.
	// Or a string suffixed by "%" to indicate an percentage value compared to the pod number of PRIMARY.
	// Default is 1 pod.
	Replicas Replicas `json:"replicas"`
	// Suffix that should be used when naming the CANARY variant's resources.
	// Default is "canary".
	Suffix string `json:"suffix"`
	// Whether the CANARY service should be created.
	CreateService bool `json:"createService"`
	// List of patches used to customize manifests for CANARY variant.
	Patches []K8sResourcePatch
}

K8sCanaryRolloutStageOptions contains all configurable values for a K8S_CANARY_ROLLOUT stage.

type K8sPrimaryRolloutStageOptions

type K8sPrimaryRolloutStageOptions struct {
	// Suffix that should be used when naming the PRIMARY variant's resources.
	// Default is "primary".
	Suffix string `json:"suffix"`
	// Whether the PRIMARY service should be created.
	CreateService bool `json:"createService"`
	// Whether the PRIMARY variant label should be added to manifests if they were missing.
	AddVariantLabelToSelector bool `json:"addVariantLabelToSelector"`
	// Whether the resources that are no longer defined in Git should be removed or not.
	Prune bool `json:"prune"`
}

K8sPrimaryRolloutStageOptions contains all configurable values for a K8S_PRIMARY_ROLLOUT stage.

type K8sResourcePatch

type K8sResourcePatch struct {
	Target K8sResourcePatchTarget `json:"target"`
	Ops    []K8sResourcePatchOp   `json:"ops"`
}

type K8sResourcePatchOp

type K8sResourcePatchOp struct {
	// The operation type.
	// This must be one of "yaml-replace", "yaml-add", "yaml-remove", "json-replace" or "text-regex".
	// Default is "yaml-replace".
	Op K8sResourcePatchOpName `json:"op" default:"yaml-replace"`
	// The path string pointing to the manipulated field.
	// E.g. "$.spec.foos[0].bar"
	Path string `json:"path"`
	// The value string whose content will be used as new value for the field.
	Value string `json:"value"`
}

type K8sResourcePatchOpName

type K8sResourcePatchOpName string

type K8sResourcePatchTarget

type K8sResourcePatchTarget struct {
	K8sResourceReference
	// In case you want to manipulate the YAML or JSON data specified in a field
	// of the manifest, specify that field's path. The string value of that field
	// will be used as input for the patch operations.
	// Otherwise, the whole manifest will be the target of patch operations.
	DocumentRoot string `json:"documentRoot"`
}

type K8sResourceReference

type K8sResourceReference struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

type K8sSyncStageOptions

type K8sSyncStageOptions struct {
	// Whether the PRIMARY variant label should be added to manifests if they were missing.
	AddVariantLabelToSelector bool `json:"addVariantLabelToSelector"`
	// Whether the resources that are no longer defined in Git should be removed or not.
	Prune bool `json:"prune"`
}

K8sSyncStageOptions contains all configurable values for a K8S_SYNC stage.

type K8sTrafficRoutingStageOptions

type K8sTrafficRoutingStageOptions struct {
	// Which variant should receive all traffic.
	// "primary" or "canary" or "baseline" can be populated.
	All string `json:"all"`
	// The percentage of traffic should be routed to PRIMARY variant.
	Primary Percentage `json:"primary"`
	// The percentage of traffic should be routed to CANARY variant.
	Canary Percentage `json:"canary"`
	// The percentage of traffic should be routed to BASELINE variant.
	Baseline Percentage `json:"baseline"`
}

K8sTrafficRoutingStageOptions contains all configurable values for a K8S_TRAFFIC_ROUTING stage.

func (K8sTrafficRoutingStageOptions) Percentages

func (opts K8sTrafficRoutingStageOptions) Percentages() (primary, canary, baseline int)

type Kind

type Kind string

Kind represents the kind of configuration the data contains.

const (
	// KindKubernetesApp represents application configuration for a Kubernetes application.
	// This application can be a group of plain-YAML Kubernetes manifests,
	// or kustomization manifests or helm manifests.
	KindKubernetesApp Kind = "KubernetesApp"
	// KindTerraformApp represents application configuration for a Terraform application.
	// This application contains a single workspace of a terraform root module.
	KindTerraformApp Kind = "TerraformApp"
	// KindLambdaApp represents application configuration for an AWS Lambda application.
	KindLambdaApp Kind = "LambdaApp"
	// KindCloudRunApp represents application configuration for a CloudRun application.
	KindCloudRunApp Kind = "CloudRunApp"
	// KindECSApp represents application configuration for an AWS ECS.
	KindECSApp Kind = "ECSApp"
)
const (
	// KindPiped represents configuration for piped.
	// This configuration will be loaded while the piped is starting up.
	KindPiped Kind = "Piped"
	// KindControlPlane represents configuration for control plane's services.
	KindControlPlane Kind = "ControlPlane"
	// KindAnalysisTemplate represents shared analysis template for a repository.
	// This configuration file should be placed in .pipe directory
	// at the root of the repository.
	KindAnalysisTemplate Kind = "AnalysisTemplate"
	// KindEventWatcher represents configuration for Event Watcher.
	KindEventWatcher Kind = "EventWatcher"
)

func (Kind) ToApplicationKind

func (k Kind) ToApplicationKind() (model.ApplicationKind, bool)

ToApplicationKind converts configuration kind to application kind.

type KubernetesAppStateInformer

type KubernetesAppStateInformer struct {
	// Only watches the specified namespace.
	// Empty means watching all namespaces.
	Namespace string `json:"namespace,omitempty"`
	// List of resources that should be added to the watching targets.
	IncludeResources []KubernetesResourceMatcher `json:"includeResources,omitempty"`
	// List of resources that should be ignored from the watching targets.
	ExcludeResources []KubernetesResourceMatcher `json:"excludeResources,omitempty"`
}

type KubernetesApplicationSpec

type KubernetesApplicationSpec struct {
	GenericApplicationSpec
	// Input for Kubernetes deployment such as kubectl version, helm version, manifests filter...
	Input KubernetesDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync K8sSyncStageOptions `json:"quickSync"`
	// Which resource should be considered as the Service of application.
	// Empty means the first Service resource will be used.
	Service K8sResourceReference `json:"service"`
	// Which resources should be considered as the Workload of application.
	// Empty means all Deployments.
	// e.g.
	// - kind: Deployment
	//   name: deployment-name
	// - kind: ReplicationController
	//   name: replication-controller-name
	Workloads []K8sResourceReference `json:"workloads"`
	// Which method should be used for traffic routing.
	TrafficRouting *KubernetesTrafficRouting `json:"trafficRouting"`
	// The label will be configured to variant manifests used to distinguish them.
	VariantLabel KubernetesVariantLabel `json:"variantLabel"`
	// List of route configurations to resolve the platform provider for application resources.
	// Each resource will be checked over the match conditions of each route.
	// If matches, it will be applied to the route's provider,
	// otherwise, it will be fallen through the next route to check.
	// Any resource which does not match any specified route will be applied
	// to the default platform provider which had been specified while registering the application.
	ResourceRoutes []KubernetesResourceRoute `json:"resourceRoutes"`
}

KubernetesApplicationSpec represents an application configuration for Kubernetes application.

func (*KubernetesApplicationSpec) Validate

func (s *KubernetesApplicationSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type KubernetesDeploymentInput

type KubernetesDeploymentInput struct {
	// List of manifest files in the application directory used to deploy.
	// Empty means all manifest files in the directory will be used.
	Manifests []string `json:"manifests"`
	// Version of kubectl will be used.
	KubectlVersion string `json:"kubectlVersion"`

	// Version of kustomize will be used.
	KustomizeVersion string `json:"kustomizeVersion"`
	// List of options that should be used by Kustomize commands.
	KustomizeOptions map[string]string `json:"kustomizeOptions"`

	// Version of helm will be used.
	HelmVersion string `json:"helmVersion"`
	// Where to fetch helm chart.
	HelmChart *InputHelmChart `json:"helmChart"`
	// Configurable parameters for helm commands.
	HelmOptions *InputHelmOptions `json:"helmOptions"`

	// The namespace where manifests will be applied.
	Namespace string `json:"namespace"`

	// Automatically reverts all deployment changes on failure.
	// Default is true.
	AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`

	// Automatically create a new namespace if it does not exist.
	// Default is false.
	AutoCreateNamespace bool `json:"autoCreateNamespace,omitempty"`
}

KubernetesDeploymentInput represents needed input for triggering a Kubernetes deployment.

type KubernetesProviderMatcher added in v0.36.0

type KubernetesProviderMatcher struct {
	Name   string            `json:"name"`
	Labels map[string]string `json:"labels"`
}

type KubernetesResourceMatcher

type KubernetesResourceMatcher struct {
	// The APIVersion of the kubernetes resource.
	APIVersion string `json:"apiVersion,omitempty"`
	// The kind name of the kubernetes resource.
	// Empty means all kinds are matching.
	Kind string `json:"kind,omitempty"`
}

type KubernetesResourceRoute added in v0.34.1

type KubernetesResourceRoute struct {
	Provider KubernetesProviderMatcher       `json:"provider"`
	Match    *KubernetesResourceRouteMatcher `json:"match"`
}

type KubernetesResourceRouteMatcher added in v0.34.1

type KubernetesResourceRouteMatcher struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

type KubernetesTrafficRouting

type KubernetesTrafficRouting struct {
	Method KubernetesTrafficRoutingMethod `json:"method"`
	Istio  *IstioTrafficRouting           `json:"istio"`
}

type KubernetesTrafficRoutingMethod

type KubernetesTrafficRoutingMethod string
const (
	KubernetesTrafficRoutingMethodPodSelector KubernetesTrafficRoutingMethod = "podselector"
	KubernetesTrafficRoutingMethodIstio       KubernetesTrafficRoutingMethod = "istio"
	KubernetesTrafficRoutingMethodSMI         KubernetesTrafficRoutingMethod = "smi"
)

func DetermineKubernetesTrafficRoutingMethod

func DetermineKubernetesTrafficRoutingMethod(cfg *KubernetesTrafficRouting) KubernetesTrafficRoutingMethod

DetermineKubernetesTrafficRoutingMethod determines the routing method should be used based on the TrafficRouting config. The default is PodSelector: the way by updating the selector in Service to switching all of traffic.

type KubernetesVariantLabel added in v0.25.0

type KubernetesVariantLabel struct {
	// The key of the label.
	// Default is pipecd.dev/variant.
	Key string `json:"key" default:"pipecd.dev/variant"`
	// The label value for PRIMARY variant.
	// Default is primary.
	PrimaryValue string `json:"primaryValue" default:"primary"`
	// The label value for CANARY variant.
	// Default is canary.
	CanaryValue string `json:"canaryValue" default:"canary"`
	// The label value for BASELINE variant.
	// Default is baseline.
	BaselineValue string `json:"baselineValue" default:"baseline"`
}

type LambdaApplicationSpec

type LambdaApplicationSpec struct {
	GenericApplicationSpec
	// Input for Lambda deployment such as where to fetch source code...
	Input LambdaDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync LambdaSyncStageOptions `json:"quickSync"`
}

LambdaApplicationSpec represents an application configuration for Lambda application.

func (*LambdaApplicationSpec) Validate

func (s *LambdaApplicationSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type LambdaCanaryRolloutStageOptions

type LambdaCanaryRolloutStageOptions struct {
}

LambdaCanaryRolloutStageOptions contains all configurable values for a LAMBDA_CANARY_ROLLOUT stage.

type LambdaDeploymentInput

type LambdaDeploymentInput struct {
	// The name of service manifest file placing in application directory.
	// Default is function.yaml
	FunctionManifestFile string `json:"functionManifestFile" default:"function.yaml"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is true.
	AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
}

type LambdaPromoteStageOptions

type LambdaPromoteStageOptions struct {
	// Percentage of traffic should be routed to the new version.
	Percent Percentage `json:"percent"`
}

LambdaPromoteStageOptions contains all configurable values for a LAMBDA_PROMOTE stage.

type LambdaSyncStageOptions

type LambdaSyncStageOptions struct {
}

LambdaSyncStageOptions contains all configurable values for a LAMBDA_SYNC stage.

type LauncherConfig added in v0.27.0

type LauncherConfig struct {
	Kind       Kind         `json:"kind"`
	APIVersion string       `json:"apiVersion,omitempty"`
	Spec       LauncherSpec `json:"spec"`
}

func (*LauncherConfig) Validate added in v0.27.0

func (c *LauncherConfig) Validate() error

type LauncherSpec added in v0.27.0

type LauncherSpec struct {
	// The identifier of the PipeCD project where this piped belongs to.
	ProjectID string
	// The unique identifier generated for this piped.
	PipedID string
	// The path to the file containing the generated Key string for this piped.
	PipedKeyFile string
	// Base64 encoded string of Piped key.
	PipedKeyData string
	// The address used to connect to the control-plane's API.
	APIAddress string `json:"apiAddress"`
}

func (*LauncherSpec) LoadPipedKey added in v0.27.0

func (s *LauncherSpec) LoadPipedKey() ([]byte, error)

type NotificationMention

type NotificationMention struct {
	// The event to be notified to users.
	Event string `json:"event"`
	// List of user IDs for mentioning in Slack.
	// See https://api.slack.com/reference/surfaces/formatting#mentioning-users
	// for more information on how to check them.
	Slack []string `json:"slack"`
	// TODO: Support for email notification
	// The email for notification.
	Email []string `json:"email"`
}

func (*NotificationMention) Validate

func (n *NotificationMention) Validate() error

type NotificationReceiver

type NotificationReceiver struct {
	Name    string                       `json:"name"`
	Slack   *NotificationReceiverSlack   `json:"slack,omitempty"`
	Webhook *NotificationReceiverWebhook `json:"webhook,omitempty"`
}

func (*NotificationReceiver) Mask added in v0.33.0

func (n *NotificationReceiver) Mask()

type NotificationReceiverSlack

type NotificationReceiverSlack struct {
	HookURL           string   `json:"hookURL"`
	OAuthToken        string   `json:"oauthToken"` // Deprecated: use OAuthTokenData instead.
	OAuthTokenData    string   `json:"oauthTokenData"`
	OAuthTokenFile    string   `json:"oauthTokenFile"`
	ChannelID         string   `json:"channelID"`
	MentionedAccounts []string `json:"mentionedAccounts,omitempty"`
}

func (*NotificationReceiverSlack) Mask added in v0.33.0

func (n *NotificationReceiverSlack) Mask()

func (*NotificationReceiverSlack) Validate added in v0.44.0

func (n *NotificationReceiverSlack) Validate() error

type NotificationReceiverWebhook

type NotificationReceiverWebhook struct {
	URL                string `json:"url"`
	SignatureKey       string `json:"signatureKey,omitempty" default:"PipeCD-Signature"`
	SignatureValue     string `json:"signatureValue,omitempty"`
	SignatureValueFile string `json:"signatureValueFile,omitempty"`
}

func (*NotificationReceiverWebhook) LoadSignatureValue added in v0.27.3

func (n *NotificationReceiverWebhook) LoadSignatureValue() (string, error)

func (*NotificationReceiverWebhook) Mask added in v0.33.0

func (n *NotificationReceiverWebhook) Mask()

type NotificationRoute

type NotificationRoute struct {
	Name         string            `json:"name"`
	Receiver     string            `json:"receiver"`
	Events       []string          `json:"events,omitempty"`
	IgnoreEvents []string          `json:"ignoreEvents,omitempty"`
	Groups       []string          `json:"groups,omitempty"`
	IgnoreGroups []string          `json:"ignoreGroups,omitempty"`
	Apps         []string          `json:"apps,omitempty"`
	IgnoreApps   []string          `json:"ignoreApps,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	IgnoreLabels map[string]string `json:"ignoreLabels,omitempty"`
}

type Notifications

type Notifications struct {
	// List of notification routes.
	Routes []NotificationRoute `json:"routes,omitempty"`
	// List of notification receivers.
	Receivers []NotificationReceiver `json:"receivers,omitempty"`
}

func (*Notifications) Mask added in v0.33.0

func (n *Notifications) Mask()

type OnChain

type OnChain struct {
	// Whether to exclude application from triggering target
	// when received a new CHAIN_SYNC command.
	// Default is true.
	Disabled *bool `json:"disabled,omitempty" default:"true"`
}

type OnCommand

type OnCommand struct {
	// Whether to exclude application from triggering target
	// when received a new SYNC command.
	// Default is false.
	Disabled bool `json:"disabled,omitempty"`
}

type OnCommit

type OnCommit struct {
	// Whether to exclude application from triggering target
	// when a new commit touched the application.
	// Default is false.
	Disabled bool `json:"disabled,omitempty"`
	// List of directories or files where their changes will trigger the deployment.
	// Regular expression can be used.
	Paths []string `json:"paths,omitempty"`
	// List of directories or files where their changes will be ignored.
	// Regular expression can be used.
	Ignores []string `json:"ignores,omitempty"`
}

type OnOutOfSync

type OnOutOfSync struct {
	// Whether to exclude application from triggering target
	// when application is at OUT_OF_SYNC state.
	// Default is true.
	Disabled *bool `json:"disabled,omitempty" default:"true"`
	// Minimum amount of time must be elapsed since the last deployment.
	// This can be used to avoid triggering unnecessary continuous deployments based on OUT_OF_SYNC status.
	MinWindow Duration `json:"minWindow,omitempty" default:"5m"`
}

type Percentage

type Percentage struct {
	Number    int
	HasSuffix bool
}

func (Percentage) Int

func (p Percentage) Int() int

func (Percentage) MarshalJSON

func (p Percentage) MarshalJSON() ([]byte, error)

func (Percentage) String

func (p Percentage) String() string

func (*Percentage) UnmarshalJSON

func (p *Percentage) UnmarshalJSON(b []byte) error

type PipedAnalysisProvider

type PipedAnalysisProvider struct {
	Name string                     `json:"name"`
	Type model.AnalysisProviderType `json:"type"`

	PrometheusConfig  *AnalysisProviderPrometheusConfig
	DatadogConfig     *AnalysisProviderDatadogConfig
	StackdriverConfig *AnalysisProviderStackdriverConfig
}

func (*PipedAnalysisProvider) MarshalJSON added in v0.35.0

func (p *PipedAnalysisProvider) MarshalJSON() ([]byte, error)

func (*PipedAnalysisProvider) Mask added in v0.33.0

func (p *PipedAnalysisProvider) Mask()

func (*PipedAnalysisProvider) UnmarshalJSON

func (p *PipedAnalysisProvider) UnmarshalJSON(data []byte) error

func (*PipedAnalysisProvider) Validate

func (p *PipedAnalysisProvider) Validate() error

type PipedEventWatcher

type PipedEventWatcher struct {
	// Interval to fetch the latest event and compare it with one defined in EventWatcher config files
	CheckInterval Duration `json:"checkInterval,omitempty"`
	// The configuration list of git repositories to be observed.
	// Only the repositories in this list will be observed by Piped.
	GitRepos []PipedEventWatcherGitRepo `json:"gitRepos,omitempty"`
}

func (*PipedEventWatcher) Validate

func (p *PipedEventWatcher) Validate() error

type PipedEventWatcherGitRepo

type PipedEventWatcherGitRepo struct {
	// Id of the git repository. This must be unique within
	// the repos' elements.
	RepoID string `json:"repoId,omitempty"`
	// The commit message used to push after replacing values.
	// Default message is used if not given.
	CommitMessage string `json:"commitMessage,omitempty"`
	// The file path patterns to be included.
	// Patterns can be used like "foo/*.yaml".
	Includes []string `json:"includes,omitempty"`
	// The file path patterns to be excluded.
	// Patterns can be used like "foo/*.yaml".
	// This is prioritized if both includes and this one are given.
	Excludes []string `json:"excludes,omitempty"`
}

type PipedGit

type PipedGit struct {
	// The username that will be configured for `git` user.
	// Default is "piped".
	Username string `json:"username,omitempty"`
	// The email that will be configured for `git` user.
	// Default is "pipecd.dev@gmail.com".
	Email string `json:"email,omitempty"`
	// Where to write ssh config file.
	// Default is "$HOME/.ssh/config".
	SSHConfigFilePath string `json:"sshConfigFilePath,omitempty"`
	// The host name.
	// e.g. github.com, gitlab.com
	// Default is "github.com".
	Host string `json:"host,omitempty"`
	// The hostname or IP address of the remote git server.
	// e.g. github.com, gitlab.com
	// Default is the same value with Host.
	HostName string `json:"hostName,omitempty"`
	// The path to the private ssh key file.
	// This will be used to clone the source code of the specified git repositories.
	SSHKeyFile string `json:"sshKeyFile,omitempty"`
	// Base64 encoded string of ssh-key.
	SSHKeyData string `json:"sshKeyData,omitempty"`
}

func (PipedGit) LoadSSHKey

func (g PipedGit) LoadSSHKey() ([]byte, error)

func (*PipedGit) Mask added in v0.33.0

func (g *PipedGit) Mask()

func (PipedGit) ShouldConfigureSSHConfig

func (g PipedGit) ShouldConfigureSSHConfig() bool

type PipedPlatformProvider added in v0.34.1

type PipedPlatformProvider struct {
	Name   string                     `json:"name"`
	Type   model.PlatformProviderType `json:"type"`
	Labels map[string]string          `json:"labels,omitempty"`

	KubernetesConfig *PlatformProviderKubernetesConfig
	TerraformConfig  *PlatformProviderTerraformConfig
	CloudRunConfig   *PlatformProviderCloudRunConfig
	LambdaConfig     *PlatformProviderLambdaConfig
	ECSConfig        *PlatformProviderECSConfig
}

func (*PipedPlatformProvider) MarshalJSON added in v0.35.0

func (p *PipedPlatformProvider) MarshalJSON() ([]byte, error)

func (*PipedPlatformProvider) Mask added in v0.34.1

func (p *PipedPlatformProvider) Mask()

func (*PipedPlatformProvider) UnmarshalJSON added in v0.34.1

func (p *PipedPlatformProvider) UnmarshalJSON(data []byte) error

type PipedRepository

type PipedRepository struct {
	// Unique identifier for this repository.
	// This must be unique in the piped scope.
	RepoID string `json:"repoId"`
	// Remote address of the repository used to clone the source code.
	// e.g. git@github.com:org/repo.git
	Remote string `json:"remote"`
	// The branch will be handled.
	Branch string `json:"branch"`
}

type PipedSpec

type PipedSpec struct {
	// The identifier of the PipeCD project where this piped belongs to.
	ProjectID string `json:"projectID"`
	// The unique identifier generated for this piped.
	PipedID string `json:"pipedID"`
	// The path to the file containing the generated Key string for this piped.
	PipedKeyFile string `json:"pipedKeyFile,omitempty"`
	// Base64 encoded string of Piped key.
	PipedKeyData string `json:"pipedKeyData,omitempty"`
	// The name of this piped.
	Name string `json:"name,omitempty"`
	// The address used to connect to the control-plane's API.
	APIAddress string `json:"apiAddress"`
	// The address to the control-plane's Web.
	WebAddress string `json:"webAddress,omitempty"`
	// How often to check whether an application should be synced.
	// Default is 1m.
	SyncInterval Duration `json:"syncInterval,omitempty" default:"1m"`
	// How often to check whether an application configuration file should be synced.
	// Default is 1m.
	AppConfigSyncInterval Duration `json:"appConfigSyncInterval,omitempty" default:"1m"`
	// Git configuration needed for git commands.
	Git PipedGit `json:"git,omitempty"`
	// List of git repositories this piped will handle.
	Repositories []PipedRepository `json:"repositories,omitempty"`
	// List of helm chart repositories that should be added while starting up.
	ChartRepositories []HelmChartRepository `json:"chartRepositories,omitempty"`
	// List of helm chart registries that should be logged in while starting up.
	ChartRegistries []HelmChartRegistry `json:"chartRegistries,omitempty"`
	// List of cloud providers can be used by this piped.
	// Deprecated: use PlatformProvider instead.
	CloudProviders []PipedPlatformProvider `json:"cloudProviders,omitempty"`
	// List of platform providers can be used by this piped.
	PlatformProviders []PipedPlatformProvider `json:"platformProviders,omitempty"`
	// List of analysis providers can be used by this piped.
	AnalysisProviders []PipedAnalysisProvider `json:"analysisProviders,omitempty"`
	// Sending notification to Slack, Webhook…
	Notifications Notifications `json:"notifications"`
	// What secret management method should be used.
	SecretManagement *SecretManagement `json:"secretManagement,omitempty"`
	// Optional settings for event watcher.
	EventWatcher PipedEventWatcher `json:"eventWatcher"`
	// List of labels to filter all applications this piped will handle.
	AppSelector map[string]string `json:"appSelector,omitempty"`
}

PipedSpec contains configurable data used to while running Piped.

func (*PipedSpec) Clone added in v0.33.0

func (s *PipedSpec) Clone() (*PipedSpec, error)

Clone generates a cloned PipedSpec object.

func (*PipedSpec) EnableDefaultKubernetesPlatformProvider added in v0.35.0

func (s *PipedSpec) EnableDefaultKubernetesPlatformProvider()

EnableDefaultKubernetesPlatformProvider adds the default kubernetes cloud provider if it was not specified.

func (*PipedSpec) FindPlatformProvider added in v0.35.0

func (s *PipedSpec) FindPlatformProvider(name string, t model.ApplicationKind) (PipedPlatformProvider, bool)

FindPlatformProvider finds and returns a Platform Provider by name and type.

func (*PipedSpec) FindPlatformProvidersByLabels added in v0.36.0

func (s *PipedSpec) FindPlatformProvidersByLabels(labels map[string]string, t model.ApplicationKind) []PipedPlatformProvider

FindPlatformProvidersByLabels finds all PlatformProviders which match the provided labels.

func (*PipedSpec) GetAnalysisProvider

func (s *PipedSpec) GetAnalysisProvider(name string) (PipedAnalysisProvider, bool)

GetAnalysisProvider finds and returns an Analysis Provider config whose name is the given string.

func (*PipedSpec) GetRepository

func (s *PipedSpec) GetRepository(id string) (PipedRepository, bool)

GetRepository finds a repository with the given ID from the configured list.

func (*PipedSpec) GetRepositoryMap

func (s *PipedSpec) GetRepositoryMap() map[string]PipedRepository

GetRepositoryMap returns a map of repositories where key is repo id.

func (*PipedSpec) GitHelmChartRepositories

func (s *PipedSpec) GitHelmChartRepositories() []HelmChartRepository

func (*PipedSpec) HTTPHelmChartRepositories

func (s *PipedSpec) HTTPHelmChartRepositories() []HelmChartRepository

func (*PipedSpec) HasPlatformProvider added in v0.35.0

func (s *PipedSpec) HasPlatformProvider(name string, t model.ApplicationKind) bool

HasPlatformProvider checks whether the given provider is configured or not.

func (*PipedSpec) IsInsecureChartRepository

func (s *PipedSpec) IsInsecureChartRepository(name string) bool

func (*PipedSpec) LoadPipedKey

func (s *PipedSpec) LoadPipedKey() ([]byte, error)

func (*PipedSpec) Mask added in v0.33.0

func (s *PipedSpec) Mask()

Mask masks confidential fields.

func (*PipedSpec) UnmarshalJSON added in v0.35.0

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

func (*PipedSpec) Validate

func (s *PipedSpec) Validate() error

Validate validates configured data of all fields.

type PipelineStage

type PipelineStage struct {
	Id      string
	Name    model.Stage
	Desc    string
	Timeout Duration

	CustomSyncOptions        *CustomSyncOptions
	WaitStageOptions         *WaitStageOptions
	WaitApprovalStageOptions *WaitApprovalStageOptions
	AnalysisStageOptions     *AnalysisStageOptions

	K8sPrimaryRolloutStageOptions  *K8sPrimaryRolloutStageOptions
	K8sCanaryRolloutStageOptions   *K8sCanaryRolloutStageOptions
	K8sCanaryCleanStageOptions     *K8sCanaryCleanStageOptions
	K8sBaselineRolloutStageOptions *K8sBaselineRolloutStageOptions
	K8sBaselineCleanStageOptions   *K8sBaselineCleanStageOptions
	K8sTrafficRoutingStageOptions  *K8sTrafficRoutingStageOptions

	TerraformSyncStageOptions  *TerraformSyncStageOptions
	TerraformPlanStageOptions  *TerraformPlanStageOptions
	TerraformApplyStageOptions *TerraformApplyStageOptions

	CloudRunSyncStageOptions    *CloudRunSyncStageOptions
	CloudRunPromoteStageOptions *CloudRunPromoteStageOptions

	LambdaSyncStageOptions          *LambdaSyncStageOptions
	LambdaCanaryRolloutStageOptions *LambdaCanaryRolloutStageOptions
	LambdaPromoteStageOptions       *LambdaPromoteStageOptions

	ECSSyncStageOptions           *ECSSyncStageOptions
	ECSCanaryRolloutStageOptions  *ECSCanaryRolloutStageOptions
	ECSPrimaryRolloutStageOptions *ECSPrimaryRolloutStageOptions
	ECSCanaryCleanStageOptions    *ECSCanaryCleanStageOptions
	ECSTrafficRoutingStageOptions *ECSTrafficRoutingStageOptions
}

PipelineStage represents a single stage of a pipeline. This is used as a generic struct for all stage type.

func (*PipelineStage) UnmarshalJSON

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

type PlatformProviderCloudRunConfig added in v0.34.1

type PlatformProviderCloudRunConfig struct {
	// The GCP project hosting the CloudRun service.
	Project string `json:"project"`
	// The region of running CloudRun service.
	Region string `json:"region"`
	// The path to the service account file for accessing CloudRun service.
	CredentialsFile string `json:"credentialsFile,omitempty"`
}

func (*PlatformProviderCloudRunConfig) Mask added in v0.34.1

type PlatformProviderECSConfig added in v0.34.1

type PlatformProviderECSConfig struct {
	// The region to send requests to. This parameter is required.
	// e.g. "us-west-2"
	// A full list of regions is: https://docs.aws.amazon.com/general/latest/gr/rande.html
	Region string `json:"region"`
	// Path to the shared credentials file.
	CredentialsFile string `json:"credentialsFile,omitempty"`
	// The IAM role arn to use when assuming an role.
	RoleARN string `json:"roleARN,omitempty"`
	// Path to the WebIdentity token the SDK should use to assume a role with.
	TokenFile string `json:"tokenFile,omitempty"`
	// AWS Profile to extract credentials from the shared credentials file.
	// If empty, the environment variable "AWS_PROFILE" is used.
	// "default" is populated if the environment variable is also not set.
	Profile string `json:"profile,omitempty"`
}

func (*PlatformProviderECSConfig) Mask added in v0.34.1

func (c *PlatformProviderECSConfig) Mask()

type PlatformProviderKubernetesConfig added in v0.34.1

type PlatformProviderKubernetesConfig struct {
	// The master URL of the kubernetes cluster.
	// Empty means in-cluster.
	MasterURL string `json:"masterURL,omitempty"`
	// The path to the kubeconfig file.
	// Empty means in-cluster.
	KubeConfigPath string `json:"kubeConfigPath,omitempty"`
	// Configuration for application resource informer.
	AppStateInformer KubernetesAppStateInformer `json:"appStateInformer"`
	// Version of kubectl will be used.
	KubectlVersion string `json:"kubectlVersion"`
}

type PlatformProviderLambdaConfig added in v0.34.1

type PlatformProviderLambdaConfig struct {
	// The region to send requests to. This parameter is required.
	// e.g. "us-west-2"
	// A full list of regions is: https://docs.aws.amazon.com/general/latest/gr/rande.html
	Region string `json:"region"`
	// Path to the shared credentials file.
	CredentialsFile string `json:"credentialsFile,omitempty"`
	// The IAM role arn to use when assuming an role.
	RoleARN string `json:"roleARN,omitempty"`
	// Path to the WebIdentity token the SDK should use to assume a role with.
	TokenFile string `json:"tokenFile,omitempty"`
	// AWS Profile to extract credentials from the shared credentials file.
	// If empty, the environment variable "AWS_PROFILE" is used.
	// "default" is populated if the environment variable is also not set.
	Profile string `json:"profile,omitempty"`
}

func (*PlatformProviderLambdaConfig) Mask added in v0.34.1

func (c *PlatformProviderLambdaConfig) Mask()

type PlatformProviderTerraformConfig added in v0.34.1

type PlatformProviderTerraformConfig struct {
	// List of variables that will be set directly on terraform commands with "-var" flag.
	// The variable must be formatted by "key=value" as below:
	// "image_id=ami-abc123"
	// 'image_id_list=["ami-abc123","ami-def456"]'
	// 'image_id_map={"us-east-1":"ami-abc123","us-east-2":"ami-def456"}'
	Vars []string `json:"vars,omitempty"`
	// Enable drift detection.
	// TODO: This is a temporary option because Terraform drift detection is buggy and has performace issues. This will be possibly removed in the future release.
	DriftDetectionEnabled *bool `json:"driftDetectionEnabled" default:"true"`
}

type PostSync

type PostSync struct {
	DeploymentChain *DeploymentChain `json:"chain"`
}

PostSync provides all configurations to be used once the current deployment is triggered successfully.

func (*PostSync) Validate

func (p *PostSync) Validate() error

type ProjectStaticUser

type ProjectStaticUser struct {
	// The username string.
	Username string `json:"username"`
	// The bcrypt hashsed value of the password string.
	PasswordHash string `json:"passwordHash"`
}

type Replicas

type Replicas struct {
	Number       int
	IsPercentage bool
}

func (Replicas) Calculate

func (r Replicas) Calculate(total, defaultValue int) int

func (Replicas) MarshalJSON

func (r Replicas) MarshalJSON() ([]byte, error)

func (Replicas) String

func (r Replicas) String() string

func (*Replicas) UnmarshalJSON

func (r *Replicas) UnmarshalJSON(b []byte) error

type SecretEncryption

type SecretEncryption struct {
	// List of encrypted secrets.
	EncryptedSecrets map[string]string `json:"encryptedSecrets"`
	// List of files to be decrypted before using.
	DecryptionTargets []string `json:"decryptionTargets"`
}

func (*SecretEncryption) Validate

func (e *SecretEncryption) Validate() error

type SecretManagement

type SecretManagement struct {
	// Which management service should be used.
	// Available values: KEY_PAIR, GCP_KMS, AWS_KMS
	Type model.SecretManagementType `json:"type"`

	KeyPair *SecretManagementKeyPair
	GCPKMS  *SecretManagementGCPKMS
}

func (*SecretManagement) MarshalJSON added in v0.35.0

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

func (*SecretManagement) Mask added in v0.33.0

func (s *SecretManagement) Mask()

func (*SecretManagement) UnmarshalJSON

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

func (*SecretManagement) Validate

func (s *SecretManagement) Validate() error

type SecretManagementGCPKMS

type SecretManagementGCPKMS struct {
	// Configurable fields when using Google Cloud KMS.
	// The key name used for decrypting the sealed secret.
	KeyName string `json:"keyName"`
	// The path to the service account used to decrypt secret.
	DecryptServiceAccountFile string `json:"decryptServiceAccountFile"`
	// The path to the service account used to encrypt secret.
	EncryptServiceAccountFile string `json:"encryptServiceAccountFile"`
}

func (*SecretManagementGCPKMS) Mask added in v0.33.0

func (s *SecretManagementGCPKMS) Mask()

func (*SecretManagementGCPKMS) Validate

func (s *SecretManagementGCPKMS) Validate() error

type SecretManagementKeyPair

type SecretManagementKeyPair struct {
	// The path to the private RSA key file.
	PrivateKeyFile string `json:"privateKeyFile"`
	// Base64 encoded string of private key.
	PrivateKeyData string `json:"privateKeyData,omitempty"`
	// The path to the public RSA key file.
	PublicKeyFile string `json:"publicKeyFile"`
	// Base64 encoded string of public key.
	PublicKeyData string `json:"publicKeyData,omitempty"`
}

func (*SecretManagementKeyPair) LoadPrivateKey

func (s *SecretManagementKeyPair) LoadPrivateKey() ([]byte, error)

func (*SecretManagementKeyPair) LoadPublicKey

func (s *SecretManagementKeyPair) LoadPublicKey() ([]byte, error)

func (*SecretManagementKeyPair) Mask added in v0.33.0

func (s *SecretManagementKeyPair) Mask()

func (*SecretManagementKeyPair) Validate

func (s *SecretManagementKeyPair) Validate() error

type SharedSSOConfig

type SharedSSOConfig struct {
	model.ProjectSSOConfig `json:",inline"`
	Name                   string `json:"name"`
}

func (*SharedSSOConfig) UnmarshalJSON

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

type TemplatableAnalysisHTTP

type TemplatableAnalysisHTTP struct {
	AnalysisHTTP
	Template AnalysisTemplateRef `json:"template"`
}

TemplatableAnalysisHTTP wraps AnalysisHTTP to allow specify template to use.

type TemplatableAnalysisLog

type TemplatableAnalysisLog struct {
	AnalysisLog
	Template AnalysisTemplateRef `json:"template"`
}

TemplatableAnalysisLog wraps AnalysisLog to allow specify template to use.

type TemplatableAnalysisMetrics

type TemplatableAnalysisMetrics struct {
	AnalysisMetrics
	Template AnalysisTemplateRef `json:"template"`
}

TemplatableAnalysisMetrics wraps AnalysisMetrics to allow specify template to use.

type TerraformApplicationSpec

type TerraformApplicationSpec struct {
	GenericApplicationSpec
	// Input for Terraform deployment such as terraform version, workspace...
	Input TerraformDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync TerraformApplyStageOptions `json:"quickSync"`
}

TerraformApplicationSpec represents an application configuration for Terraform application.

func (*TerraformApplicationSpec) Validate

func (s *TerraformApplicationSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type TerraformApplyStageOptions

type TerraformApplyStageOptions struct {
	// How many times to retry applying terraform changes.
	Retries int `json:"retries"`
}

TerraformApplyStageOptions contains all configurable values for a TERRAFORM_APPLY stage.

type TerraformCommandEnvs

type TerraformCommandEnvs struct {
	Shared []string `json:"shared"`
	Init   []string `json:"init"`
	Plan   []string `json:"plan"`
	Apply  []string `json:"apply"`
}

TerraformCommandEnvs contains all additional environment variables will be used while executing terraform commands.

type TerraformCommandFlags

type TerraformCommandFlags struct {
	Shared []string `json:"shared"`
	Init   []string `json:"init"`
	Plan   []string `json:"plan"`
	Apply  []string `json:"apply"`
}

TerraformCommandFlags contains all additional flags will be used while executing terraform commands.

type TerraformDeploymentInput

type TerraformDeploymentInput struct {
	// The terraform workspace name.
	// Empty means "default" workpsace.
	Workspace string `json:"workspace,omitempty"`
	// The version of terraform should be used.
	// Empty means the pre-installed version will be used.
	TerraformVersion string `json:"terraformVersion,omitempty"`
	// List of variables that will be set directly on terraform commands with "-var" flag.
	// The variable must be formatted by "key=value" as below:
	// "image_id=ami-abc123"
	// 'image_id_list=["ami-abc123","ami-def456"]'
	// 'image_id_map={"us-east-1":"ami-abc123","us-east-2":"ami-def456"}'
	Vars []string `json:"vars,omitempty"`
	// List of variable files that will be set on terraform commands with "-var-file" flag.
	VarFiles []string `json:"varFiles,omitempty"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is false.
	AutoRollback bool `json:"autoRollback"`
	// List of additional flags will be used while executing terraform commands.
	CommandFlags TerraformCommandFlags `json:"commandFlags"`
	// List of additional environment variables will be used while executing terraform commands.
	CommandEnvs TerraformCommandEnvs `json:"commandEnvs"`
}

type TerraformPlanStageOptions

type TerraformPlanStageOptions struct {
	// Exit the pipeline if the result is "No Changes" with success status.
	ExitOnNoChanges bool `json:"exitOnNoChanges"`
}

TerraformPlanStageOptions contains all configurable values for a TERRAFORM_PLAN stage.

type TerraformSyncStageOptions

type TerraformSyncStageOptions struct {
	// How many times to retry applying terraform changes.
	Retries int `json:"retries"`
}

TerraformSyncStageOptions contains all configurable values for a TERRAFORM_SYNC stage.

type Trigger

type Trigger struct {
	// Configurable fields used while deciding the application
	// should be triggered or not based on commit changes.
	OnCommit OnCommit `json:"onCommit"`
	// Configurable fields used while deciding the application
	// should be triggered or not based on received SYNC command.
	OnCommand OnCommand `json:"onCommand"`
	// Configurable fields used while deciding the application
	// should be triggered or not based on OUT_OF_SYNC state.
	OnOutOfSync OnOutOfSync `json:"onOutOfSync"`
	// Configurable fields used while deciding the application
	// should be triggered based on received CHAIN_SYNC command.
	OnChain OnChain `json:"onChain"`
}

type WaitApprovalStageOptions

type WaitApprovalStageOptions struct {
	// The maximum length of time to wait before giving up.
	// Defaults to 6h.
	Timeout        Duration `json:"timeout" default:"6h"`
	Approvers      []string `json:"approvers"`
	MinApproverNum int      `json:"minApproverNum" default:"1"`
}

WaitStageOptions contains all configurable values for a WAIT_APPROVAL stage.

func (*WaitApprovalStageOptions) Validate

func (w *WaitApprovalStageOptions) Validate() error

type WaitStageOptions

type WaitStageOptions struct {
	Duration Duration `json:"duration"`
}

WaitStageOptions contains all configurable values for a WAIT stage.

Jump to

Keyboard shortcuts

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