codebuild 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +10 -2
  5. data/docs/.gitignore +4 -0
  6. data/docs/CNAME +1 -0
  7. data/docs/Gemfile +3 -0
  8. data/docs/LICENSE +21 -0
  9. data/docs/README.md +25 -0
  10. data/docs/_config.yml +73 -0
  11. data/docs/_docs/contributing.md +99 -0
  12. data/docs/_docs/conventions.md +51 -0
  13. data/docs/_docs/deploy.md +69 -0
  14. data/docs/_docs/dsl.md +12 -0
  15. data/docs/_docs/dsl/project.md +80 -0
  16. data/docs/{dsl → _docs/dsl}/role.md +39 -1
  17. data/docs/_docs/dsl/schedule.md +29 -0
  18. data/docs/_docs/examples.md +12 -0
  19. data/docs/_docs/examples/ecs.md +94 -0
  20. data/docs/_docs/examples/jets.md +68 -0
  21. data/docs/_docs/examples/ruby.md +44 -0
  22. data/docs/_docs/github_oauth.md +51 -0
  23. data/docs/_docs/install.md +14 -0
  24. data/docs/_docs/next-steps.md +16 -0
  25. data/docs/_docs/settings.md +34 -0
  26. data/docs/_docs/start.md +46 -0
  27. data/docs/_docs/type-option.md +72 -0
  28. data/docs/_docs/variables.md +90 -0
  29. data/docs/_includes/commands.html +86 -0
  30. data/docs/_includes/content.html +25 -0
  31. data/docs/_includes/edit-on-github.html +9 -0
  32. data/docs/_includes/footer.html +41 -0
  33. data/docs/_includes/google_analytics.html +10 -0
  34. data/docs/_includes/head.html +45 -0
  35. data/docs/_includes/js.html +18 -0
  36. data/docs/_includes/nav.html +17 -0
  37. data/docs/_includes/prev_next.md +19 -0
  38. data/docs/_includes/reference.md +1 -0
  39. data/docs/_includes/subnav.html +38 -0
  40. data/docs/_includes/tutorials.md +38 -0
  41. data/docs/_layouts/default.html +12 -0
  42. data/docs/_reference/codebuild-completion.md +44 -0
  43. data/docs/_reference/codebuild-completion_script.md +25 -0
  44. data/docs/_reference/codebuild-delete.md +26 -0
  45. data/docs/_reference/codebuild-deploy.md +58 -0
  46. data/docs/_reference/codebuild-init.md +87 -0
  47. data/docs/_reference/codebuild-start.md +43 -0
  48. data/docs/_reference/codebuild-version.md +21 -0
  49. data/docs/_sass/_bootstrap-overrides.scss +40 -0
  50. data/docs/_sass/_contact.scss +49 -0
  51. data/docs/_sass/_cta.scss +37 -0
  52. data/docs/_sass/_download.scss +31 -0
  53. data/docs/_sass/_features.scss +47 -0
  54. data/docs/_sass/_footer.scss +49 -0
  55. data/docs/_sass/_global.scss +102 -0
  56. data/docs/_sass/_main.scss +364 -0
  57. data/docs/_sass/_masthead.scss +70 -0
  58. data/docs/_sass/_mixins.scss +79 -0
  59. data/docs/_sass/_navbar.scss +92 -0
  60. data/docs/_sass/_syntax.scss +65 -0
  61. data/docs/_sass/_table.scss +34 -0
  62. data/docs/_sass/_timeline.scss +207 -0
  63. data/docs/_sass/_variables.scss +24 -0
  64. data/docs/bin/web +8 -0
  65. data/docs/docs.md +22 -0
  66. data/docs/favicon.ico +0 -0
  67. data/docs/img/docs/codebuild-output.png +0 -0
  68. data/docs/img/logos/boltops-logo-full.png +0 -0
  69. data/docs/img/logos/boltops-logo.png +0 -0
  70. data/docs/img/logos/project-logo.png +0 -0
  71. data/docs/index.html +35 -0
  72. data/docs/js/nav.js +39 -0
  73. data/docs/js/new-age.js +38 -0
  74. data/docs/js/new-age.min.js +6 -0
  75. data/docs/new-age.scss +20 -0
  76. data/docs/quick-start.md +72 -0
  77. data/docs/reference.md +12 -0
  78. data/docs/support.md +22 -0
  79. data/docs/vendor/bootstrap/css/bootstrap-grid.css +1339 -0
  80. data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +1 -0
  81. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +1 -0
  82. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +1 -0
  83. data/docs/vendor/bootstrap/css/bootstrap-reboot.css +459 -0
  84. data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +1 -0
  85. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +1 -0
  86. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +1 -0
  87. data/docs/vendor/bootstrap/css/bootstrap.css +9320 -0
  88. data/docs/vendor/bootstrap/css/bootstrap.css.map +1 -0
  89. data/docs/vendor/bootstrap/css/bootstrap.min.css +6 -0
  90. data/docs/vendor/bootstrap/css/bootstrap.min.css.map +1 -0
  91. data/docs/vendor/bootstrap/js/bootstrap.js +3535 -0
  92. data/docs/vendor/bootstrap/js/bootstrap.min.js +7 -0
  93. data/docs/vendor/font-awesome/css/font-awesome.css +2337 -0
  94. data/docs/vendor/font-awesome/css/font-awesome.min.css +4 -0
  95. data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  96. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  97. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  98. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  99. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  100. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  101. data/docs/vendor/font-awesome/less/animated.less +34 -0
  102. data/docs/vendor/font-awesome/less/bordered-pulled.less +25 -0
  103. data/docs/vendor/font-awesome/less/core.less +12 -0
  104. data/docs/vendor/font-awesome/less/fixed-width.less +6 -0
  105. data/docs/vendor/font-awesome/less/font-awesome.less +18 -0
  106. data/docs/vendor/font-awesome/less/icons.less +789 -0
  107. data/docs/vendor/font-awesome/less/larger.less +13 -0
  108. data/docs/vendor/font-awesome/less/list.less +19 -0
  109. data/docs/vendor/font-awesome/less/mixins.less +60 -0
  110. data/docs/vendor/font-awesome/less/path.less +15 -0
  111. data/docs/vendor/font-awesome/less/rotated-flipped.less +20 -0
  112. data/docs/vendor/font-awesome/less/screen-reader.less +5 -0
  113. data/docs/vendor/font-awesome/less/stacked.less +20 -0
  114. data/docs/vendor/font-awesome/less/variables.less +799 -0
  115. data/docs/vendor/font-awesome/scss/_animated.scss +34 -0
  116. data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +25 -0
  117. data/docs/vendor/font-awesome/scss/_core.scss +12 -0
  118. data/docs/vendor/font-awesome/scss/_fixed-width.scss +6 -0
  119. data/docs/vendor/font-awesome/scss/_icons.scss +789 -0
  120. data/docs/vendor/font-awesome/scss/_larger.scss +13 -0
  121. data/docs/vendor/font-awesome/scss/_list.scss +19 -0
  122. data/docs/vendor/font-awesome/scss/_mixins.scss +60 -0
  123. data/docs/vendor/font-awesome/scss/_path.scss +15 -0
  124. data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +20 -0
  125. data/docs/vendor/font-awesome/scss/_screen-reader.scss +5 -0
  126. data/docs/vendor/font-awesome/scss/_stacked.scss +20 -0
  127. data/docs/vendor/font-awesome/scss/_variables.scss +799 -0
  128. data/docs/vendor/font-awesome/scss/font-awesome.scss +18 -0
  129. data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +59 -0
  130. data/docs/vendor/jquery-easing/jquery.easing.js +166 -0
  131. data/docs/vendor/jquery-easing/jquery.easing.min.js +1 -0
  132. data/docs/vendor/jquery/jquery.js +10253 -0
  133. data/docs/vendor/jquery/jquery.min.js +4 -0
  134. data/docs/vendor/simple-line-icons/css/simple-line-icons.css +778 -0
  135. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
  136. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +200 -0
  137. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
  138. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
  139. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
  140. data/docs/vendor/simple-line-icons/less/simple-line-icons.less +982 -0
  141. data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +979 -0
  142. data/docs/vendor/tether/tether.js +1811 -0
  143. data/docs/vendor/tether/tether.min.js +1 -0
  144. data/exe/cb +1 -1
  145. data/exe/codebuild +1 -1
  146. data/lib/codebuild.rb +0 -1
  147. data/lib/codebuild/aws_services/helpers.rb +1 -1
  148. data/lib/codebuild/cli.rb +2 -1
  149. data/lib/codebuild/core.rb +2 -2
  150. data/lib/codebuild/dsl/project.rb +3 -3
  151. data/lib/codebuild/help/init.md +38 -2
  152. data/lib/codebuild/help/start.md +7 -1
  153. data/lib/codebuild/init.rb +19 -9
  154. data/lib/codebuild/project.rb +3 -2
  155. data/lib/codebuild/role.rb +2 -0
  156. data/lib/codebuild/schedule.rb +5 -0
  157. data/lib/codebuild/setting.rb +2 -3
  158. data/lib/codebuild/stack.rb +25 -0
  159. data/lib/codebuild/start.rb +22 -3
  160. data/lib/codebuild/variables.rb +17 -0
  161. data/lib/codebuild/version.rb +1 -1
  162. data/lib/template/{.codebuild → project}/buildspec.yml +7 -7
  163. data/lib/template/{.codebuild → project}/project.rb.tt +8 -0
  164. data/lib/template/{.codebuild → project}/role.rb +0 -0
  165. data/lib/template/project/schedule.rb +3 -0
  166. data/lib/template/top/settings.yml +9 -0
  167. data/lib/template/top/variables/base.rb +1 -0
  168. data/lib/template/top/variables/development.rb +1 -0
  169. data/lib/template/top/variables/production.rb +1 -0
  170. metadata +150 -11
  171. data/docs/dsl/project.md +0 -46
  172. data/docs/dsl/schedule.md +0 -12
  173. data/docs/github_oauth.md +0 -39
  174. data/docs/type.md +0 -39
  175. data/lib/template/.codebuild/settings.yml +0 -13
