Skip to content

Commit cc48fae

Browse files
authored
chore(docs): update docs and prompt to emphasize pushing of necessary files (#1981)
Previously, only the buildspec.yml needed to be added to the source repo in order to build a pipeline. But now the buildspec checks the pipeline manifest to see which environment stages to deploy to (and only upgrades those envs), so both files (and `.workspace`)need to be checked into the user's repo. This updates docs and CLI prompts to reflect that change. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 8c747d0 commit cc48fae

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

internal/pkg/cli/pipeline_init.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ func (o *initPipelineOpts) Execute() error {
209209
return nil
210210
}
211211

212-
// RequiredActions returns follow-up actions the user can take after successfully executing the command.
212+
// RequiredActions returns follow-up actions the user must take after successfully executing the command.
213213
func (o *initPipelineOpts) RequiredActions() []string {
214214
return []string{
215-
"Commit and push the generated buildspec and manifest file.",
216-
fmt.Sprintf("Run %s to deploy your pipeline for the repository.", color.HighlightCode("copilot pipeline update")),
215+
fmt.Sprintf("Commit and push the %s, %s, and %s files of your %s directory to your repository.", color.HighlightResource("buildspec.yml"), color.HighlightResource("pipeline.yml"), color.HighlightResource(".workspace"), color.HighlightResource("copilot")),
216+
fmt.Sprintf("Run %s to create your pipeline.", color.HighlightCode("copilot pipeline update")),
217217
}
218218
}
219219

@@ -544,7 +544,9 @@ func (o *initPipelineOpts) createPipelineManifest() error {
544544
manifestMsgFmt = "Pipeline manifest file for %s already exists at %s, skipping writing it.\n"
545545
}
546546
log.Successf(manifestMsgFmt, color.HighlightUserInput(o.repoName), color.HighlightResource(manifestPath))
547-
log.Infoln("The manifest contains configurations for your CodePipeline resources, such as your pipeline stages and build steps.")
547+
log.Infof(`The manifest contains configurations for your CodePipeline resources, such as your pipeline stages and build steps.
548+
Update the file to add additional stages, change the branch to be tracked, or add test commands or manual approval actions.
549+
`)
548550
return nil
549551
}
550552

@@ -584,7 +586,9 @@ func (o *initPipelineOpts) createBuildspec() error {
584586
return err
585587
}
586588
log.Successf(buildspecMsgFmt, color.HighlightResource(buildspecPath))
587-
log.Infoln("The buildspec contains the commands to build and push your container images to your ECR repositories.")
589+
log.Infof(`The buildspec contains the commands to build and push your container images to your ECR repositories.
590+
Update the %s phase to unit test your services before pushing the images.
591+
`, color.HighlightResource("build"))
588592

589593
return nil
590594
}

