deploy

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package deploy holds the structures to deploy infrastructure resources. This file defines application deployment resources.

Package deploy holds the structures to deploy infrastructure resources.

Package deploy holds the structures to deploy infrastructure resources. This file defines environment deployment resources.

Package deploy holds the structures to deploy infrastructure resources. This file defines pipeline deployment resources.

Package deploy holds the structures to deploy infrastructure resources. This file defines workload deployment resources.

Package deploy holds the structures to deploy infrastructure resources. This file defines service deployment resources.

Package deploy holds the structures to deploy infrastructure resources. This file defines workload deployment resources.

Index

Constants

View Source
const (
	// LegacyAppTemplateVersion is the version associated with the application template before we started versioning.
	LegacyAppTemplateVersion = "v0.0.0"
	// LatestAppTemplateVersion is the latest version number available for application templates.
	LatestAppTemplateVersion = "v1.0.2"
	// AliasLeastAppTemplateVersion is the least version number available for HTTPS alias.
	AliasLeastAppTemplateVersion = "v1.0.0"
)
View Source
const (
	// AppTagKey is tag key for Copilot app.
	AppTagKey = "copilot-application"
	// EnvTagKey is tag key for Copilot env.
	EnvTagKey = "copilot-environment"
	// ServiceTagKey is tag key for Copilot service.
	ServiceTagKey = "copilot-service"
	// PipelineTagKey is tag key for Copilot pipeline.
	PipelineTagKey = "copilot-pipeline"
	// TaskTagKey is tag key for Copilot task.
	TaskTagKey = "copilot-task"
)
View Source
const (
	// LegacyEnvTemplateVersion is the version associated with the environment template before we started versioning.
	LegacyEnvTemplateVersion = "v0.0.0"
	// LatestEnvTemplateVersion is the latest version number available for environment templates.
	LatestEnvTemplateVersion = "v1.8.0"
)
View Source
const (
	// WorkloadCfnTemplateNameFormat is the base output file name when `service package`
	// or `job package` is called. This is also used to render the pipeline CFN template.
	WorkloadCfnTemplateNameFormat = "%s-%s.stack.yml"
	// WorkloadCfnTemplateConfigurationNameFormat is the base output configuration
	// file name when `service package` or `job package is called. It's also used to
	// render the pipeline CFN template.
	WorkloadCfnTemplateConfigurationNameFormat = "%s-%s.params.json"
	// AddonsCfnTemplateNameFormat is the addons output file name when `service package`
	// is called.
	AddonsCfnTemplateNameFormat = "%s.addons.stack.yml"
)
View Source
const DefaultPipelineBranch = "main"

DefaultPipelineBranch is the default repository branch to use for pipeline.

View Source
const FmtTaskECRRepoName = "copilot-%s"

FmtTaskECRRepoName is the pattern used to generate the ECR repository's name

Variables

This section is empty.

Functions

func DNSDelegationRoleName added in v1.9.0

func DNSDelegationRoleName(appName string) string

DNSDelegationRoleName returns the DNSDelegation role name of the app.

func PipelineSourceFromManifest added in v1.4.0

func PipelineSourceFromManifest(mfSource *manifest.Source) (source interface{}, shouldPrompt bool, err error)

PipelineSourceFromManifest processes manifest info about the source based on provider type. The return boolean is true for CodeStar Connections sources that require a polling prompt.

Types

type AppInformation added in v1.9.0

type AppInformation struct {
	AccountPrincipalARN string
	DNSName             string
	Name                string
}

AppInformation holds information about the application that need to be propagated to the env stacks and workload stacks.

func (*AppInformation) DNSDelegationRole added in v1.9.0

func (a *AppInformation) DNSDelegationRole() string

DNSDelegationRole returns the ARN of the app's DNS delegation role.

type ArtifactBucket

type ArtifactBucket struct {
	// The name of the S3 bucket.
	BucketName string

	// The ARN of the KMS key used to en/decrypt artifacts stored in this bucket.
	KeyArn string
}

ArtifactBucket represents an S3 bucket used by the CodePipeline to store intermediate artifacts produced by the pipeline.

func (*ArtifactBucket) Region

func (a *ArtifactBucket) Region() (string, error)

Region parses out the region from the ARN of the KMS key associated with the artifact bucket.

type AssociatedEnvironment

type AssociatedEnvironment struct {
	// Name of the environment, must be unique within an application.
	// This is also the name of the pipeline stage.
	Name string

	// The region this environment is stored in.
	Region string

	// AccountID of the account this environment is stored in.
	AccountID string
}

AssociatedEnvironment defines the necessary information a pipeline stage needs for an Config Environment.

type BitbucketSource added in v1.3.0

