codebuild 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/codebuild.gemspec +8 -3
- data/lib/codebuild/version.rb +1 -1
- data/vendor/aws_data/CHANGELOG.md +7 -0
- data/vendor/aws_data/Gemfile +4 -0
- data/{docs/LICENSE → vendor/aws_data/LICENSE.txt} +4 -4
- data/vendor/aws_data/README.md +42 -0
- data/vendor/aws_data/Rakefile +6 -0
- data/vendor/aws_data/aws_data.gemspec +30 -0
- data/vendor/aws_data/bin/console +14 -0
- data/vendor/aws_data/bin/setup +8 -0
- data/vendor/aws_data/lib/aws_data.rb +91 -0
- data/vendor/aws_data/lib/aws_data/version.rb +3 -0
- data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
- data/vendor/aws_data/spec/spec_helper.rb +14 -0
- data/vendor/cfn-status/Gemfile +4 -0
- data/vendor/cfn-status/LICENSE.txt +21 -0
- data/vendor/cfn-status/README.md +56 -0
- data/vendor/cfn-status/Rakefile +6 -0
- data/vendor/cfn-status/bin/console +14 -0
- data/vendor/cfn-status/bin/setup +8 -0
- data/vendor/cfn-status/cfn-status.gemspec +30 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
- data/vendor/cfn-status/lib/cfn/status.rb +220 -0
- data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
- data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/vendor/cfn-status/spec/spec_helper.rb +14 -0
- data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
- data/vendor/cfn_camelizer/Gemfile +4 -0
- data/vendor/cfn_camelizer/LICENSE.txt +21 -0
- data/vendor/cfn_camelizer/README.md +40 -0
- data/vendor/cfn_camelizer/Rakefile +6 -0
- data/vendor/cfn_camelizer/bin/console +14 -0
- data/vendor/cfn_camelizer/bin/setup +8 -0
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
- data/vendor/cfn_camelizer/lib/camelizer.yml +33 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
- data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
- metadata +46 -173
- data/docs/.gitignore +0 -4
- data/docs/CNAME +0 -1
- data/docs/Gemfile +0 -3
- data/docs/README.md +0 -25
- data/docs/_config.yml +0 -73
- data/docs/_docs/contributing.md +0 -99
- data/docs/_docs/conventions.md +0 -51
- data/docs/_docs/deploy.md +0 -69
- data/docs/_docs/dsl.md +0 -12
- data/docs/_docs/dsl/project.md +0 -80
- data/docs/_docs/dsl/role.md +0 -79
- data/docs/_docs/dsl/schedule.md +0 -29
- data/docs/_docs/examples.md +0 -12
- data/docs/_docs/examples/ecs.md +0 -107
- data/docs/_docs/examples/jets.md +0 -79
- data/docs/_docs/examples/ruby.md +0 -44
- data/docs/_docs/github_oauth.md +0 -51
- data/docs/_docs/install.md +0 -14
- data/docs/_docs/next-steps.md +0 -16
- data/docs/_docs/settings.md +0 -34
- data/docs/_docs/start.md +0 -51
- data/docs/_docs/type-option.md +0 -72
- data/docs/_docs/variables.md +0 -117
- data/docs/_includes/commands.html +0 -88
- data/docs/_includes/content.html +0 -25
- data/docs/_includes/edit-on-github.html +0 -9
- data/docs/_includes/examples-steps.md +0 -17
- data/docs/_includes/footer.html +0 -41
- data/docs/_includes/google_analytics.html +0 -10
- data/docs/_includes/head.html +0 -45
- data/docs/_includes/js.html +0 -15
- data/docs/_includes/nav.html +0 -17
- data/docs/_includes/prev_next.md +0 -19
- data/docs/_includes/reference.md +0 -1
- data/docs/_includes/subnav.html +0 -38
- data/docs/_includes/tutorials.md +0 -38
- data/docs/_layouts/default.html +0 -12
- data/docs/_reference/cb-completion.md +0 -44
- data/docs/_reference/cb-completion_script.md +0 -25
- data/docs/_reference/cb-delete.md +0 -26
- data/docs/_reference/cb-deploy.md +0 -58
- data/docs/_reference/cb-init.md +0 -88
- data/docs/_reference/cb-start.md +0 -43
- data/docs/_reference/cb-version.md +0 -21
- data/docs/_sass/_bootstrap-overrides.scss +0 -40
- data/docs/_sass/_contact.scss +0 -49
- data/docs/_sass/_cta.scss +0 -37
- data/docs/_sass/_download.scss +0 -31
- data/docs/_sass/_features.scss +0 -47
- data/docs/_sass/_footer.scss +0 -49
- data/docs/_sass/_global.scss +0 -102
- data/docs/_sass/_main.scss +0 -364
- data/docs/_sass/_masthead.scss +0 -70
- data/docs/_sass/_mixins.scss +0 -79
- data/docs/_sass/_navbar.scss +0 -92
- data/docs/_sass/_syntax.scss +0 -65
- data/docs/_sass/_table.scss +0 -34
- data/docs/_sass/_timeline.scss +0 -207
- data/docs/_sass/_variables.scss +0 -24
- data/docs/bin/web +0 -8
- data/docs/docs.md +0 -22
- data/docs/img/docs/codebuild-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 +0 -35
- data/docs/js/nav.js +0 -39
- data/docs/js/new-age.js +0 -38
- data/docs/js/new-age.min.js +0 -6
- data/docs/new-age.scss +0 -20
- data/docs/quick-start.md +0 -72
- data/docs/reference.md +0 -12
- data/docs/support.md +0 -22
- data/docs/vendor/bootstrap/css/bootstrap-grid.css +0 -1339
- data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css +0 -459
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap.css +0 -9320
- data/docs/vendor/bootstrap/css/bootstrap.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap.min.css +0 -6
- data/docs/vendor/bootstrap/css/bootstrap.min.css.map +0 -1
- data/docs/vendor/bootstrap/js/bootstrap.js +0 -3535
- data/docs/vendor/bootstrap/js/bootstrap.min.js +0 -7
- data/docs/vendor/font-awesome/css/font-awesome.css +0 -2337
- data/docs/vendor/font-awesome/css/font-awesome.min.css +0 -4
- 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 +0 -2671
- 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 +0 -34
- data/docs/vendor/font-awesome/less/bordered-pulled.less +0 -25
- data/docs/vendor/font-awesome/less/core.less +0 -12
- data/docs/vendor/font-awesome/less/fixed-width.less +0 -6
- data/docs/vendor/font-awesome/less/font-awesome.less +0 -18
- data/docs/vendor/font-awesome/less/icons.less +0 -789
- data/docs/vendor/font-awesome/less/larger.less +0 -13
- data/docs/vendor/font-awesome/less/list.less +0 -19
- data/docs/vendor/font-awesome/less/mixins.less +0 -60
- data/docs/vendor/font-awesome/less/path.less +0 -15
- data/docs/vendor/font-awesome/less/rotated-flipped.less +0 -20
- data/docs/vendor/font-awesome/less/screen-reader.less +0 -5
- data/docs/vendor/font-awesome/less/stacked.less +0 -20
- data/docs/vendor/font-awesome/less/variables.less +0 -799
- data/docs/vendor/font-awesome/scss/_animated.scss +0 -34
- data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +0 -25
- data/docs/vendor/font-awesome/scss/_core.scss +0 -12
- data/docs/vendor/font-awesome/scss/_fixed-width.scss +0 -6
- data/docs/vendor/font-awesome/scss/_icons.scss +0 -789
- data/docs/vendor/font-awesome/scss/_larger.scss +0 -13
- data/docs/vendor/font-awesome/scss/_list.scss +0 -19
- data/docs/vendor/font-awesome/scss/_mixins.scss +0 -60
- data/docs/vendor/font-awesome/scss/_path.scss +0 -15
- data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +0 -20
- data/docs/vendor/font-awesome/scss/_screen-reader.scss +0 -5
- data/docs/vendor/font-awesome/scss/_stacked.scss +0 -20
- data/docs/vendor/font-awesome/scss/_variables.scss +0 -799
- data/docs/vendor/font-awesome/scss/font-awesome.scss +0 -18
- data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +0 -59
- data/docs/vendor/jquery-easing/jquery.easing.js +0 -166
- data/docs/vendor/jquery-easing/jquery.easing.min.js +0 -1
- data/docs/vendor/jquery/jquery.js +0 -10253
- data/docs/vendor/jquery/jquery.min.js +0 -4
- data/docs/vendor/simple-line-icons/css/simple-line-icons.css +0 -778
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +0 -200
- 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 +0 -982
- data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +0 -979
- data/docs/vendor/tether/tether.js +0 -1811
- data/docs/vendor/tether/tether.min.js +0 -1
- data/spec/fixtures/app/.codebuild/project.rb +0 -2
- data/spec/fixtures/app/.codebuild/role.rb +0 -1
- data/spec/fixtures/app/.codebuild/schedule.rb +0 -1
- data/spec/fixtures/app/.codebuild/settings.yml +0 -13
- data/spec/lib/cli_spec.rb +0 -13
- data/spec/lib/project_spec.rb +0 -12
- data/spec/lib/role_spec.rb +0 -12
- data/spec/lib/schedule_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -35
data/docs/_docs/dsl/schedule.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Schedule DSL
|
3
|
-
nav_text: Schedule
|
4
|
-
categories: dsl
|
5
|
-
nav_order: 14
|
6
|
-
---
|
7
|
-
|
8
|
-
The codebuild tool supports creating a CloudWatch scheduled event rule that will trigger the codebuild project periodically. You define the schedule in `.codebuild/schedule.rb`. Here's an example of what that looks like:
|
9
|
-
|
10
|
-
.codebuild/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
|
-
.codebuild/schedule.rb:
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
description "my description"
|
26
|
-
schedule_expression "rate(1 day)"
|
27
|
-
```
|
28
|
-
|
29
|
-
{% include prev_next.md %}
|
data/docs/_docs/examples.md
DELETED
data/docs/_docs/examples/ecs.md
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: ECS
|
3
|
-
nav_text: ECS
|
4
|
-
categories: example
|
5
|
-
nav_order: 16
|
6
|
-
---
|
7
|
-
|
8
|
-
This example will show some powerful patterns with the codebuild tool. We'll use codebuild with the [ufo](https://ufoships.com) tool to deploy an application to ECS.
|
9
|
-
|
10
|
-
Here's the project DSL.
|
11
|
-
|
12
|
-
.codebuild/project.rb:
|
13
|
-
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
github_url("https://github.com/tongueroo/demo-ufo)
|
17
|
-
linux_image("aws/codebuild/ruby:2.5.3-1.7.0")
|
18
|
-
environment_variables(
|
19
|
-
UFO_ENV: Codebuild.env,
|
20
|
-
UFO_APP: project_name,
|
21
|
-
)
|
22
|
-
```
|
23
|
-
|
24
|
-
Notice the use of `Codebuild.env` and `project_name` to set environment variables. The environment variables are later used in the `.buildspec.yml`.
|
25
|
-
|
26
|
-
* The `Codebuild.env` method contains the value of `CB_ENV` when you run the `cb deploy` command.
|
27
|
-
* The `project_name` is the CodeBuild project name itself.
|
28
|
-
|
29
|
-
If CodeBuild project name matches the ufo ECS service name, then it makes the commands very simple. For example.
|
30
|
-
|
31
|
-
CB_ENV=production cb deploy demo-web
|
32
|
-
|
33
|
-
Creates a CodeBuild project that will deploy your app to production and create an ECS service named `demo-web` via ufo.
|
34
|
-
|
35
|
-
Here's the buildspec that references the environment variables set in `project.rb` earlier:
|
36
|
-
|
37
|
-
.codebuild/buildspec.yml
|
38
|
-
|
39
|
-
```yaml
|
40
|
-
version: 0.2
|
41
|
-
|
42
|
-
phases:
|
43
|
-
pre_build:
|
44
|
-
commands:
|
45
|
-
- gem install --no-document ufo
|
46
|
-
build:
|
47
|
-
commands:
|
48
|
-
- echo Deploying project to ECS started on `date`
|
49
|
-
- UFO_ENV=$UFO_ENV ufo ship $UFO_APP
|
50
|
-
```
|
51
|
-
|
52
|
-
The `ufo ship` command:
|
53
|
-
|
54
|
-
UFO_ENV=$UFO_ENV ufo ship $UFO_APP
|
55
|
-
|
56
|
-
When codebuild actually runs, the values will be:
|
57
|
-
|
58
|
-
UFO_ENV=production ufo ship demo-web
|
59
|
-
|
60
|
-
## IAM Policy
|
61
|
-
|
62
|
-
The codebuild tool also can create the IAM Policy that will give CodeBuild the IAM permissions necessary to create the ECS service and other resources that `ufo ship` creates. Here are the IAM permissions as detailed on the [UFO Minimal IAM Permissions](https://ufoships.com/docs/extras/minimal-deploy-iam/) docs.
|
63
|
-
|
64
|
-
.codebuild/role.rb:
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
iam_policy(
|
68
|
-
"cloudformation",
|
69
|
-
"ec2",
|
70
|
-
"ecr",
|
71
|
-
"ecs",
|
72
|
-
"elasticloadbalancing",
|
73
|
-
"elasticloadbalancingv2",
|
74
|
-
"logs",
|
75
|
-
"route53",
|
76
|
-
"ssm",
|
77
|
-
{
|
78
|
-
"Action": [
|
79
|
-
"iam:PassRole"
|
80
|
-
],
|
81
|
-
"Effect": "Allow",
|
82
|
-
"Resource": "*",
|
83
|
-
"Condition": {
|
84
|
-
"StringLike": {
|
85
|
-
"iam:PassedToService": [
|
86
|
-
"ecs-tasks.amazonaws.com"
|
87
|
-
]
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
)
|
92
|
-
managed_iam_policy("AmazonS3ReadOnlyAccess") # optional but common to need read only access to s3
|
93
|
-
```
|
94
|
-
|
95
|
-
## Security
|
96
|
-
|
97
|
-
From a security perspective, using CodeBuild gives us a stronger security posture. The **only** permission the user calling [cb start]({% link _docs/start.md %}) really needs is CodeBuild access. The permissions to create the ECS service and other deployment resources are delegated to the CodeBuild project itself. We know that the CodeBuild project will not run any arbitrary commands unless we update `buildspec.yml` and explicitly give permission to it's IAM role.
|
98
|
-
|
99
|
-
{% include examples-steps.md %}
|
100
|
-
|
101
|
-
## CodePipeline ECS Deploy Action
|
102
|
-
|
103
|
-
If you are using CodePipeline also, you may be wondering why not just use the provided Amazon ECS deployment action instead. It comes down to control. With a CodeBuild project, we have full control of how we want to build and deploy the Docker image to ECS.
|
104
|
-
|
105
|
-
Also, with the CodePipeline ECS deploy action, we are unable to configure a timeout. If the ECS deployment fails due to some reasons, we're stuck waiting 60 minutes for the pipeline timeout. There's a way to hack around this by literally overriding updating the CodeBuild project. You also must do it manually and are charged for the time if you don't notice it. With CodeBuild project, you can set the timeout value yourself. Essentially, you have more control with CodeBuild. There's some more info here: [CodePipeline ECS Deploy vs CodeBuild ufo ship](https://codepipeline.org/docs/ecs-deploy/).
|
106
|
-
|
107
|
-
{% include prev_next.md %}
|
data/docs/_docs/examples/jets.md
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Jets
|
3
|
-
nav_text: Jets
|
4
|
-
categories: example
|
5
|
-
nav_order: 17
|
6
|
-
---
|
7
|
-
|
8
|
-
This example shows to deploy a [Jets](https://rubyonjets.com/) application with codebuild to AWS Lambda.
|
9
|
-
|
10
|
-
Here's the project DSL.
|
11
|
-
|
12
|
-
.codebuild/project.rb:
|
13
|
-
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
github_url("https://github.com/tongueroo/jets-codebuild")
|
17
|
-
linux_image("timbru31/ruby-node:2.5") # currently must used ruby 2.5 for Lambda
|
18
|
-
environment_variables(
|
19
|
-
JETS_ENV: Codebuild.env,
|
20
|
-
)
|
21
|
-
```
|
22
|
-
|
23
|
-
The [.codebuild/project.rb](https://github.com/tongueroo/jets-codebuild/blob/master/.codebuild/project.rb) uses a Docker image that has Ruby, Node, and Yarn already installed. If you prefer to use another image, update the `linux_image` setting, and update your `buildspec.yml` accordingly. For example, you may need to install the necessary packages.
|
24
|
-
|
25
|
-
Here's the buildspec:
|
26
|
-
|
27
|
-
.codebuild/buildspec.yml
|
28
|
-
|
29
|
-
```yaml
|
30
|
-
version: 0.2
|
31
|
-
|
32
|
-
phases:
|
33
|
-
install:
|
34
|
-
commands:
|
35
|
-
- apt-get update -y
|
36
|
-
- apt-get install -y rsync zip
|
37
|
-
build:
|
38
|
-
commands:
|
39
|
-
- echo Build started on `date`
|
40
|
-
- sed -i '/BUNDLED WITH/Q' Gemfile.lock # hack to fix bundler issue: allow different versions of bundler to work
|
41
|
-
- bundle
|
42
|
-
- JETS_ENV=test bundle exec rspec
|
43
|
-
post_build:
|
44
|
-
commands:
|
45
|
-
- bash -c 'if [ "$CODEBUILD_BUILD_SUCCEEDING" == "0" ]; then exit 1; fi'
|
46
|
-
- export JETS_AGREE=yes
|
47
|
-
- bundle exec jets deploy $JETS_ENV
|
48
|
-
|
49
|
-
```
|
50
|
-
|
51
|
-
And here are the IAM permissions required as described in [Jets Minimal IAM Deploy Policy](https://rubyonjets.com/docs/extras/minimal-deploy-iam/).
|
52
|
-
|
53
|
-
.codebuild/role.rb:
|
54
|
-
|
55
|
-
```ruby
|
56
|
-
iam_policy(
|
57
|
-
"apigateway",
|
58
|
-
"cloudformation",
|
59
|
-
"dynamodb",
|
60
|
-
"events",
|
61
|
-
"iam",
|
62
|
-
"lambda",
|
63
|
-
"logs",
|
64
|
-
"route53",
|
65
|
-
"s3",
|
66
|
-
"ssm",
|
67
|
-
)
|
68
|
-
```
|
69
|
-
|
70
|
-
Here's also Github repo with CodeBuild examples with Jets: [tongueroo/jets-codebuild](https://github.com/tongueroo/jets-codebuild). The example on the master branch is a similar simple approach with 1 CodeBuild project.
|
71
|
-
|
72
|
-
You may be interested in the [separate-unit-and-deploy branch](https://github.com/tongueroo/jets-codebuild/tree/separate-unit-and-deploy). The example shows how to set up 2 separate CodeBuild projects. Some advantages:
|
73
|
-
|
74
|
-
* The projects are decoupled and you can run them separately.
|
75
|
-
* Only the deploy project requires IAM access to create the AWS resources.
|
76
|
-
|
77
|
-
{% include examples-steps.md %}
|
78
|
-
|
79
|
-
{% include prev_next.md %}
|
data/docs/_docs/examples/ruby.md
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Ruby
|
3
|
-
nav_text: Ruby
|
4
|
-
categories: example
|
5
|
-
nav_order: 18
|
6
|
-
---
|
7
|
-
|
8
|
-
This examples show to run Ruby unit tests.
|
9
|
-
|
10
|
-
Here's the project DSL.
|
11
|
-
|
12
|
-
.codebuild/project.rb:
|
13
|
-
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
github_url("https://github.com/username/repo")
|
17
|
-
linux_image("aws/codebuild/ruby:2.5.3-1.7.0")
|
18
|
-
environment_variables(
|
19
|
-
JETS_ENV: Codebuild.env,
|
20
|
-
)
|
21
|
-
```
|
22
|
-
|
23
|
-
Here's the buildspec:
|
24
|
-
|
25
|
-
.codebuild/buildspec.yml
|
26
|
-
|
27
|
-
```yaml
|
28
|
-
version: 0.2
|
29
|
-
|
30
|
-
phases:
|
31
|
-
install:
|
32
|
-
commands:
|
33
|
-
- apt-get update -y && apt-get install -y rsync
|
34
|
-
build:
|
35
|
-
commands:
|
36
|
-
- echo Build started on `date`
|
37
|
-
- sed -i '/BUNDLED WITH/Q' Gemfile.lock # hack to fix bundler issue: allow different versions of bundler to work
|
38
|
-
- bundle
|
39
|
-
- JETS_ENV=test bundle exec rspec
|
40
|
-
```
|
41
|
-
|
42
|
-
{% include examples-steps.md %}
|
43
|
-
|
44
|
-
{% include prev_next.md %}
|
data/docs/_docs/github_oauth.md
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: GitHub Oauth Token
|
3
|
-
nav_order: 10
|
4
|
-
---
|
5
|
-
|
6
|
-
This page covers how to set up the GitHub oauth token that CodeBuild uses.
|
7
|
-
|
8
|
-
CloudFormation docs has an oauth token property as part of the CloudFormation template source property under [AWS CodeBuild Project SourceAuth](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-sourceauth.html). It does not seem to work though.
|
9
|
-
|
10
|
-
|
11
|
-
Note: Am hoping that have either tested this incorrectly or that AWS fixes the bug.
|
12
|
-
|
13
|
-
Instead, this guide [Using Access Tokens with Your Source Provider in CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/sample-access-tokens.html) with [aws codebuild import-source-credentials](https://docs.aws.amazon.com/cli/latest/reference/codebuild/import-source-credentials.html) works.
|
14
|
-
|
15
|
-
## Create the GitHub Oauth Token
|
16
|
-
|
17
|
-
Here are the steps to create a GitHub oauth token:
|
18
|
-
|
19
|
-
1. Go to GitHub
|
20
|
-
2. Settings
|
21
|
-
3. Developer Settings
|
22
|
-
4. Personal access tokens
|
23
|
-
|
24
|
-
IMPORTANT: If using webhook, the oauth token needs `admin:repo_hook` also. To check this, you can log into the github, go to the repo, and see if you have access to the "Settings" tab.
|
25
|
-
|
26
|
-
![](https://raw.githubusercontent.com/tongueroo/codebuild/master/img/github-admin-settings-tab.png)
|
27
|
-
|
28
|
-
## Commands
|
29
|
-
|
30
|
-
Here's a guide to using the `import-source-credentials` commands.
|
31
|
-
|
32
|
-
First, save the GitHub oauth token to parameter store, in case we need it in the future.
|
33
|
-
|
34
|
-
aws ssm put-parameter --name /codebuild/github/oauth_token --value secret-token-value --type SecureString
|
35
|
-
|
36
|
-
Import the source credential into codebuild.
|
37
|
-
|
38
|
-
TOKEN=$(aws ssm get-parameter --name /codebuild/github/oauth_token --with-decryption | jq -r '.Parameter.Value')
|
39
|
-
cat > /tmp/codebuild-source-credentials.json <<EOL
|
40
|
-
{
|
41
|
-
"token": "$TOKEN",
|
42
|
-
"serverType": "GITHUB",
|
43
|
-
"authType": "PERSONAL_ACCESS_TOKEN"
|
44
|
-
}
|
45
|
-
EOL
|
46
|
-
aws codebuild import-source-credentials --cli-input-json file:///tmp/codebuild-source-credentials.json
|
47
|
-
aws codebuild list-source-credentials
|
48
|
-
|
49
|
-
Setting this sets the oauth token used by the CodeBuild projects.
|
50
|
-
|
51
|
-
{% include prev_next.md %}
|
data/docs/_docs/install.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Installation
|
3
|
-
nav_order: 3
|
4
|
-
---
|
5
|
-
|
6
|
-
## RubyGems
|
7
|
-
|
8
|
-
Install codebuild via RubyGems.
|
9
|
-
|
10
|
-
gem install codebuild
|
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 %}
|
data/docs/_docs/next-steps.md
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Next Steps
|
3
|
-
nav_order: 20
|
4
|
-
---
|
5
|
-
|
6
|
-
Hopefully, you have a good feel for how codebuild works now. From here, there are a few resources that can help you continue along:
|
7
|
-
|
8
|
-
* Check out the [codebuild](https://github.com/tongueroo/codebuild) repo on GitHub
|
9
|
-
* ⭐️ the codebuild project on GitHub
|
10
|
-
* Write a blog post about codebuild
|
11
|
-
* Post on your favorite discussion about codebuild
|
12
|
-
* Contribute a pull request
|
13
|
-
|
14
|
-
Everyone can contribute to making codebuild better, including the documentation. These docs are the codebuild repo located the [docs folder](https://github.com/tongueroo/codebuild/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 %}
|
data/docs/_docs/settings.md
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Settings
|
3
|
-
nav_order: 8
|
4
|
-
---
|
5
|
-
|
6
|
-
The `.codebuild/settings.yml` file can be used to adjust some of the behavior of the codebuild 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 `CB_ENV`.
|
21
|
-
|
22
|
-
## Example
|
23
|
-
|
24
|
-
cb deploy # will use the development settings since development is the default
|
25
|
-
CB_ENV=production cb deploy # will use the production settings
|
26
|
-
|
27
|
-
## Options
|
28
|
-
|
29
|
-
Name | Description
|
30
|
-
--- | ---
|
31
|
-
stack_naming.append_env | Determines if `CB_ENV` value is append to the CodeBuild project name.
|
32
|
-
aws_profile | This provides a way to bind CB_ENV to AWS_PROFILE tightly. This prevents you from forgetting to switch your CB_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
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Start
|
3
|
-
nav_order: 7
|
4
|
-
---
|
5
|
-
|
6
|
-
You can start a CodeBuild project with the `cb start` command. Here's an example:
|
7
|
-
|
8
|
-
$ cb start demo
|
9
|
-
Build started for project: demo
|
10
|
-
Please check the CodeBuild console for the status.
|
11
|
-
Codebuild Log Url:
|
12
|
-
https://us-west-2.console.aws.amazon.com/codesuite/codebuild/projects/demo/build/demo%3A7bc4cb33-d918-467a-9e09-fe7fe1f57ed8/log
|
13
|
-
$
|
14
|
-
|
15
|
-
If the project name is the same as the parent folder name then you can do this:
|
16
|
-
|
17
|
-
cd demo
|
18
|
-
cb start # demo is inferred from the parent folder
|
19
|
-
|
20
|
-
## Specifying Code Branch
|
21
|
-
|
22
|
-
If you would like start a build using a specific code branch you can use the `--branch` or `-b` option. Example:
|
23
|
-
|
24
|
-
cb start demo -b feature-branch
|
25
|
-
|
26
|
-
## AWS CLI Equivalent
|
27
|
-
|
28
|
-
The `cb start` command is a simple wrapper to the AWS API with the ruby sdk. You can also start codebuild projects with the `aws codebuild` cli. Here's the equivalent CLI command:
|
29
|
-
|
30
|
-
aws codebuild start-build --project-name demo --source-version master
|
31
|
-
|
32
|
-
## Types
|
33
|
-
|
34
|
-
If you are using multiple Codebuild projects with [Types]({% link _docs/type-option.md %}), you can start the specific CodeBuild project type with the `--type` option. Example:
|
35
|
-
|
36
|
-
cb start demo --type unit
|
37
|
-
|
38
|
-
## Override CodeBuild Environment Variables
|
39
|
-
|
40
|
-
You can override CodeBuild env variables at runtime with `--env-vars`. Examples:
|
41
|
-
|
42
|
-
cb start demo --type vpc --env-vars K1=v1 K2=v2
|
43
|
-
cb start demo --type vpc --env-vars K1=v1 K2=ssm:v2 # support for PARAMETER_STORE
|
44
|
-
|
45
|
-
Remember the environment variables are within the CodeBuild environment instance running the build script, not the application's environment.
|
46
|
-
|
47
|
-
## CLI Reference
|
48
|
-
|
49
|
-
Also, for help info you can check the [cb start]({% link _reference/cb-start.md %}) CLI reference.
|
50
|
-
|
51
|
-
{% include prev_next.md %}
|