site/content/docs/concepts/pipelines.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ Want to learn more about CodePipeline? Check out their [getting started docs](ht
2424
Creating a Pipeline requires only three steps:
2525

2626
1. Preparing the pipeline structure.
27-
2. Committing the generated `buildspec.yml`.
27+
2. Committing and pushing the files generated in the `copilot/` directory.
2828
3. Creating the actual CodePipeline.
2929

3030
Follow the three steps below, from your workspace root:
3131

3232
```bash
3333
$ copilot pipeline init
34-
$ git add copilot/buildspec.yml && git commit -m "Adding Pipeline Buildspec" && git push
34+
$ git add copilot/pipeline.yml copilot/buildspec.yml copilot/.workspace && git commit -m "Adding pipeline artifacts" && git push
3535
$ copilot pipeline update
3636
```
3737

@@ -55,7 +55,7 @@ This won't create your pipeline, but it will create some local files that will b
5555

5656
### Step 2: Updating the Pipeline manifest (optional)
5757

58-
Just like your service has a simple manifest file, so does your pipeline. After you run `pipeline init`, two files are created: `pipeline.yml` and `buildspec.yml`, both in your `copilot/` directory. If you poke in, you'll see a file that looks something like this (for a service called "api-frontend" with two environments, "test" and "prod"):
58+
Just like your service has a simple manifest file, so does your pipeline. After you run `pipeline init`, two files are created: `pipeline.yml` and `buildspec.yml`, both in your `copilot/` directory. If you poke in, you'll see that the `pipeline.yml` looks something like this (for a service called "api-frontend" with two environments, "test" and "prod"):
5959

6060
```yaml
6161
# This YAML file defines the relationship and deployment ordering of your environments.
@@ -93,27 +93,31 @@ stages:
9393

9494
There are 3 main parts of this file: the `name` field, which is the name of your CodePipeline, the `source` section, which details the repository and branch to track, and the `stages` section, which lists the environments you want this pipeline to deploy to. You can update this anytime, but you must run `copilot pipeline update` afterwards.
9595

96-
Typically, you'll update this file if you add new environments you want to deploy to, or want to track a different branch.
96+
Typically, you'll update this file if you add new environments you want to deploy to, or want to track a different branch. The pipeline manifest is also where you may add a manual approval step before deployment or commands to run tests (see "Adding Tests," below) after deployment.
9797

9898
### Step 3: Updating the Buildspec (optional)
9999

100100
Along with `pipeline.yml`, the `pipeline init` command also generated a `buildspec.yml` file in the `copilot/` directory. This contains the instructions for building and publishing your service. If you want to run any additional commands, besides `docker build`, such as unit tests or style checkers, feel free to add them to the buildspec's `build` phase.
101101

102102
When this buildspec runs, it pulls down the version of Copilot which was used when you ran `pipeline init`, to ensure backwards compatibility.
103103

104-
### Step 4: Creating your Pipeline
104+
### Step 4: Pushing New Files to your Repository
105105

106-
Now that your `pipeline.yml` and `buildspec.yml` are created, check them in and push them to your repository. The `buildspec.yml` is needed for your pipeline's `build` stage to run successfully. Once you've done that, to actually create your pipeline run:
106+
Now that your `pipeline.yml`, `buildspec.yml`, and `.workspace` files have been created, add them to your repository. These files in your `copilot/` directory are required for your pipeline's `build` stage to run successfully.
107+
108+
### Step 5: Creating your Pipeline
109+
110+
Here's the fun part! Run:
107111

108112
`copilot pipeline update`
109113

110-
This parses your `pipeline.yml`, creates a CodePipeline in the same account and region as your project and kicks off a pipeline execution. Log into the AWS Console to watch your pipeline go.
114+
This parses your `pipeline.yml`, creates a CodePipeline in the same account and region as your project and kicks off a pipeline execution. Log into the AWS Console to watch your pipeline go, or run `copilot pipeline status` to check in on its execution.
111115

112116
![Your completed CodePipeline](https://user-images.githubusercontent.com/828419/71861318-c7083980-30aa-11ea-80bb-4bea25bf5d04.png)
113117

114118
## Adding Tests
115119

116-
Of course, one of the most important parts of a pipeline is the automated testing. To add your own test commands, include the commands you'd like to run after your deploy step in the `test_commands` section. If all the commands succeed, your change is promoted to the next stage.
120+
Of course, one of the most important parts of a pipeline is the automated testing. To add tests, such as integration or end-to-end tests, that run after a deployment stage, include those commands in the `test_commands` section. If all the tests succeed, your change is promoted to the next stage.
117121

118122
Adding `test_commands` generates a CodeBuild project with the [aws/codebuild/amazonlinux2-x86_64-standard:3.0](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html) image - so most commands from Amazon Linux 2 (including `make`) are available for use.
119123

@@ -139,4 +143,4 @@ stages:
139143
- echo "woo! Tests passed"
140144
-
141145
name: prod
142-
```
146+
```

0 commit comments

Comments
 (0)