type BitbucketSource struct {
	ProviderName         string
	Branch               string
	RepositoryURL        string
	ConnectionARN        string
	OutputArtifactFormat string
}

BitbucketSource defines the (BB) source of the artifacts to be built and deployed.

func (*BitbucketSource) Connection added in v1.5.0

func (s *BitbucketSource) Connection() string

Connection returns the ARN correlated with a ConnectionName in the pipeline manifest.

func (*BitbucketSource) ConnectionName added in v1.3.0

func (s *BitbucketSource) ConnectionName() (string, error)

ConnectionName generates a recognizable string by which the connection may be identified.

func (*BitbucketSource) Repository added in v1.3.0

func (s *BitbucketSource) Repository() (string, error)

Repository returns the repository portion. For CodeStar Connections, this needs to be in the format "some-user/my-repo."

type Build added in v1.6.0

type Build struct {
	// The URI that identifies the Docker image to use for this build project.
	Image           string
	EnvironmentType string
	BuildspecPath   string
}

Build represents CodeBuild project used in the CodePipeline to build and test Docker image.

func PipelineBuildFromManifest added in v1.6.0

func PipelineBuildFromManifest(mfBuild *manifest.Build, mfDirPath string) (build *Build)

PipelineBuildFromManifest processes manifest info about the build project settings.

type CodeCommitSource added in v1.1.0

type CodeCommitSource struct {
	ProviderName         string
	Branch               string
	RepositoryURL        string
	OutputArtifactFormat string
}

CodeCommitSource defines the (CC) source of the artifacts to be built and deployed.

func (*CodeCommitSource) Repository added in v1.1.0

func (s *CodeCommitSource) Repository() (string, error)

Repository returns the repository portion. For example, given "aws/amazon-copilot", this function returns "amazon-copilot".

type ConfigStoreClient

type ConfigStoreClient interface {
	GetEnvironment(appName string, environmentName string) (*config.Environment, error)
	ListEnvironments(appName string) ([]*config.Environment, error)
	ListWorkloads(appName string) ([]*config.Workload, error)
	GetService(appName, svcName string) (*config.Workload, error)
	GetJob(appName, jobname string) (*config.Workload, error)
}

ConfigStoreClient wraps config store methods utilized by deploy store.

type CreateAppInput

type CreateAppInput struct {
	Name                  string            // Name of the application that needs to be created.
	AccountID             string            // AWS account ID to administrate the application.
	DNSDelegationAccounts []string          // Accounts to grant DNS access to for this application.
	DomainName            string            // DNS Name used for this application.
	DomainHostedZoneID    string            // Hosted Zone ID for the domain.
	AdditionalTags        map[string]string // AdditionalTags are labels applied to resources under the application.
	Version               string            // The version of the application template to create the stack/stackset. If empty, creates the legacy stack/stackset.
}

CreateAppInput holds the fields required to create an application stack set.

type CreateEnvironmentInput

type CreateEnvironmentInput struct {
	// The version of the environment template to create the stack. If empty, creates the legacy stack.
	Version string

	App                  AppInformation    // Information about the application that the environment belongs to, include app name, DNS name, the principal ARN of the account.
	Name                 string            // Name of the environment, must be unique within an application.
	Prod                 bool              // Whether or not this environment is a production environment.
	AdditionalTags       map[string]string // AdditionalTags are labels applied to resources under the application.
	ArtifactBucketARN    string            // ARN of the regional application bucket.
	ArtifactBucketKeyARN string            // ARN of the KMS key used to encrypt the contents in the regional application bucket.
	CustomResourcesURLs  map[string]string // Environment custom resource script S3 object URLs.
	ImportVPCConfig      *config.ImportVPC // Optional configuration if users have an existing VPC.
	AdjustVPCConfig      *config.AdjustVPC // Optional configuration if users want to override default VPC configuration.
	Telemetry            *config.Telemetry // Optional observability and monitoring configuration.

	CFNServiceRoleARN string // Optional. A service role ARN that CloudFormation should use to make calls to resources in the stack.
}

CreateEnvironmentInput holds the fields required to deploy an environment.

type CreateEnvironmentResponse

type CreateEnvironmentResponse struct {
	Env *config.Environment
	Err error
}

CreateEnvironmentResponse holds the created environment on successful deployment. Otherwise, the environment is set to nil and a descriptive error is returned.

type CreatePipelineInput

type CreatePipelineInput struct {
	// Name of the application this pipeline belongs to
	AppName string

	// Name of the pipeline
	Name string

	// IsLegacy should be set to true if the pipeline has been deployed using a legacy non-namespaced name; otherwise it is false.
	IsLegacy bool

	// The source code provider for this pipeline
	Source interface{}

	// The build project settings for this pipeline
	Build *Build

	// The stages of the pipeline. The order of stages in this list
	// will be the order we deploy to.
	Stages []PipelineStage

	// A list of artifact buckets and corresponding KMS keys that will
	// be used in this pipeline.
	ArtifactBuckets []ArtifactBucket

	// AdditionalTags are labels applied to resources under the application.
	AdditionalTags map[string]string
}

