codepipeline 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +16 -11
- data/.gitmodules +9 -0
- data/.rspec +1 -1
- data/CHANGELOG.md +16 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +111 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +18 -17
- data/README.md +44 -20
- data/Rakefile +10 -2
- data/codepipe.gemspec +38 -0
- data/docs/.gitignore +4 -0
- data/docs/CNAME +1 -0
- data/docs/Gemfile +3 -0
- data/docs/LICENSE +21 -0
- data/docs/README.md +25 -0
- data/docs/_config.yml +73 -0
- data/docs/_docs/contributing.md +99 -0
- data/docs/_docs/conventions.md +43 -0
- data/docs/_docs/deploy.md +72 -0
- data/docs/_docs/dsl.md +13 -0
- data/docs/_docs/dsl/approve.md +62 -0
- data/docs/_docs/dsl/pipeline.md +56 -0
- data/docs/_docs/dsl/pipeline/action.md +28 -0
- data/docs/_docs/dsl/pipeline/codebuild.md +62 -0
- data/docs/_docs/dsl/pipeline/prefix-and-suffix.md +57 -0
- data/docs/_docs/dsl/role.md +79 -0
- data/docs/_docs/dsl/schedule.md +29 -0
- data/docs/_docs/dsl/sns.md +27 -0
- data/docs/_docs/dsl/webhook.md +31 -0
- data/docs/_docs/ecs-deploy.md +24 -0
- data/docs/_docs/examples/different-branches.md +50 -0
- data/docs/_docs/install.md +14 -0
- data/docs/_docs/next-steps.md +16 -0
- data/docs/_docs/settings.md +34 -0
- data/docs/_docs/start.md +31 -0
- data/docs/_includes/commands.html +92 -0
- data/docs/_includes/content.html +25 -0
- data/docs/_includes/edit-on-github.html +9 -0
- data/docs/_includes/footer.html +41 -0
- data/docs/_includes/google_analytics.html +10 -0
- data/docs/_includes/head.html +45 -0
- data/docs/_includes/js.html +15 -0
- data/docs/_includes/nav.html +17 -0
- data/docs/_includes/prev_next.md +19 -0
- data/docs/_includes/reference.md +1 -0
- data/docs/_includes/subnav.html +46 -0
- data/docs/_includes/tutorials.md +38 -0
- data/docs/_layouts/default.html +12 -0
- data/docs/_reference/pipe-completion.md +44 -0
- data/docs/_reference/pipe-completion_script.md +25 -0
- data/docs/_reference/pipe-delete.md +25 -0
- data/docs/_reference/pipe-deploy.md +26 -0
- data/docs/_reference/pipe-init.md +25 -0
- data/docs/_reference/pipe-start.md +25 -0
- data/docs/_reference/pipe-version.md +21 -0
- data/docs/_sass/_bootstrap-overrides.scss +40 -0
- data/docs/_sass/_contact.scss +49 -0
- data/docs/_sass/_cta.scss +37 -0
- data/docs/_sass/_download.scss +31 -0
- data/docs/_sass/_features.scss +47 -0
- data/docs/_sass/_footer.scss +49 -0
- data/docs/_sass/_global.scss +102 -0
- data/docs/_sass/_main.scss +364 -0
- data/docs/_sass/_masthead.scss +70 -0
- data/docs/_sass/_mixins.scss +79 -0
- data/docs/_sass/_navbar.scss +92 -0
- data/docs/_sass/_syntax.scss +65 -0
- data/docs/_sass/_table.scss +34 -0
- data/docs/_sass/_timeline.scss +207 -0
- data/docs/_sass/_variables.scss +24 -0
- data/docs/bin/web +8 -0
- data/docs/docs.md +24 -0
- data/docs/dsl/pipeline.md +76 -0
- data/docs/dsl/role.md +66 -0
- data/docs/dsl/schedule.md +20 -0
- data/docs/img/docs/codepipeline-output.png +0 -0
- data/docs/img/logos/boltops-logo-full.png +0 -0
- data/docs/img/logos/boltops-logo.png +0 -0
- data/docs/img/logos/project-logo.png +0 -0
- data/docs/index.html +35 -0
- data/docs/js/nav.js +39 -0
- data/docs/js/new-age.js +38 -0
- data/docs/js/new-age.min.js +6 -0
- data/docs/new-age.scss +20 -0
- data/docs/quick-start.md +73 -0
- data/docs/reference.md +12 -0
- data/docs/support.md +22 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.css +1339 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css +459 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +1 -0
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap.css +9320 -0
- data/docs/vendor/bootstrap/css/bootstrap.css.map +1 -0
- data/docs/vendor/bootstrap/css/bootstrap.min.css +6 -0
- data/docs/vendor/bootstrap/css/bootstrap.min.css.map +1 -0
- data/docs/vendor/bootstrap/js/bootstrap.js +3535 -0
- data/docs/vendor/bootstrap/js/bootstrap.min.js +7 -0
- data/docs/vendor/font-awesome/css/font-awesome.css +2337 -0
- data/docs/vendor/font-awesome/css/font-awesome.min.css +4 -0
- data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- data/docs/vendor/font-awesome/less/animated.less +34 -0
- data/docs/vendor/font-awesome/less/bordered-pulled.less +25 -0
- data/docs/vendor/font-awesome/less/core.less +12 -0
- data/docs/vendor/font-awesome/less/fixed-width.less +6 -0
- data/docs/vendor/font-awesome/less/font-awesome.less +18 -0
- data/docs/vendor/font-awesome/less/icons.less +789 -0
- data/docs/vendor/font-awesome/less/larger.less +13 -0
- data/docs/vendor/font-awesome/less/list.less +19 -0
- data/docs/vendor/font-awesome/less/mixins.less +60 -0
- data/docs/vendor/font-awesome/less/path.less +15 -0
- data/docs/vendor/font-awesome/less/rotated-flipped.less +20 -0
- data/docs/vendor/font-awesome/less/screen-reader.less +5 -0
- data/docs/vendor/font-awesome/less/stacked.less +20 -0
- data/docs/vendor/font-awesome/less/variables.less +799 -0
- data/docs/vendor/font-awesome/scss/_animated.scss +34 -0
- data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +25 -0
- data/docs/vendor/font-awesome/scss/_core.scss +12 -0
- data/docs/vendor/font-awesome/scss/_fixed-width.scss +6 -0
- data/docs/vendor/font-awesome/scss/_icons.scss +789 -0
- data/docs/vendor/font-awesome/scss/_larger.scss +13 -0
- data/docs/vendor/font-awesome/scss/_list.scss +19 -0
- data/docs/vendor/font-awesome/scss/_mixins.scss +60 -0
- data/docs/vendor/font-awesome/scss/_path.scss +15 -0
- data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +20 -0
- data/docs/vendor/font-awesome/scss/_screen-reader.scss +5 -0
- data/docs/vendor/font-awesome/scss/_stacked.scss +20 -0
- data/docs/vendor/font-awesome/scss/_variables.scss +799 -0
- data/docs/vendor/font-awesome/scss/font-awesome.scss +18 -0
- data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +59 -0
- data/docs/vendor/jquery-easing/jquery.easing.js +166 -0
- data/docs/vendor/jquery-easing/jquery.easing.min.js +1 -0
- data/docs/vendor/jquery/jquery.js +10253 -0
- data/docs/vendor/jquery/jquery.min.js +4 -0
- data/docs/vendor/simple-line-icons/css/simple-line-icons.css +778 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +200 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
- data/docs/vendor/simple-line-icons/less/simple-line-icons.less +982 -0
- data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +979 -0
- data/docs/vendor/tether/tether.js +1811 -0
- data/docs/vendor/tether/tether.min.js +1 -0
- data/exe/codepipeline +14 -0
- data/exe/pipe +14 -0
- data/lib/codepipe.rb +23 -0
- data/lib/codepipe/autoloader.rb +21 -0
- data/lib/codepipe/aws_services.rb +20 -0
- data/lib/codepipe/aws_services/helpers.rb +71 -0
- data/lib/codepipe/build.rb +13 -0
- data/lib/codepipe/cli.rb +60 -0
- data/lib/codepipe/command.rb +82 -0
- data/lib/codepipe/completer.rb +159 -0
- data/lib/codepipe/completer/script.rb +6 -0
- data/lib/codepipe/completer/script.sh +10 -0
- data/lib/codepipe/core.rb +63 -0
- data/lib/codepipe/create.rb +12 -0
- data/lib/codepipe/delete.rb +27 -0
- data/lib/codepipe/deploy.rb +40 -0
- data/lib/codepipe/dsl/pipeline.rb +37 -0
- data/lib/codepipe/dsl/pipeline/approve.rb +34 -0
- data/lib/codepipe/dsl/pipeline/codebuild.rb +57 -0
- data/lib/codepipe/dsl/pipeline/github.rb +36 -0
- data/lib/codepipe/dsl/role.rb +50 -0
- data/lib/codepipe/dsl/schedule.rb +30 -0
- data/lib/codepipe/dsl/sns.rb +15 -0
- data/lib/codepipe/dsl/ssm.rb +22 -0
- data/lib/codepipe/dsl/webhook.rb +27 -0
- data/lib/codepipe/evaluate.rb +47 -0
- data/lib/codepipe/help.rb +9 -0
- data/lib/codepipe/help/completion.md +22 -0
- data/lib/codepipe/help/completion_script.md +3 -0
- data/lib/codepipe/help/hello.md +5 -0
- data/lib/codepipe/init.rb +57 -0
- data/lib/codepipe/pipeline.rb +61 -0
- data/lib/codepipe/pipeline/s3_bucket.rb +88 -0
- data/lib/codepipe/role.rb +181 -0
- data/lib/codepipe/schedule.rb +99 -0
- data/lib/codepipe/sequence.rb +66 -0
- data/lib/codepipe/setting.rb +79 -0
- data/lib/codepipe/sns.rb +43 -0
- data/lib/codepipe/stack.rb +95 -0
- data/lib/codepipe/start.rb +83 -0
- data/lib/codepipe/update.rb +12 -0
- data/lib/codepipe/version.rb +3 -0
- data/lib/codepipe/webhook.rb +60 -0
- data/lib/codepipeline.rb +1 -6
- data/lib/template/.codepipeline/pipeline.rb.tt +33 -0
- data/lib/template/.codepipeline/schedule.rb +3 -0
- data/lib/template/.codepipeline/settings.yml +9 -0
- data/lib/template/.codepipeline/sns.rb +14 -0
- data/spec/fixtures/app/.codepipeline/pipeline.rb +12 -0
- data/spec/fixtures/app/.codepipeline/schedule.rb +1 -0
- data/spec/fixtures/app/.codepipeline/webhook.rb +1 -0
- data/spec/fixtures/pipelines/approve.rb +22 -0
- data/spec/fixtures/pipelines/approve_existing_sns.rb +24 -0
- data/spec/lib/cli_spec.rb +18 -0
- data/spec/lib/pipeline/approve_spec.rb +32 -0
- data/spec/lib/pipeline_spec.rb +12 -0
- data/spec/lib/role_spec.rb +12 -0
- data/spec/lib/schedule_spec.rb +12 -0
- data/spec/lib/webhook_spec.rb +12 -0
- data/spec/spec_helper.rb +35 -0
- metadata +419 -22
- data/.travis.yml +0 -7
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/codepipeline.gemspec +0 -27
- data/lib/codepipeline/version.rb +0 -3
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
title: Codebuild Project
|
3
|
+
nav_text: Codebuild
|
4
|
+
categories: dsl-pipeline
|
5
|
+
nav_order: 12
|
6
|
+
---
|
7
|
+
|
8
|
+
The `codebuild` method is one of the most useful methods in the `pipeline.rb` DSL arsenal. With it, you can add codebuild projects to your pipeline and sequence them quickly. Let's start with the simplest form.
|
9
|
+
|
10
|
+
## String Form
|
11
|
+
|
12
|
+
With the String form, the String sets both the name of the CodePipeline Action and CodeBuild Project.
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
stage "Deploy" do
|
16
|
+
codebuild "demo1"
|
17
|
+
codebuild "demo2", "demo3" # runs in parallel
|
18
|
+
codebuild "demo4"
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
With just a few lines of code, we have define the pipeline to run the `demo1` codebuild project first. Then run `demo2` and `demo3` in parallel. Last, run `demo4`.
|
23
|
+
|
24
|
+
## Simplified Hash Form
|
25
|
+
|
26
|
+
With the Simplified Hash form, we have more control over the CodePipeline Action and CodeBuild Project names.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
stage "Deploy" do
|
30
|
+
codebuild(name: "action1", project_name: "demo1")
|
31
|
+
codebuild({name: "action2", project_name: "demo2"}, {name: "action3", project_name: "demo3"}) # runs in parallel
|
32
|
+
codebuild(name: "action4", project_name: "demo4")
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
In this form, we can explicitly set what the Action Name shows up as in the CodePipeline. We can also set the CodeBuild project name explicitly.
|
37
|
+
|
38
|
+
## Full Hash Form
|
39
|
+
|
40
|
+
With the Full Hash Form, we have full control of the Action properties. To keep this example concise, we'll declare only one codebuild Action.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
stage "Build" do
|
44
|
+
codebuild(
|
45
|
+
name: "action1",
|
46
|
+
action_type_id: {
|
47
|
+
category: "Build",
|
48
|
+
owner: "AWS",
|
49
|
+
provider: "CodeBuild",
|
50
|
+
version: "1",
|
51
|
+
},
|
52
|
+
run_order: 1,
|
53
|
+
configuration: { project_name: 'demo1' },
|
54
|
+
# output_artifacts: [name: "BuildArtifact#{name}"], # optional
|
55
|
+
input_artifacts: [name: "SourceArtifact"], # default
|
56
|
+
)
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
The various forms all use ultimately all merge the properties down to the Full Hash Form. Generally, it is recommended you start with the simplest form and use the more complex forms when required.
|
61
|
+
|
62
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
title: Prefix and Suffix Option
|
3
|
+
nav_text: Prefix and Suffix
|
4
|
+
categories: dsl-pipeline
|
5
|
+
nav_order: 13
|
6
|
+
---
|
7
|
+
|
8
|
+
Somewhat interesting options are the `codebuild_prefix` and `codebuild_suffix` option. These options affect the `codebuild` method and allow you to remove some duplication in the pipeline declaration.
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
An example helps explain:
|
13
|
+
|
14
|
+
Let's say you have 3 codebuild projects that deploy different tiers of the same codebase:
|
15
|
+
|
16
|
+
* demo-web-deploy
|
17
|
+
* demo-clock-deploy
|
18
|
+
* demo-worker-deploy
|
19
|
+
|
20
|
+
The setup makes use of 3 codebuild projects, so we have control over deploying each tier separately if desired. Typically, to define this with `pipeline.rb`, it could look something like this.
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# Example 1
|
24
|
+
stage "Deploy" do
|
25
|
+
codebuild "demo-web-deploy", "demo-clock-deploy", "demo-worker-deploy"
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
The Action names in the Stage would be a little lengthy and look like this: DemoWebDeploy, DemoClockDeploy, DemoWorkerDeploy. If you wanted to use shorter names, you'd need to use the [Simpified Hash Form]({% link _docs/dsl/pipeline/codebuild.md %}).
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Example 2
|
33
|
+
stage "Deploy" do
|
34
|
+
codebuild(
|
35
|
+
{name: "Web", project_name: "demo-web-deploy"},
|
36
|
+
{name: "Clock", project_name: "demo-clock-deploy"},
|
37
|
+
{name: "Worker", project_name: "demo-worker-deploy"}
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
## Prefix and Suffix Option
|
42
|
+
|
43
|
+
If you use the `codebuild_prefix` and `codebuild_suffix`, it'll remove the need to use the Simplified Hash Form.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# Example 3
|
47
|
+
codebuild_prefix "demo-"
|
48
|
+
codebuild_suffix "-deploy"
|
49
|
+
|
50
|
+
stage "Deploy" do
|
51
|
+
codebuild "web", "clock", "worker"
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
So Example 2 and Examle 3 are equivalent.
|
56
|
+
|
57
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
---
|
2
|
+
title: Role DSL
|
3
|
+
nav_text: Role
|
4
|
+
categories: dsl
|
5
|
+
nav_order: 14
|
6
|
+
---
|
7
|
+
|
8
|
+
The codepipeline tool can create the IAM service role associated with the pipeline. Here's an example:
|
9
|
+
|
10
|
+
.codepipeline/role.rb:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
iam_policy("logs", "ssm")
|
14
|
+
```
|
15
|
+
|
16
|
+
For more control, here's a longer form:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
iam_policy(
|
20
|
+
action: [
|
21
|
+
"logs:CreateLogGroup",
|
22
|
+
"logs:CreateLogStream",
|
23
|
+
"logs:PutLogEvents",
|
24
|
+
"ssm:*",
|
25
|
+
],
|
26
|
+
effect: "Allow",
|
27
|
+
resource: "*"
|
28
|
+
)
|
29
|
+
```
|
30
|
+
|
31
|
+
You can also create managed IAM policy.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
managed_iam_policy("AmazonS3ReadOnlyAccess")
|
35
|
+
```
|
36
|
+
|
37
|
+
You can also add multiple managed IAM policies:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
managed_iam_policy("AmazonS3ReadOnlyAccess", "AmazonEC2ReadOnlyAccess")
|
41
|
+
```
|
42
|
+
|
43
|
+
## Full DSL
|
44
|
+
|
45
|
+
The convenience methods merely wrap properties of the [AWS::IAM::Role
|
46
|
+
CloudFormation Resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html). If you wanted to set the CloudFormation properties more directly, here's an example of using the "Full" DSL.
|
47
|
+
|
48
|
+
.codepipeline/role.rb:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
assume_role_policy_document(
|
52
|
+
statement: [{
|
53
|
+
action: ["sts:AssumeRole"],
|
54
|
+
effect: "Allow",
|
55
|
+
principal: {
|
56
|
+
service: ["codepipeline.amazonaws.com"]
|
57
|
+
}
|
58
|
+
}],
|
59
|
+
version: "2012-10-17"
|
60
|
+
)
|
61
|
+
path("/")
|
62
|
+
policies([{
|
63
|
+
policy_name: "CodeBuildAccess",
|
64
|
+
policy_document: {
|
65
|
+
version: "2012-10-17",
|
66
|
+
statement: [{
|
67
|
+
action: [
|
68
|
+
"logs:CreateLogGroup",
|
69
|
+
"logs:CreateLogStream",
|
70
|
+
"logs:PutLogEvents",
|
71
|
+
],
|
72
|
+
effect: "Allow",
|
73
|
+
resource: "*"
|
74
|
+
}]
|
75
|
+
}
|
76
|
+
}])
|
77
|
+
```
|
78
|
+
|
79
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: Schedule DSL
|
3
|
+
nav_text: Schedule
|
4
|
+
categories: dsl
|
5
|
+
nav_order: 15
|
6
|
+
---
|
7
|
+
|
8
|
+
The codepipeline tool supports creating a CloudWatch scheduled event rule that will trigger the codepipeline project periodically. You define the schedule in `.codepipeline/schedule.rb`. Here's an example of what that looks like:
|
9
|
+
|
10
|
+
.codepipeline/schedule.rb:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
rate "1 day"
|
14
|
+
# or
|
15
|
+
cron("0 10 * * ? *") # Run at 10:00 am (UTC) every day
|
16
|
+
```
|
17
|
+
|
18
|
+
## Full DSL
|
19
|
+
|
20
|
+
The convenience methods merely wrap properties of the [AWS::Events::Rule](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-description). If you wanted to set the CloudFormation properties more directly, here's an example of using the Full DSL.
|
21
|
+
|
22
|
+
.codepipeline/schedule.rb:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
description "my description"
|
26
|
+
schedule_expression "rate(1 day)"
|
27
|
+
```
|
28
|
+
|
29
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
title: Sns Topic DSL
|
3
|
+
nav_text: Sns Topic
|
4
|
+
categories: dsl
|
5
|
+
nav_order: 16
|
6
|
+
---
|
7
|
+
|
8
|
+
The codepipeline tool can optionally create an SNS Topic and associate it with your [Approval Action]({% link _docs/dsl/approve.md %}).
|
9
|
+
If you have created an Approval Action in the pipeline with the `approve` method, then the codepipeline tool will create and manage the SNS topic for you.
|
10
|
+
|
11
|
+
For most cases, the default SNS topic should suffice. However, if you wish to control the SNS topic properties you can do so with a `.codepipeline/sns.rb` file. Here's an example:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
display_name "my display_name"
|
15
|
+
kms_master_key_id "String"
|
16
|
+
# subscription([{
|
17
|
+
# endpoint: '',
|
18
|
+
# protocol: ','
|
19
|
+
# }])
|
20
|
+
topic_name "string", # Recommend not setting because update requires: Replacement. Allow CloudFormation to set it so 2 pipelines dont have same SNS Topic name that collides
|
21
|
+
```
|
22
|
+
|
23
|
+
The methods in the `sns.rb` are simply properties of the [SNS::Topic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html) CloudFormation Resource
|
24
|
+
|
25
|
+
Note: The codepipeline tool will only create the SNS Topic if you have declared an Approval Action in the `pipeline.rb` without specifying an existing SNS Topic ARN.
|
26
|
+
|
27
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
title: Webhook DSL
|
3
|
+
nav_text: Webhook
|
4
|
+
categories: dsl
|
5
|
+
nav_order: 17
|
6
|
+
---
|
7
|
+
|
8
|
+
The simplest way to declare a webhook is to use the `github_token` method. This single line is enough to configure and set up the webhook.
|
9
|
+
|
10
|
+
.codepipeline/webhook.rb:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
github_token(ssm("/codebuild/github/oauth_token"))
|
14
|
+
```
|
15
|
+
|
16
|
+
## Full DSL
|
17
|
+
|
18
|
+
The convenience methods merely wrap properties of the [AWS::CodePipeline::Webhook](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html). If you wanted to set the CloudFormation properties more directly, here's an example of using the Full DSL.
|
19
|
+
|
20
|
+
.codepipeline/webhook.rb:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
authentication "GITHUB_HMAC"
|
24
|
+
authentication_configuration(secret_token: ssm("/codebuild/github/oauth_token"))
|
25
|
+
filters([{
|
26
|
+
json_path: "$.ref",
|
27
|
+
match_equals: "refs/heads/{Branch}",
|
28
|
+
}])
|
29
|
+
```
|
30
|
+
|
31
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
title: 'ECS Deploy: Codebuild ufo ship vs CodePipeline ECS Deploy'
|
3
|
+
nav_order: 19
|
4
|
+
---
|
5
|
+
|
6
|
+
CodePipeline comes with many [Action Type Integrations](https://docs.aws.amazon.com/codepipeline/latest/userguide/integrations-action-type.html). One of the Integrations is [Amazon Elastic Container Service](https://docs.aws.amazon.com/codepipeline/latest/userguide/integrations-action-type.html#integrations-deploy) deployment.
|
7
|
+
|
8
|
+
Currently, it is recommended to use [codebuild and ufo](https://codebuild.cloud/docs/examples/ecs/) to handle deployment to ECS though. We discuss the main reasons below.
|
9
|
+
|
10
|
+
## Timeout
|
11
|
+
|
12
|
+
With the CodePipeline ECS Deploy if your ECS service fails to stabilize then the pipeline stage will not timeout until 60 minutes later. There is no built-in way to abort the pipeline stage. This is discussed here: [CodePipeline stage timeouts / abort?](https://forums.aws.amazon.com/thread.jspa?threadID=216350).
|
13
|
+
|
14
|
+
A workaround is discussed here: [How to stop an execution or set set timeout for an action in AWS CodePipeline?](https://stackoverflow.com/questions/50925732/how-to-stop-an-execution-or-set-set-timeout-for-an-action-in-aws-codepipeline/50929558). So to workaround waiting for 60 minutes, we can update the pipeline. This is a little bit inconvenient.
|
15
|
+
|
16
|
+
By using a codebuild project, we have control over the timeout.
|
17
|
+
|
18
|
+
## It's Less Powerful
|
19
|
+
|
20
|
+
The way the current CodePipeline ECS Deploy Action works is that it pulls down the current ECS task definition that ECS service is using. It then replaces the image property on it. Last, it then updates the ECS service with the newly built Docker image.
|
21
|
+
|
22
|
+
The [ufo tool] is more powerful. The `ufo ship` command also handles creating the [ELB Load Balancer]((https://ufoships.com/docs/extras/load-balancer/)) and a vanity [Route53 endpoint](https://ufoships.com/docs/extras/route53-support/) for us. Also, it keeps task definition codified.
|
23
|
+
|
24
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
title: Using Different Branches
|
3
|
+
nav_text: Different Branches
|
4
|
+
categories: examples
|
5
|
+
nav_order: 18
|
6
|
+
---
|
7
|
+
|
8
|
+
CodePipeline currently does not supports starting the pipeline execution with different branches natively. To get around this, we can:
|
9
|
+
|
10
|
+
1. update the pipeline before starting it.
|
11
|
+
2. create additional pipelines.
|
12
|
+
|
13
|
+
The codepipeline tool supports both methods.
|
14
|
+
|
15
|
+
## Update Pipeline Approach
|
16
|
+
|
17
|
+
With the update pipeline approach, the pipeline gets updated if the current pipeline branch is different from the requested branch before a pipeline execution starts. Examples:
|
18
|
+
|
19
|
+
pipe start -b master
|
20
|
+
pipe start -b qa
|
21
|
+
|
22
|
+
Note: With this approach, since the pipeline gets updated, the pipeline will maintain the last branch it was started with.
|
23
|
+
|
24
|
+
## Multiple Pipelines Approach
|
25
|
+
|
26
|
+
You might normally set the branch option in your pipeline.rb. Example:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
stage "Source" do
|
30
|
+
github(
|
31
|
+
source: "tongueroo/demo-cb",
|
32
|
+
branch: "master", # optional, defaults to master
|
33
|
+
auth_token: ssm("/github/user/token")
|
34
|
+
)
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
When we deploy to create the pipelines, we can explicitly specify the branch to use. The cli option overrides the branch specified in `pipeline.rb`. Examples:
|
39
|
+
|
40
|
+
pipe deploy demo-master -b master
|
41
|
+
pipe deploy demo-qa -b qa
|
42
|
+
|
43
|
+
This creates 2 pipelines. The demo-master pipeline will use the master branch, and the demo-qa pipeline will use the qa branch.
|
44
|
+
|
45
|
+
To start the pipelines:
|
46
|
+
|
47
|
+
pipe start demo-master
|
48
|
+
pipe start demo-qa
|
49
|
+
|
50
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
title: Installation
|
3
|
+
nav_order: 3
|
4
|
+
---
|
5
|
+
|
6
|
+
## RubyGems
|
7
|
+
|
8
|
+
Install codepipeline via RubyGems.
|
9
|
+
|
10
|
+
gem install codepipeline
|
11
|
+
|
12
|
+
The [Quick Start]({% link quick-start.md %}) provides a guide on how to use the codebuild tool. The [DSL Docs]({% link _docs/dsl.md %}) provide more detail on the syntax.
|
13
|
+
|
14
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
title: Next Steps
|
3
|
+
nav_order: 21
|
4
|
+
---
|
5
|
+
|
6
|
+
Hopefully, you have a good feel for how codepipeline works now. From here, there are a few resources that can help you continue along:
|
7
|
+
|
8
|
+
* Check out the [codepipeline](https://github.com/tongueroo/codepipeline) repo on GitHub
|
9
|
+
* ⭐️ the codepipeline project on GitHub
|
10
|
+
* Write a blog post about codepipeline
|
11
|
+
* Post on your favorite discussion about codepipeline
|
12
|
+
* Contribute a pull request
|
13
|
+
|
14
|
+
Everyone can contribute to making codepipeline better, including the documentation. These docs are the codepipeline repo located the [docs folder](https://github.com/tongueroo/codepipeline/tree/master/docs). Please fork the project and open a pull request! We love your pull requests. Contributions are encouraged and welcomed!
|
15
|
+
|
16
|
+
{% include prev_next.md %}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
title: Settings
|
3
|
+
nav_order: 6
|
4
|
+
---
|
5
|
+
|
6
|
+
The `.codepipeline/settings.yml` file can be used to adjust some of the behavior of the codepipeline tool. Here's an example of a settings.yml file:
|
7
|
+
|
8
|
+
```yaml
|
9
|
+
base:
|
10
|
+
# stack_naming:
|
11
|
+
# append_env: true # default false
|
12
|
+
|
13
|
+
development:
|
14
|
+
# aws_profile: dev_profile
|
15
|
+
|
16
|
+
production:
|
17
|
+
# aws_profile: prod_profile
|
18
|
+
```
|
19
|
+
|
20
|
+
The base settings are common and used for all the environments. The other environments are used according to the value of `PIPE_ENV`.
|
21
|
+
|
22
|
+
## Example
|
23
|
+
|
24
|
+
cb deploy # will use the development settings since development is the default
|
25
|
+
PIPE_ENV=production cb deploy # will use the production settings
|
26
|
+
|
27
|
+
## Options
|
28
|
+
|
29
|
+
Name | Description
|
30
|
+
--- | ---
|
31
|
+
stack_naming.append_env | Determines if `PIPE_ENV` value is append to the pipeline name.
|
32
|
+
aws_profile | This provides a way to bind PIPE_ENV to AWS_PROFILE tightly. This prevents you from forgetting to switch your PIPE_ENV when switching your AWS_PROFILE, thereby accidentally launching a stack in the wrong environment.
|
33
|
+
|
34
|
+
{% include prev_next.md %}
|
data/docs/_docs/start.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
title: Start
|
3
|
+
nav_order: 5
|
4
|
+
---
|
5
|
+
|
6
|
+
You can start a pipeline with the `pipe start` command. Here's an example:
|
7
|
+
|
8
|
+
$ pipe start
|
9
|
+
Pipeline started: demo
|
10
|
+
Please check the CodePipeline console for the status.
|
11
|
+
CodePipeline Console: https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/demo/view
|
12
|
+
Pipeline cli: aws codepipeline get-pipeline-execution --pipeline-execution-id 02579d64-9271-4edc-aa45-bc9629d732bb --pipeline-name demo
|
13
|
+
$
|
14
|
+
|
15
|
+
## Specifying Code Branch
|
16
|
+
|
17
|
+
If you would like start a build using a specific code branch you can use the `--branch` or `-b` option. Example:
|
18
|
+
|
19
|
+
pipe start -b feature-branch
|
20
|
+
|
21
|
+
## AWS CLI Equivalent
|
22
|
+
|
23
|
+
The `pipe start` command is a simple wrapper to the AWS API with the ruby sdk. You can also start pipelines with the `aws codepipeline` cli. Here's the equivalent CLI command:
|
24
|
+
|
25
|
+
aws codepipeline start-pipeline-execution --name demo
|
26
|
+
|
27
|
+
## CLI Reference
|
28
|
+
|
29
|
+
Also, for help info you can check the [pipe start]({% link _reference/pipe-start.md %}) CLI reference.
|
30
|
+
|
31
|
+
{% include prev_next.md %}
|