@@ -1,4 +1,40 @@
1
- # IAM Role DSL
1
+ ---
2
+ title: Role DSL
3
+ nav_text: Role
4
+ categories: dsl
5
+ nav_order: 13
6
+ ---
7
+
8
+ The codebuild tool can create the IAM service role associated with the codebuild project. Here's an example:
9
+
10
+ .codebuild/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
+ ## Full DSL
2
38
 
3
39
  The convenience methods merely wrap properties of the [AWS::IAM::Role
4
40
  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.
@@ -33,3 +69,5 @@ policies([{
33
69
  }
34
70
  }])
35
71
  ```
72
+
73
+ {% include prev_next.md %}
@@ -0,0 +1,29 @@
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 %}
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Examples
3
+ nav_order: 15
4
+ ---
5
+
6
+ <ul>
7
+ {% assign docs = site.docs | where: "categories","example" %} {% for doc in docs -%}
8
+ <li><a href='{{doc.url}}'>{{doc.nav_text}}</a></li>
9
+ {% endfor %}
10
+ </ul>
11
+
12
+ {% include prev_next.md %}
@@ -0,0 +1,94 @@
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
+ Last, here's the IAM Policy that will give CodeBuild the IAM permissions necessary to create the ECS service and other resources that ufo can create:
53
+
54
+ .codebuild/role.rb:
55
+
56
+
57
+ ```ruby
58
+ iam_policy(
59
+ "cloudformation",
60
+ "ec2",
61
+ "ecr",
62
+ "ecs",
63
+ "elasticloadbalancing",
64
+ "elasticloadbalancingv2",
65
+ "logs",
66
+ "route53",
67
+ "ssm",
68
+ {
69
+ "Action": [
70
+ "iam:PassRole"
71
+ ],
72
+ "Effect": "Allow",
73
+ "Resource": "*",
74
+ "Condition": {
75
+ "StringLike": {
76
+ "iam:PassedToService": [
77
+ "ecs-tasks.amazonaws.com"
78
+ ]
79
+ }
80
+ }
81
+ }
82
+ )
83
+ managed_iam_policy("AmazonS3ReadOnlyAccess") # optional but common to need read only access to s3
84
+ ```
85
+
86
+ 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.
87
+
88
+ ## CodePipeline ECS Deploy Action
89
+
90
+ 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.
91
+
92
+ 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. With CodeBuild project, you can set the timeout value yourself. Essentially, you have more control with CodeBuild.
93
+
94
+ {% include prev_next.md %}
@@ -0,0 +1,68 @@
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-hello-examples")
17
+ linux_image("aws/codebuild/ruby:2.5.3-1.7.0") # currently must used ruby 2.5
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 # prequisite for jets
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
+ - gem install bundler:1.16.6
39
+ - export JETS_ENV=test
40
+ - bundle
41
+ - bundle exec rspec
42
+ post_build:
43
+ commands:
44
+ - bash -c 'if [ "$CODEBUILD_BUILD_SUCCEEDING" == "0" ]; then exit 1; fi'
45
+ - export JETS_AGREE=yes
46
+ - bundle exec jets deploy $JETS_ENV
47
+ ```
48
+
49
+ And here are the IAM permissions required as described in [Jets Minimal IAM Deploy Policy](https://rubyonjets.com/docs/extras/minimal-deploy-iam/).
50
+
51
+ .codebuild/role.rb:
52
+
53
+ ```ruby
54
+ iam_policy(
55
+ "apigateway",
56
+ "cloudformation",
57
+ "dynamodb",
58
+ "events",
59
+ "iam",
60
+ "lambda",
61
+ "logs",
62
+ "route53",
63
+ "s3",
64
+ "ssm",
65
+ )
66
+ ```
67
+
68
+ {% include prev_next.md %}
@@ -0,0 +1,44 @@
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 # prequisite for jets
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
+ - gem install bundler:1.16.6
39
+ - export JETS_ENV=test
40
+ - bundle
41
+ - bundle exec rspec
42
+ ```
43
+
44
+ {% include prev_next.md %}
@@ -0,0 +1,51 @@
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 %}
@@ -0,0 +1,14 @@
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 %}
@@ -0,0 +1,16 @@
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 %}
@@ -0,0 +1,34 @@
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 %}
@@ -0,0 +1,46 @@
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
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
+ ## 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
+ cb start -b feature-branch
20
+
21
+ ## AWS CLI Equivalent
22
+
23
+ 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:
24
+
25
+ aws codebuild start-build --project-name demo --source-version master
26
+
27
+ ## Types
28
+
29
+ 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:
30
+
31
+ cb start --type unit
32
+
33
+ ## Override CodeBuild Environment Variables
34
+
35
+ You can override CodeBuild env variables at runtime with `--env-vars`. Examples:
36
+
37
+ cb start --type vpc --env-vars K1=v1 K2=v2
38
+ cb start --type vpc --env-vars K1=v1 K2=ssm:v2 # support for PARAMETER_STORE
39
+
40
+ Remember the environment variables are within the CodeBuild environment instance running the build script, not the application's environment.
41
+
42
+ ## CLI Reference
43
+
44
+ Also, for help info you can check the [cb start]({% link _reference/codebuild-start.md %}) CLI reference.
45
+
46
+ {% include prev_next.md %}