CreatePipelineInput represents the fields required to deploy a pipeline.

type CreateTaskResourcesInput

type CreateTaskResourcesInput struct {
	Name   string
	CPU    int
	Memory int

	Image                 string
	TaskRole              string
	ExecutionRole         string
	Command               []string
	EntryPoint            []string
	EnvVars               map[string]string
	SSMParamSecrets       map[string]string
	SecretsManagerSecrets map[string]string

	OS   string
	Arch string

	App string
	Env string

	AdditionalTags map[string]string
}

CreateTaskResourcesInput holds the fields required to create a task stack.

type DeleteWorkloadInput added in v0.5.0

type DeleteWorkloadInput struct {
	Name    string // Name of the workload that needs to be deleted.
	EnvName string // Name of the environment the service is deployed in.
	AppName string // Name of the application the service belongs to.
}

DeleteWorkloadInput holds the fields required to delete a workload.

type GitHubSource added in v1.1.0

type GitHubSource struct {
	ProviderName         string
	Branch               string
	RepositoryURL        GitHubURL
	ConnectionARN        string
	OutputArtifactFormat string
}

GitHubSource (version 2) defines the source of the artifacts to be built and deployed. This version uses CodeStar Connections to authenticate access to the remote repo.

func (*GitHubSource) Connection added in v1.5.0

func (s *GitHubSource) Connection() string

Connection returns the ARN correlated with a ConnectionName in the pipeline manifest.

func (*GitHubSource) ConnectionName added in v1.4.0

func (s *GitHubSource) ConnectionName() (string, error)

ConnectionName generates a recognizable string by which the connection may be identified.

func (*GitHubSource) Owner added in v1.1.0

func (s *GitHubSource) Owner() (string, error)

Owner returns the repository owner portion. For example, given "aws/amazon-copilot", this function returns "aws".

func (*GitHubSource) Repository added in v1.1.0

func (s *GitHubSource) Repository() (string, error)

Repository returns the repository portion. For CodeStar Connections, this needs to be in the format "some-user/my-repo."

type GitHubURL added in v1.4.0

type GitHubURL string

GitHubURL is the common type for repo URLs for both GitHubSource versions: GitHubV1 (w/ access tokens) and GitHub (V2 w CodeStar Connections).

type GitHubV1Source added in v1.4.0

type GitHubV1Source struct {
	ProviderName                string
	Branch                      string
	RepositoryURL               GitHubURL
	PersonalAccessTokenSecretID string
}

GitHubV1Source defines the source of the artifacts to be built and deployed. This version uses personal access tokens and is not recommended. https://docs.aws.amazon.com/codepipeline/latest/userguide/update-github-action-connections.html

func (*GitHubV1Source) GitHubPersonalAccessTokenSecretID added in v1.4.0

func (s *GitHubV1Source) GitHubPersonalAccessTokenSecretID() (string, error)

GitHubPersonalAccessTokenSecretID returns the ID of the secret in the Secrets manager, which stores the GitHub Personal Access token if the provider is "GitHubV1".

func (*GitHubV1Source) Owner added in v1.4.0

func (s *GitHubV1Source) Owner() (string, error)

Owner returns the repository owner portion. For example, given "aws/amazon-copilot", this function returns "aws".

func (*GitHubV1Source) Repository added in v1.4.0

func (s *GitHubV1Source) Repository() (string, error)

Repository returns the repository portion. For example, given "aws/amazon-copilot", this function returns "amazon-copilot".

type Pipeline added in v1.16.0

type Pipeline struct {
	// The name of the application that the pipeline is associated with.
	AppName string
	// The pipeline resource name (physical resource ID) generated by CloudFormation.
	ResourceName string
	// The name given by user in the pipeline manifest.
	Name string
	// Whether the pipeline follows legacy-naming, i.e. not namespaced with "pipeline-app-".
	IsLegacy bool
}

Pipeline is a deployed pipeline.

type PipelineStage

type PipelineStage struct {
	*AssociatedEnvironment
	LocalWorkloads   []string
	RequiresApproval bool
	TestCommands     []string
}

PipelineStage represents configuration for each deployment stage of a workspace. A stage consists of the Config Environment the pipeline is deploying to, the containerized services that will be deployed, and test commands, if the user has opted to add any.

func (*PipelineStage) WorkloadTemplateConfigurationPath added in v0.5.0

func (s *PipelineStage) WorkloadTemplateConfigurationPath(wlName string) string

