@@ -26,30 +26,30 @@ import (
2626)
2727
2828const (
29- fmtPipelineUpdateResourcesStart = "Adding pipeline resources to your application: %s"
30- fmtPipelineUpdateResourcesFailed = "Failed to add pipeline resources to your application: %s\n "
31- fmtPipelineUpdateResourcesComplete = "Successfully added pipeline resources to your application: %s\n "
29+ fmtPipelineDeployResourcesStart = "Adding pipeline resources to your application: %s"
30+ fmtPipelineDeployResourcesFailed = "Failed to add pipeline resources to your application: %s\n "
31+ fmtPipelineDeployResourcesComplete = "Successfully added pipeline resources to your application: %s\n "
3232
33- fmtPipelineUpdateStart = "Creating a new pipeline: %s"
34- fmtPipelineUpdateFailed = "Failed to create a new pipeline: %s.\n "
35- fmtPipelineUpdateComplete = "Successfully created a new pipeline: %s\n "
33+ fmtPipelineDeployStart = "Creating a new pipeline: %s"
34+ fmtPipelineDeployFailed = "Failed to create a new pipeline: %s.\n "
35+ fmtPipelineDeployComplete = "Successfully created a new pipeline: %s\n "
3636
37- fmtPipelineUpdateProposalStart = "Proposing infrastructure changes for the pipeline: %s"
38- fmtPipelineUpdateProposalFailed = "Failed to accept changes for pipeline: %s.\n "
39- fmtPipelineUpdateProposalComplete = "Successfully updated pipeline: %s\n "
37+ fmtPipelineDeployProposalStart = "Proposing infrastructure changes for the pipeline: %s"
38+ fmtPipelineDeployProposalFailed = "Failed to accept changes for pipeline: %s.\n "
39+ fmtPipelineDeployProposalComplete = "Successfully deployed pipeline: %s\n "
4040
41- fmtPipelineUpdateExistPrompt = "Are you sure you want to update an existing pipeline: %s?"
41+ fmtPipelineDeployExistPrompt = "Are you sure you want to redeploy an existing pipeline: %s?"
4242)
4343
4444const connectionsURL = "https://console.aws.amazon.com/codesuite/settings/connections"
4545
46- type updatePipelineVars struct {
46+ type deployPipelineVars struct {
4747 appName string
4848 skipConfirmation bool
4949}
5050
51- type updatePipelineOpts struct {
52- updatePipelineVars
51+ type deployPipelineOpts struct {
52+ deployPipelineVars
5353
5454 pipelineDeployer pipelineDeployer
5555 app * config.Application
@@ -64,7 +64,7 @@ type updatePipelineOpts struct {
6464 shouldPromptUpdateConnection bool
6565}
6666
67- func newUpdatePipelineOpts (vars updatePipelineVars ) (* updatePipelineOpts , error ) {
67+ func newDeployPipelineOpts (vars deployPipelineVars ) (* deployPipelineOpts , error ) {
6868 store , err := config .NewStore ()
6969 if err != nil {
7070 return nil , fmt .Errorf ("new config store client: %w" , err )
@@ -85,11 +85,11 @@ func newUpdatePipelineOpts(vars updatePipelineVars) (*updatePipelineOpts, error)
8585 return nil , fmt .Errorf ("new workspace client: %w" , err )
8686 }
8787
88- return & updatePipelineOpts {
88+ return & deployPipelineOpts {
8989 app : app ,
9090 pipelineDeployer : deploycfn .New (defaultSession ),
9191 region : aws .StringValue (defaultSession .Config .Region ),
92- updatePipelineVars : vars ,
92+ deployPipelineVars : vars ,
9393 envStore : store ,
9494 ws : ws ,
9595 prog : termprogress .NewSpinner (log .DiagnosticWriter ),
@@ -99,20 +99,20 @@ func newUpdatePipelineOpts(vars updatePipelineVars) (*updatePipelineOpts, error)
9999}
100100
101101// Validate returns an error if the flag values passed by the user are invalid.
102- func (o * updatePipelineOpts ) Validate () error {
102+ func (o * deployPipelineOpts ) Validate () error {
103103 return nil
104104}
105105
106106// Execute creates a new pipeline or updates the current pipeline if it already exists.
107- func (o * updatePipelineOpts ) Execute () error {
107+ func (o * deployPipelineOpts ) Execute () error {
108108 // bootstrap pipeline resources
109- o .prog .Start (fmt .Sprintf (fmtPipelineUpdateResourcesStart , color .HighlightUserInput (o .appName )))
109+ o .prog .Start (fmt .Sprintf (fmtPipelineDeployResourcesStart , color .HighlightUserInput (o .appName )))
110110 err := o .pipelineDeployer .AddPipelineResourcesToApp (o .app , o .region )
111111 if err != nil {
112- o .prog .Stop (log .Serrorf (fmtPipelineUpdateResourcesFailed , color .HighlightUserInput (o .appName )))
112+ o .prog .Stop (log .Serrorf (fmtPipelineDeployResourcesFailed , color .HighlightUserInput (o .appName )))
113113 return fmt .Errorf ("add pipeline resources to application %s in %s: %w" , o .appName , o .region , err )
114114 }
115- o .prog .Stop (log .Ssuccessf (fmtPipelineUpdateResourcesComplete , color .HighlightUserInput (o .appName )))
115+ o .prog .Stop (log .Ssuccessf (fmtPipelineDeployResourcesComplete , color .HighlightUserInput (o .appName )))
116116
117117 // read pipeline manifest
118118 data , err := o .ws .ReadPipelineManifest ()
@@ -173,7 +173,7 @@ func (o *updatePipelineOpts) Execute() error {
173173 return nil
174174}
175175
176- func (o * updatePipelineOpts ) convertStages (manifestStages []manifest.PipelineStage ) ([]deploy.PipelineStage , error ) {
176+ func (o * deployPipelineOpts ) convertStages (manifestStages []manifest.PipelineStage ) ([]deploy.PipelineStage , error ) {
177177 var stages []deploy.PipelineStage
178178 workloads , err := o .ws .ListWorkloads ()
179179 if err != nil {
@@ -202,7 +202,7 @@ func (o *updatePipelineOpts) convertStages(manifestStages []manifest.PipelineSta
202202 return stages , nil
203203}
204204
205- func (o * updatePipelineOpts ) getArtifactBuckets () ([]deploy.ArtifactBucket , error ) {
205+ func (o * deployPipelineOpts ) getArtifactBuckets () ([]deploy.ArtifactBucket , error ) {
206206 regionalResources , err := o .pipelineDeployer .GetRegionalAppResources (o .app )
207207 if err != nil {
208208 return nil , err
@@ -220,27 +220,27 @@ func (o *updatePipelineOpts) getArtifactBuckets() ([]deploy.ArtifactBucket, erro
220220 return buckets , nil
221221}
222222
223- func (o * updatePipelineOpts ) getBucketName () (string , error ) {
223+ func (o * deployPipelineOpts ) getBucketName () (string , error ) {
224224 resources , err := o .pipelineDeployer .GetAppResourcesByRegion (o .app , o .region )
225225 if err != nil {
226226 return "" , fmt .Errorf ("get app resources: %w" , err )
227227 }
228228 return resources .S3Bucket , nil
229229}
230230
231- func (o * updatePipelineOpts ) shouldUpdate () (bool , error ) {
231+ func (o * deployPipelineOpts ) shouldUpdate () (bool , error ) {
232232 if o .skipConfirmation {
233233 return true , nil
234234 }
235235
236- shouldUpdate , err := o .prompt .Confirm (fmt .Sprintf (fmtPipelineUpdateExistPrompt , o .pipelineName ), "" )
236+ shouldUpdate , err := o .prompt .Confirm (fmt .Sprintf (fmtPipelineDeployExistPrompt , o .pipelineName ), "" )
237237 if err != nil {
238- return false , fmt .Errorf ("prompt for pipeline update : %w" , err )
238+ return false , fmt .Errorf ("prompt for pipeline deploy : %w" , err )
239239 }
240240 return shouldUpdate , nil
241241}
242242
243- func (o * updatePipelineOpts ) deployPipeline (in * deploy.CreatePipelineInput ) error {
243+ func (o * deployPipelineOpts ) deployPipeline (in * deploy.CreatePipelineInput ) error {
244244 exist , err := o .pipelineDeployer .PipelineExists (in )
245245 if err != nil {
246246 return fmt .Errorf ("check if pipeline exists: %w" , err )
@@ -252,7 +252,7 @@ func (o *updatePipelineOpts) deployPipeline(in *deploy.CreatePipelineInput) erro
252252 return fmt .Errorf ("get bucket name: %w" , err )
253253 }
254254 if ! exist {
255- o .prog .Start (fmt .Sprintf (fmtPipelineUpdateStart , color .HighlightUserInput (o .pipelineName )))
255+ o .prog .Start (fmt .Sprintf (fmtPipelineDeployStart , color .HighlightUserInput (o .pipelineName )))
256256
257257 // If the source requires CodeStar Connections, the user is prompted to update the connection status.
258258 if o .shouldPromptUpdateConnection {
@@ -273,11 +273,11 @@ func (o *updatePipelineOpts) deployPipeline(in *deploy.CreatePipelineInput) erro
273273 if err := o .pipelineDeployer .CreatePipeline (in , bucketName ); err != nil {
274274 var alreadyExists * cloudformation.ErrStackAlreadyExists
275275 if ! errors .As (err , & alreadyExists ) {
276- o .prog .Stop (log .Serrorf (fmtPipelineUpdateFailed , color .HighlightUserInput (o .pipelineName )))
276+ o .prog .Stop (log .Serrorf (fmtPipelineDeployFailed , color .HighlightUserInput (o .pipelineName )))
277277 return fmt .Errorf ("create pipeline: %w" , err )
278278 }
279279 }
280- o .prog .Stop (log .Ssuccessf (fmtPipelineUpdateComplete , color .HighlightUserInput (o .pipelineName )))
280+ o .prog .Stop (log .Ssuccessf (fmtPipelineDeployComplete , color .HighlightUserInput (o .pipelineName )))
281281 return nil
282282 }
283283
@@ -289,35 +289,37 @@ func (o *updatePipelineOpts) deployPipeline(in *deploy.CreatePipelineInput) erro
289289 if ! shouldUpdate {
290290 return nil
291291 }
292- o .prog .Start (fmt .Sprintf (fmtPipelineUpdateProposalStart , color .HighlightUserInput (o .pipelineName )))
292+ o .prog .Start (fmt .Sprintf (fmtPipelineDeployProposalStart , color .HighlightUserInput (o .pipelineName )))
293293 if err := o .pipelineDeployer .UpdatePipeline (in , bucketName ); err != nil {
294- o .prog .Stop (log .Serrorf (fmtPipelineUpdateProposalFailed , color .HighlightUserInput (o .pipelineName )))
294+ o .prog .Stop (log .Serrorf (fmtPipelineDeployProposalFailed , color .HighlightUserInput (o .pipelineName )))
295295 return fmt .Errorf ("update pipeline: %w" , err )
296296 }
297- o .prog .Stop (log .Ssuccessf (fmtPipelineUpdateProposalComplete , color .HighlightUserInput (o .pipelineName )))
297+ o .prog .Stop (log .Ssuccessf (fmtPipelineDeployProposalComplete , color .HighlightUserInput (o .pipelineName )))
298298 return nil
299299}
300300
301301// RecommendedActions returns follow-up actions the user can take after successfully executing the command.
302- func (o * updatePipelineOpts ) RecommendedActions () []string {
302+ func (o * deployPipelineOpts ) RecommendedActions () []string {
303303 return []string {
304304 fmt .Sprintf ("Run %s to see the state of your pipeline." , color .HighlightCode ("copilot pipeline status" )),
305305 fmt .Sprintf ("Run %s for info about your pipeline." , color .HighlightCode ("copilot pipeline show" )),
306306 }
307307}
308308
309- // BuildPipelineUpdateCmd build the command for deploying a new pipeline or updating an existing pipeline.
310- func buildPipelineUpdateCmd () * cobra.Command {
311- vars := updatePipelineVars {}
309+ // BuildPipelineDeployCmd build the command for deploying a new pipeline or updating an existing pipeline.
310+ func buildPipelineDeployCmd () * cobra.Command {
311+ vars := deployPipelineVars {}
312312 cmd := & cobra.Command {
313- Use : "update" ,
314- Short : "Deploys a pipeline for the services in your workspace." ,
315- Long : `Deploys a pipeline for the services in your workspace, using the environments associated with the application.` ,
313+ Use : "deploy" ,
314+ Aliases : []string {"update" },
315+ Short : "Deploys a pipeline for the services in your workspace." ,
316+ Long : `Deploys a pipeline for the services in your workspace, using the environments associated with the application.` ,
316317 Example : `
317- Deploys an updated pipeline for the services in your workspace.
318- /code $ copilot pipeline update` ,
318+ Deploys a pipeline for the services and jobs in your workspace.
319+ /code $ copilot pipeline deploy
320+ ` ,
319321 RunE : runCmdE (func (cmd * cobra.Command , args []string ) error {
320- opts , err := newUpdatePipelineOpts (vars )
322+ opts , err := newDeployPipelineOpts (vars )
321323 if err != nil {
322324 return err
323325 }
0 commit comments