Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/pkg/manifest/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ func UnmarshalPipeline(in []byte) (*PipelineManifest, error) {
return nil, errors.New("unexpected error occurs while unmarshalling pipeline.yml")
}

// IsCodeStarConnection indicates to the manifest if this source requires a CSC connection.
func (s Source) IsCodeStarConnection() bool {
switch s.ProviderName {
case GithubProviderName:
return true
case BitbucketProviderName:
return true
default:
return false
}
}

func validateVersion(pm *PipelineManifest) (PipelineSchemaMajorVersion, error) {
switch pm.Version {
case Ver1:
Expand Down
4 changes: 3 additions & 1 deletion site/content/docs/concepts/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ source:
properties:
branch: main
repository: https://github.com/kohidave/demo-api-frontend
# Optional: specify the name of an existing CodeStar Connections connection.
# connection_name: a-connection

# The deployment section defines the order the pipeline will deploy
# to your environments.
Expand All @@ -90,7 +92,7 @@ stages:

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.

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.
Typically, you'll update this file if you add new environments you want to deploy to, or want to track a different branch. If you are using CodeStar Connections to connect to your repository and would like to utilize an existing connection rather than let Copilot generate one for you, you may add the connection name here. 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.

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

Expand Down
5 changes: 5 additions & 0 deletions site/content/docs/manifest/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ List of all available properties for a Copilot pipeline manifest.
properties:
branch: main
repository: https://github.com/<user>/sample-app-frontend
# Optional: specify the name of an existing CodeStar Connections connection.
connection_name: a-connection

stages:
-
Expand Down Expand Up @@ -53,6 +55,9 @@ The name of the branch in your repository that triggers the pipeline. The defaul
<span class="parent-field">source.properties.</span><a id="source-properties-repository" href="#source-properties-repository" class="field">`repository`</a> <span class="type">String</span>
The URL of your repository.

<span class="parent-field">source.properties.</span><a id="source-properties-connection-name" href="#source-properties-connection-name" class="field">`connection_name`</a> <span class="type">String</span>
The name of an existing CodeStar Connections connection. If omitted, Copilot will generate a connection for you.

<div class="separator"></div>

<a id="stages" href="#stages" class="field">`stages`</a> <span class="type">Array of Maps</span>
Expand Down
4 changes: 4 additions & 0 deletions templates/cicd/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ source:
# has the following properties: repository, branch.
properties:{{range $key, $value := .Source.Properties}}
{{$key}}: {{$value}}{{end}}
{{- if .Source.IsCodeStarConnection}}
# Optional: specify the name of an existing CodeStar Connections connection.
# connection_name: a-connection
{{- end}}
{{$length := len .Stages}}{{if gt $length 0}}
# The deployment section defines the order the pipeline will deploy
# to your environments.
Expand Down