WorkloadTemplateConfigurationPath returns the full path to the workload CFN template configuration file built during the build stage.

func (*PipelineStage) WorkloadTemplatePath added in v0.5.0

func (s *PipelineStage) WorkloadTemplatePath(wlName string) string

WorkloadTemplatePath returns the full path to the workload CFN template built during the build stage.

type PipelineStore added in v1.16.0

type PipelineStore struct {
	// contains filtered or unexported fields
}

PipelineStore fetches information on deployed pipelines.

func NewPipelineStore added in v1.16.0

func NewPipelineStore(getter ResourceGetter) *PipelineStore

NewPipelineStore returns a new PipelineStore.

func (*PipelineStore) ListDeployedPipelines added in v1.16.0

func (p *PipelineStore) ListDeployedPipelines(appName string) ([]Pipeline, error)

ListDeployedPipelines returns a list of names of deployed pipelines by looking up pipeline resources with tags.

type ResourceGetter added in v1.16.0

type ResourceGetter interface {
	GetResourcesByTags(resourceType string, tags map[string]string) ([]*rg.Resource, error)
}

ResourceGetter retrieves a group of resources that satisfy certain conditions, such as tags.

type SessionProvider added in v1.16.0

type SessionProvider interface {
	FromRole(roleARN, region string) (*session.Session, error)
}

SessionProvider is the interface to provide configuration for the AWS SDK's service clients.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store fetches information on deployed services.

func NewStore

func NewStore(sessProvider SessionProvider, store ConfigStoreClient) (*Store, error)

NewStore returns a new store.

func (*Store) IsJobDeployed added in v1.7.0

func (s *Store) IsJobDeployed(appName, envName, jobName string) (bool, error)

IsJobDeployed returnds whether a job is deployed in an environment or not by checking for a state machine.

func (*Store) IsServiceDeployed

func (s *Store) IsServiceDeployed(appName string, envName string, svcName string) (bool, error)

IsServiceDeployed returns whether a service is deployed in an environment or not.

func (*Store) ListDeployedJobs added in v1.7.0

func (s *Store) ListDeployedJobs(appName string, envName string) ([]string, error)

ListDeployedJobs returns the names of deployed jobs in an environment.

func (*Store) ListDeployedServices

func (s *Store) ListDeployedServices(appName string, envName string) ([]string, error)

ListDeployedServices returns the names of deployed services in an environment.

func (*Store) ListEnvironmentsDeployedTo

func (s *Store) ListEnvironmentsDeployedTo(appName string, svcName string) ([]string, error)

ListEnvironmentsDeployedTo returns all the environment that a service is deployed in.

func (*Store) ListSNSTopics added in v1.10.0

func (s *Store) ListSNSTopics(appName string, envName string) ([]Topic, error)

ListSNSTopics returns a list of SNS topics deployed to the current environment and tagged with Copilot identifiers.

type TaskStackInfo added in v1.1.0

type TaskStackInfo struct {
	StackName string
	App       string
	Env       string

	RoleARN string
}

TaskStackInfo contains essential information about a Copilot task stack

func (TaskStackInfo) ECRRepoName added in v1.1.0

func (t TaskStackInfo) ECRRepoName() string

ECRRepoName returns the name of the ECR repo for the one-off task.

func (TaskStackInfo) TaskName added in v1.1.0

func (t TaskStackInfo) TaskName() string

TaskName returns the name of the one-off task. This is the same as the value of the copilot-task tag. For example, a stack called "task-db-migrate" will have the TaskName "db-migrate"

type Topic added in v1.10.0

type Topic struct {
	// contains filtered or unexported fields
}

Topic holds information about a Copilot SNS topic and its ARN, ID, and Name.

func NewTopic added in v1.10.0

func NewTopic(inputARN string, app, env, wkld string) (*Topic, error)

NewTopic creates a new Topic struct, validating the ARN as a Copilot-managed SNS topic. This function will

func (Topic) ARN added in v1.10.0

func (t Topic) ARN() string

ARN returns the full ARN of the SNS topic.

func (Topic) Name added in v1.10.0

func (t Topic) Name() string

Name returns the name of the given topic.

func (Topic) String added in v1.10.0

func (t Topic) String() string

String returns the human-readable string which contains the topic name and workload it's associated with. Example: arn:aws:us-west-2:sns:123456789012:app-env-wkld-topic -> topic (wkld)

func (Topic) Workload added in v1.10.0

func (t Topic) Workload() string

Workload returns the workload associated with the given topic.

Directories

Path Synopsis
Package cloudformation provides functionality to deploy CLI concepts with AWS CloudFormation.
Package cloudformation provides functionality to deploy CLI concepts with AWS CloudFormation.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
stack/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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