Documentation ¶
Overview ¶
Package manifest provides functionality to create Manifest files.
Package manifest provides functionality to create Manifest files.
Package manifest provides functionality to create Manifest files.
Index ¶
- Constants
- Variables
- func JobDockerfileBuildRequired(job interface{}) (bool, error)
- func ServiceDockerfileBuildRequired(svc interface{}) (bool, error)
- func UnmarshalWorkload(in []byte) (interface{}, error)
- type Autoscaling
- type BackendService
- type BackendServiceConfig
- type BackendServiceProps
- type BuildArgsOrString
- type ContainerHealthCheck
- type Count
- type DockerBuildArgs
- type ErrInvalidPipelineManifestVersion
- type ErrInvalidWorkloadType
- type ErrUnknownProvider
- type GitHubProperties
- type HTTPHealthCheckArgs
- type HealthCheckArgsOrString
- type Image
- type JobFailureHandlerConfig
- type JobTriggerConfig
- type LoadBalancedWebService
- type LoadBalancedWebServiceConfig
- type LoadBalancedWebServiceProps
- type Logging
- type PipelineManifest
- type PipelineSchemaMajorVersion
- type PipelineStage
- type Provider
- type Range
- type RoutingRule
- type ScheduledJob
- type ScheduledJobConfig
- type ScheduledJobProps
- type ServiceImageWithPort
- type Sidecar
- type SidecarConfig
- type Source
- type TaskConfig
- type Workload
- type WorkloadProps
Constants ¶
const ( GithubProviderName = "GitHub" GithubSecretIdKeyName = "access_token_secret" )
const ( // LoadBalancedWebServiceType is a web service with a load balancer and Fargate as compute. LoadBalancedWebServiceType = "Load Balanced Web Service" // BackendServiceType is a service that cannot be accessed from the internet but can be reached from other services. BackendServiceType = "Backend Service" )
const (
// LogRetentionInDays is the default log retention time in days.
LogRetentionInDays = 30
)
Default values for HTTPHealthCheck for a load balanced web service.
const (
// ScheduledJobType is a recurring ECS Fargate task which runs on a schedule.
ScheduledJobType = "Scheduled Job"
)
Variables ¶
var JobTypes = []string{ ScheduledJobType, }
JobTypes holds the valid job "architectures"
var ServiceTypes = []string{ LoadBalancedWebServiceType, BackendServiceType, }
ServiceTypes are the supported service manifest types.
var WorkloadTypes = append(ServiceTypes, JobTypes...)
WorkloadTypes holds all workload manifest types.
Functions ¶
func JobDockerfileBuildRequired ¶ added in v0.5.0
JobDockerfileBuildRequired returns if the job container image should be built from local Dockerfile.
func ServiceDockerfileBuildRequired ¶ added in v0.5.0
ServiceDockerfileBuildRequired returns if the service container image should be built from local Dockerfile.
func UnmarshalWorkload ¶ added in v0.4.0
UnmarshalWorkload deserializes the YAML input stream into a workload manifest object. If an error occurs during deserialization, then returns the error. If the workload type in the manifest is invalid, then returns an ErrInvalidManifestType.
Types ¶
type Autoscaling ¶ added in v0.4.0
type Autoscaling struct { Range *Range `yaml:"range"` CPU *int `yaml:"cpu_percentage"` Memory *int `yaml:"memory_percentage"` Requests *int `yaml:"requests"` ResponseTime *time.Duration `yaml:"response_time"` }
Autoscaling represents the configurable options for Auto Scaling.
func (*Autoscaling) IsEmpty ¶ added in v0.4.0
func (a *Autoscaling) IsEmpty() bool
IsEmpty returns whether Autoscaling is empty.
func (*Autoscaling) Options ¶ added in v0.4.0
func (a *Autoscaling) Options() (*template.AutoscalingOpts, error)
Options converts the service's Auto Scaling configuration into a format parsable by the templates pkg.
type BackendService ¶
type BackendService struct { Workload `yaml:",inline"` BackendServiceConfig `yaml:",inline"` // Use *BackendServiceConfig because of https://github.com/imdario/mergo/issues/146 Environments map[string]*BackendServiceConfig `yaml:",flow"` // contains filtered or unexported fields }
BackendService holds the configuration to create a backend service manifest.
func NewBackendService ¶
func NewBackendService(props BackendServiceProps) *BackendService
NewBackendService applies the props to a default backend service configuration with minimal task sizes, single replica, no healthcheck, and then returns it.
func (BackendService) ApplyEnv ¶
func (s BackendService) ApplyEnv(envName string) (*BackendService, error)
ApplyEnv returns the service manifest with environment overrides. If the environment passed in does not have any overrides then it returns itself.
func (*BackendService) BuildArgs ¶ added in v0.3.0
func (s *BackendService) BuildArgs(wsRoot string) *DockerBuildArgs
BuildArgs returns a docker.BuildArguments object for the service given a workspace root directory
func (*BackendService) BuildRequired ¶ added in v0.5.0
func (s *BackendService) BuildRequired() (bool, error)
BuildRequired returns if the service requires building from the local Dockerfile.
func (*BackendService) MarshalBinary ¶
func (s *BackendService) MarshalBinary() ([]byte, error)
MarshalBinary serializes the manifest object into a binary YAML document. Implements the encoding.BinaryMarshaler interface.
type BackendServiceConfig ¶
type BackendServiceConfig struct { ImageConfig imageWithPortAndHealthcheck `yaml:"image,flow"` TaskConfig `yaml:",inline"` *Logging `yaml:"logging,flow"` Sidecar `yaml:",inline"` }
BackendServiceConfig holds the configuration that can be overriden per environments.
func (*BackendServiceConfig) LogConfigOpts ¶
func (bc *BackendServiceConfig) LogConfigOpts() *template.LogConfigOpts
LogConfigOpts converts the service's Firelens configuration into a format parsable by the templates pkg.
type BackendServiceProps ¶
type BackendServiceProps struct { WorkloadProps Port uint16 HealthCheck *ContainerHealthCheck // Optional healthcheck configuration. }
BackendServiceProps represents the configuration needed to create a backend service.
type BuildArgsOrString ¶ added in v0.3.0
type BuildArgsOrString struct { BuildString *string BuildArgs DockerBuildArgs }
BuildArgsOrString is a custom type which supports unmarshaling yaml which can either be of type string or type DockerBuildArgs.
func (*BuildArgsOrString) UnmarshalYAML ¶ added in v0.3.0
func (b *BuildArgsOrString) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML overrides the default YAML unmarshaling logic for the BuildArgsOrString struct, allowing it to perform more complex unmarshaling behavior. This method implements the yaml.Unmarshaler (v2) interface.
type ContainerHealthCheck ¶
type ContainerHealthCheck struct { Command []string `yaml:"command"` Interval *time.Duration `yaml:"interval"` Retries *int `yaml:"retries"` Timeout *time.Duration `yaml:"timeout"` StartPeriod *time.Duration `yaml:"start_period"` }
ContainerHealthCheck holds the configuration to determine if the service container is healthy. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html
type Count ¶ added in v0.4.0
type Count struct { Value *int // 0 is a valid value, so we want the default value to be nil. Autoscaling Autoscaling // Mutually exclusive with Value. }
Count is a custom type which supports unmarshaling yaml which can either be of type int or type Autoscaling.
func (*Count) UnmarshalYAML ¶ added in v0.4.0
UnmarshalYAML overrides the default YAML unmarshaling logic for the Count struct, allowing it to perform more complex unmarshaling behavior. This method implements the yaml.Unmarshaler (v2) interface.
type DockerBuildArgs ¶ added in v0.3.0
type DockerBuildArgs struct { Context *string `yaml:"context,omitempty"` Dockerfile *string `yaml:"dockerfile,omitempty"` Args map[string]string `yaml:"args,omitempty"` Target *string `yaml:"target,omitempty"` CacheFrom []string `yaml:"cache_from,omitempty"` }
DockerBuildArgs represents the options specifiable under the "build" field of Docker Compose services. For more information, see: https://docs.docker.com/compose/compose-file/#build
type ErrInvalidPipelineManifestVersion ¶
type ErrInvalidPipelineManifestVersion struct {
// contains filtered or unexported fields
}
ErrInvalidPipelineManifestVersion occurs when the pipeline.yml file contains invalid schema version during unmarshalling.
func (*ErrInvalidPipelineManifestVersion) Error ¶
func (e *ErrInvalidPipelineManifestVersion) Error() string
func (*ErrInvalidPipelineManifestVersion) Is ¶
func (e *ErrInvalidPipelineManifestVersion) Is(target error) bool
Is compares the 2 errors. Only returns true if the errors are of the same type and contain the same information.
type ErrInvalidWorkloadType ¶ added in v0.4.0
type ErrInvalidWorkloadType struct {
Type string
}
ErrInvalidWorkloadType occurs when a user requested a manifest template type that doesn't exist.
func (*ErrInvalidWorkloadType) Error ¶ added in v0.4.0
func (e *ErrInvalidWorkloadType) Error() string
type ErrUnknownProvider ¶
type ErrUnknownProvider struct {
// contains filtered or unexported fields
}
ErrUnknownProvider occurs CreateProvider() is called with configurations that do not map to any supported provider.
func (*ErrUnknownProvider) Error ¶
func (e *ErrUnknownProvider) Error() string
func (*ErrUnknownProvider) Is ¶
func (e *ErrUnknownProvider) Is(target error) bool
Is compares the 2 errors. Returns true if the errors are of the same type
type GitHubProperties ¶
type GitHubProperties struct { // An example for OwnerAndRepository would be: "aws/copilot" OwnerAndRepository string `structs:"repository" yaml:"repository"` Branch string `structs:"branch" yaml:"branch"` GithubSecretIdKeyName string `structs:"access_token_secret" yaml:"access_token_secret"` }
GitHubProperties contain information for configuring a Github source provider.
type HTTPHealthCheckArgs ¶ added in v0.6.0
type HTTPHealthCheckArgs struct { Path *string `yaml:"path"` HealthyThreshold *int64 `yaml:"healthy_threshold"` UnhealthyThreshold *int64 `yaml:"unhealthy_threshold"` Timeout *time.Duration `yaml:"timeout"` Interval *time.Duration `yaml:"interval"` }
HTTPHealthCheckArgs holds the configuration to determine if the load balanced web service is healthy. These options are specifiable under the "healthcheck" field. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html.
type HealthCheckArgsOrString ¶ added in v0.6.0
type HealthCheckArgsOrString struct { HealthCheckPath *string HealthCheckArgs HTTPHealthCheckArgs }
HealthCheckArgsOrString is a custom type which supports unmarshaling yaml which can either be of type string or type HealthCheckArgs.
func (HealthCheckArgsOrString) HTTPHealthCheckOpts ¶ added in v0.7.0
func (hc HealthCheckArgsOrString) HTTPHealthCheckOpts() template.HTTPHealthCheckOpts
HTTPHealthCheckOpts converts the ALB health check configuration into a format parsable by the templates pkg.
func (*HealthCheckArgsOrString) UnmarshalYAML ¶ added in v0.6.0
func (hc *HealthCheckArgsOrString) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML overrides the default YAML unmarshaling logic for the HealthCheckArgsOrString struct, allowing it to perform more complex unmarshaling behavior. This method implements the yaml.Unmarshaler (v2) interface.
type Image ¶ added in v0.4.0
type Image struct { Build BuildArgsOrString `yaml:"build"` // Build an image from a Dockerfile. Location *string `yaml:"location"` // Use an existing image instead. }
Image represents the workload's container image.
func (*Image) BuildConfig ¶ added in v0.4.0
func (i *Image) BuildConfig(rootDirectory string) *DockerBuildArgs
BuildConfig populates a docker.BuildArguments struct from the fields available in the manifest. Prefer the following hierarchy: 1. Specific dockerfile, specific context 2. Specific dockerfile, context = dockerfile dir 3. "Dockerfile" located in context dir 4. "Dockerfile" located in ws root.
func (Image) GetLocation ¶ added in v0.5.0
GetLocation returns the location of the image.
type JobFailureHandlerConfig ¶ added in v0.5.0
type JobFailureHandlerConfig struct { Timeout string `yaml:"timeout"` Retries int `yaml:"retries"` }
JobFailureHandlerConfig represents the error handling configuration for the job.
type JobTriggerConfig ¶ added in v0.5.0
type JobTriggerConfig struct {
Schedule string `yaml:"schedule"`
}
JobTriggerConfig represents the configuration for the event that triggers the job.
type LoadBalancedWebService ¶
type LoadBalancedWebService struct { Workload `yaml:",inline"` LoadBalancedWebServiceConfig `yaml:",inline"` // Use *LoadBalancedWebServiceConfig because of https://github.com/imdario/mergo/issues/146 Environments map[string]*LoadBalancedWebServiceConfig `yaml:",flow"` // Fields to override per environment. // contains filtered or unexported fields }
LoadBalancedWebService holds the configuration to build a container image with an exposed port that receives requests through a load balancer with AWS Fargate as the compute engine.
func NewLoadBalancedWebService ¶
func NewLoadBalancedWebService(props *LoadBalancedWebServiceProps) *LoadBalancedWebService
NewLoadBalancedWebService creates a new public load balanced web service, receives all the requests from the load balancer, has a single task with minimal CPU and memory thresholds, and sets the default health check path to "/".
func (LoadBalancedWebService) ApplyEnv ¶
func (s LoadBalancedWebService) ApplyEnv(envName string) (*LoadBalancedWebService, error)
ApplyEnv returns the service manifest with environment overrides. If the environment passed in does not have any overrides then it returns itself.
func (*LoadBalancedWebService) BuildArgs ¶ added in v0.3.0
func (s *LoadBalancedWebService) BuildArgs(wsRoot string) *DockerBuildArgs
BuildArgs returns a docker.BuildArguments object given a ws root directory.
func (*LoadBalancedWebService) BuildRequired ¶ added in v0.5.0
func (s *LoadBalancedWebService) BuildRequired() (bool, error)
BuildRequired returns if the service requires building from the local Dockerfile.
func (*LoadBalancedWebService) MarshalBinary ¶
func (s *LoadBalancedWebService) MarshalBinary() ([]byte, error)
MarshalBinary serializes the manifest object into a binary YAML document. Implements the encoding.BinaryMarshaler interface.
type LoadBalancedWebServiceConfig ¶
type LoadBalancedWebServiceConfig struct { ImageConfig ServiceImageWithPort `yaml:"image,flow"` RoutingRule `yaml:"http,flow"` TaskConfig `yaml:",inline"` *Logging `yaml:"logging,flow"` Sidecar `yaml:",inline"` }
LoadBalancedWebServiceConfig holds the configuration for a load balanced web service.
func (*LoadBalancedWebServiceConfig) LogConfigOpts ¶
func (lc *LoadBalancedWebServiceConfig) LogConfigOpts() *template.LogConfigOpts
LogConfigOpts converts the service's Firelens configuration into a format parsable by the templates pkg.
type LoadBalancedWebServiceProps ¶
type LoadBalancedWebServiceProps struct { *WorkloadProps Path string Port uint16 }
LoadBalancedWebServiceProps contains properties for creating a new load balanced fargate service manifest.
type Logging ¶ added in v0.4.0
type Logging struct { Image *string `yaml:"image"` Destination map[string]string `yaml:"destination,flow"` EnableMetadata *bool `yaml:"enableMetadata"` SecretOptions map[string]string `yaml:"secretOptions"` ConfigFile *string `yaml:"configFilePath"` }
Logging holds configuration for Firelens to route your logs.
type PipelineManifest ¶
type PipelineManifest struct { // Name of the pipeline Name string `yaml:"name"` Version PipelineSchemaMajorVersion `yaml:"version"` Source *Source `yaml:"source"` Stages []PipelineStage `yaml:"stages"` // contains filtered or unexported fields }
PipelineManifest contains information that defines the relationship and deployment ordering of your environments.
func NewPipelineManifest ¶ added in v0.4.0
func NewPipelineManifest(pipelineName string, provider Provider, stages []PipelineStage) (*PipelineManifest, error)
NewPipelineManifest returns a pipeline manifest object.
func UnmarshalPipeline ¶
func UnmarshalPipeline(in []byte) (*PipelineManifest, error)
UnmarshalPipeline deserializes the YAML input stream into a pipeline manifest object. It returns an error if any issue occurs during deserialization or the YAML input contains invalid fields.
func (*PipelineManifest) MarshalBinary ¶
func (m *PipelineManifest) MarshalBinary() ([]byte, error)
MarshalBinary serializes the pipeline manifest object into byte array that represents the pipeline.yml document.
type PipelineSchemaMajorVersion ¶
type PipelineSchemaMajorVersion int
PipelineSchemaMajorVersion is the major version number of the pipeline manifest schema
const ( // Ver1 is the current schema major version of the pipeline.yml file. Ver1 PipelineSchemaMajorVersion = iota + 1 )
type PipelineStage ¶
type PipelineStage struct { Name string `yaml:"name"` RequiresApproval bool `yaml:"requires_approval,omitempty"` TestCommands []string `yaml:"test_commands,omitempty"` }
PipelineStage represents a stage in the pipeline manifest
type Provider ¶
Provider defines a source of the artifacts that will be built and deployed via a pipeline
func NewProvider ¶
NewProvider creates a source provider based on the type of the provided provider-specific configurations
type Range ¶ added in v0.4.0
type Range string
Range is a number range with maximum and minimum values.
type RoutingRule ¶
type RoutingRule struct { Path *string `yaml:"path"` HealthCheck HealthCheckArgsOrString `yaml:"healthcheck"` Stickiness *bool `yaml:"stickiness"` // TargetContainer is the container load balancer routes traffic to. TargetContainer *string `yaml:"target_container"` TargetContainerCamelCase *string `yaml:"targetContainer"` // "targetContainerCamelCase" for backwards compatibility AllowedSourceIps []string `yaml:"allowed_source_ips"` }
RoutingRule holds the path to route requests to the service.
type ScheduledJob ¶ added in v0.4.0
type ScheduledJob struct { Workload `yaml:",inline"` ScheduledJobConfig `yaml:",inline"` Environments map[string]*ScheduledJobConfig `yaml:",flow"` // contains filtered or unexported fields }
ScheduledJob holds the configuration to build a container image that is run periodically in a given environment with timeout and retry logic.
func NewScheduledJob ¶ added in v0.4.0
func NewScheduledJob(props *ScheduledJobProps) *ScheduledJob
NewScheduledJob creates a new
func (ScheduledJob) ApplyEnv ¶ added in v0.5.0
func (j ScheduledJob) ApplyEnv(envName string) (*ScheduledJob, error)
ApplyEnv returns the manifest with environment overrides.
func (*ScheduledJob) BuildArgs ¶ added in v0.5.0
func (j *ScheduledJob) BuildArgs(wsRoot string) *DockerBuildArgs
BuildArgs returns a docker.BuildArguments object for the job given a workspace root.
func (*ScheduledJob) BuildRequired ¶ added in v0.5.0
func (j *ScheduledJob) BuildRequired() (bool, error)
BuildRequired returns if the service requires building from the local Dockerfile.
func (*ScheduledJob) MarshalBinary ¶ added in v0.4.0
func (j *ScheduledJob) MarshalBinary() ([]byte, error)
MarshalBinary serializes the manifest object into a binary YAML document. Implements the encoding.BinaryMarshaler interface.
type ScheduledJobConfig ¶ added in v0.4.0
type ScheduledJobConfig struct { ImageConfig Image `yaml:"image,flow"` TaskConfig `yaml:",inline"` *Logging `yaml:"logging,flow"` Sidecar `yaml:",inline"` On JobTriggerConfig `yaml:"on,flow"` JobFailureHandlerConfig `yaml:",inline"` }
ScheduledJobConfig holds the configuration for a scheduled job
func (*ScheduledJobConfig) LogConfigOpts ¶ added in v0.4.0
func (lc *ScheduledJobConfig) LogConfigOpts() *template.LogConfigOpts
LogConfigOpts converts the job's Firelens configuration into a format parsable by the templates pkg.
type ScheduledJobProps ¶ added in v0.4.0
type ScheduledJobProps struct { *WorkloadProps Schedule string Timeout string Retries int }
ScheduledJobProps contains properties for creating a new scheduled job manifest.
type ServiceImageWithPort ¶
ServiceImageWithPort represents a container image with an exposed port.
type Sidecar ¶
type Sidecar struct {
Sidecars map[string]*SidecarConfig `yaml:"sidecars"`
}
Sidecar holds configuration for all sidecar containers in a workload.
type SidecarConfig ¶
type SidecarConfig struct { Port *string `yaml:"port"` Image *string `yaml:"image"` CredsParam *string `yaml:"credentialsParameter"` }
SidecarConfig represents the configurable options for setting up a sidecar container.
type Source ¶
type Source struct { ProviderName string `yaml:"provider"` Properties map[string]interface{} `yaml:"properties"` }
Source defines the source of the artifacts to be built and deployed.
type TaskConfig ¶
type TaskConfig struct { CPU *int `yaml:"cpu"` Memory *int `yaml:"memory"` Count Count `yaml:"count"` Variables map[string]string `yaml:"variables"` Secrets map[string]string `yaml:"secrets"` }
TaskConfig represents the resource boundaries and environment variables for the containers in the task.
type Workload ¶ added in v0.4.0
type Workload struct { Name *string `yaml:"name"` Type *string `yaml:"type"` // must be one of the supported manifest types. }
Workload holds the basic data that every workload manifest file needs to have.
type WorkloadProps ¶ added in v0.4.0
WorkloadProps contains properties for creating a new workload manifest.