codebuild 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a61acb91b1f2eb181094bd20117879da0219931178fec03054f930f06cf3fd4a
4
- data.tar.gz: 9c462974ca5f372d437f490a44a88763373f852aca75c727bfcf58e9f853f599
3
+ metadata.gz: 7cce7e14c55b16c76ad7c5ca3fe53d49c6a0ea53e0a776796d0461ca59a06c79
4
+ data.tar.gz: c80068ba1f03a19223e75e5a99a89f75b9ecc383673dcb2a49a2e74c696224ce
5
5
  SHA512:
6
- metadata.gz: 30a6738433fb64cd50b2237f6f7a8d78c3dcd9bc281b836eed6f869bb295d462f0778499e17c79adb06031af8908d2c89581fef74d49cb59d08026e50b18adc4
7
- data.tar.gz: dd6342bfdfb19de9a91c16736b3a2edf939b7bd05e72675797f22777d0c6c44171cf960c225b4f0c97ac35294f177291c9a1b45fb872f70a08ce68c940fe0bc7
6
+ metadata.gz: 189737112a90fcc408a49b3fbc044062f1b92e8ab89a735108e822bcbeabbd0fa95a67aba1d86e03ee69d95ab8d91dc752e7eb03c7a70160424c60be8820657d
7
+ data.tar.gz: 951a796d4c4611704b23e5771dc4b0a669ee2858c1fcd22533f5373c71d3f7bfe149bae1a76c2e14b3233fe3af74389df9320f37ce37594c01003ba579ada06e
@@ -1,16 +1,4 @@
1
- # For methods, refer to the properties of the CloudFormation CodeBuild::Project https://amzn.to/2UTeNlr
2
- # For convenience methods, refer to the source https://github.com/tongueroo/codebuild/blob/master/lib/codebuild/dsl/project.rb
3
-
4
- # Note: for the oauth_token, you have to set this parameter in ssm parameter store
5
- # One way to create an GitHub oauth token:
6
- # Go to GitHub / Settings / Developer Settings / Personal access tokens
7
- # If using webhook, the oauth token needs admin:repo_hook
8
-
9
- name("codebuild")
10
1
  github_url("https://github.com/tongueroo/codebuild")
11
2
  linux_image("aws/codebuild/ruby:2.5.3-1.7.0")
12
- environment_variables(
13
- JETS_ENV: "test",
14
- )
15
3
  triggers(webhook: true)
16
4
  local_cache(false)
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.6.2]
7
+ - add s3 read-only access to default role
8
+ - fix settings
9
+
6
10
  ## [0.6.1]
7
11
  - cb init: no variables by default
8
12
  - fix handle rollback
data/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # Codebuild
2
2
 
3
3
  ![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiSUFzNE9RV3ROWmNKOHh2NG1wTjNmRlV4dnlOTnVrK3U2UFMrOEJRUGE2WS9mcjRWS0o1bjdSZlN5bG1tR1YyYVFlNkErTGdkbThsWExUaVJvWU1PRUY4PSIsIml2UGFyYW1ldGVyU3BlYyI6InppWWxJRGFiWHN1bEtYSzIiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
4
+ [![Gem Version](https://badge.fury.io/rb/codebuild.png)](http://badge.fury.io/rb/codebuild)
4
5
 
5
6
  The codebuild tool provides a DSL to create a CodeBuild project with some reasonable defaults.
6
7
 
7
8
  The codebuild tool installs `cb` and `codebuild` executables. Both of them do the same thing, `cb` is just shorter to type.
8
9
 
10
+ The documentation site is at: [codebuild.cloud](https://codebuild.cloud/)
11
+
9
12
  ## Quick Start
10
13
 
11
14
  cb init
@@ -14,7 +17,7 @@ The codebuild tool installs `cb` and `codebuild` executables. Both of them do th
14
17
 
15
18
  ## Private Repo
16
19
 
17
- IMPORTANT: Before deploying, if you are using a private repo, use [aws codebuild import-source-credentials](https://docs.aws.amazon.com/cli/latest/reference/codebuild/import-source-credentials.html) to add credentials so that codebuild can clone down the repo. Refer to [github_oauth.md](readme/github_oauth.md) for more info.
20
+ IMPORTANT: Before deploying, if you are using a private repo, use [aws codebuild import-source-credentials](https://docs.aws.amazon.com/cli/latest/reference/codebuild/import-source-credentials.html) to add credentials so that codebuild can clone down the repo. Refer to the [CodeBuilld Github Oauth/](https://codebuild.cloud/docs/github_oauth/) for more info.
18
21
 
19
22
  ## Usage
20
23
 
data/Rakefile CHANGED
@@ -9,5 +9,5 @@ require_relative "lib/codebuild"
9
9
  require "cli_markdown"
10
10
  desc "Generates cli reference docs as markdown"
11
11
  task :docs do
12
- CliMarkdown::Creator.create_all(cli_class: Codebuild::CLI, cli_name: "codebuild")
12
+ CliMarkdown::Creator.create_all(cli_class: Codebuild::CLI, cli_name: "cb")
13
13
  end
@@ -28,7 +28,7 @@ The CodeBuild project is named `my-project-unit`.
28
28
 
29
29
  ## CB_ENV_EXTRA
30
30
 
31
- The `CB_ENV_EXTRA` also affects the name of the CodeBuild project. It gets appened after the type option.
31
+ The `CB_ENV_EXTRA` also affects the name of the CodeBuild project. It gets appended after the type option.
32
32
 
33
33
  CB_ENV_EXTRA=2 cb deploy my-project --type unit
34
34
 
@@ -64,6 +64,6 @@ Likewise `cb deploy PROJECT_NAME --type unit` would result in:
64
64
  .codebuild/unit/project.rb
65
65
  .codebuild/unit/role.rb
66
66
 
67
- Also, for help info you can check the [cb deploy]({% link _reference/codebuild-deploy.md %}) CLI reference.
67
+ Also, for help info you can check the [cb deploy]({% link _reference/cb-deploy.md %}) CLI reference.
68
68
 
69
69
  {% include prev_next.md %}
@@ -34,6 +34,12 @@ You can also create managed IAM policy.
34
34
  managed_iam_policy("AmazonS3ReadOnlyAccess")
35
35
  ```
36
36
 
37
+ You can also add multiple managed IAM policies:
38
+
39
+ ```ruby
40
+ managed_iam_policy("AmazonS3ReadOnlyAccess", "AmazonEC2ReadOnlyAccess")
41
+ ```
42
+
37
43
  ## Full DSL
38
44
 
39
45
  The convenience methods merely wrap properties of the [AWS::IAM::Role
@@ -41,6 +41,6 @@ Remember the environment variables are within the CodeBuild environment instance
41
41
 
42
42
  ## CLI Reference
43
43
 
44
- Also, for help info you can check the [cb start]({% link _reference/codebuild-start.md %}) CLI reference.
44
+ Also, for help info you can check the [cb start]({% link _reference/cb-start.md %}) CLI reference.
45
45
 
46
46
  {% include prev_next.md %}
@@ -38,11 +38,14 @@ cb delete
38
38
  <h3>Usage</h3>
39
39
  <div class="commands">
40
40
  {% highlight sh %}
41
- cb deploy # infers the CloudFormation name from the parent folder
41
+ cb deploy # infers the project name from the parent folder
42
42
  cb deploy project-name # explicitly specify project name
43
43
 
44
- cb start # infers the name from the parent folder
44
+ cb start # infers the project name from the parent folder
45
45
  cb start demo-project # looks up project via CodeBuild project name
46
+
47
+ cb deploy demo --type unit # different codebuild project types
48
+ cb start demo --type unit
46
49
  {% endhighlight %}
47
50
  </div>
48
51
  </div>
@@ -13,6 +13,3 @@
13
13
  {% if site.google_analytics and jekyll.environment == "production" %}
14
14
  {% include google_analytics.html %}
15
15
  {% endif %}
16
-
17
- <div id="codefund"><!-- fallback content --></div>
18
- <script src="https://codefund.app/properties/177/funder.js" async="async"></script>
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild completion
2
+ title: cb completion
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild completion *PARAMS
8
+ cb completion *PARAMS
9
9
 
10
10
  ## Description
11
11
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild completion_script
2
+ title: cb completion_script
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild completion_script
8
+ cb completion_script
9
9
 
10
10
  ## Description
11
11
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild delete
2
+ title: cb delete
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild delete
8
+ cb delete
9
9
 
10
10
  ## Description
11
11
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild deploy
2
+ title: cb deploy
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild deploy
8
+ cb deploy
9
9
 
10
10
  ## Description
11
11
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild init
2
+ title: cb init
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild init
8
+ cb init
9
9
 
10
10
  ## Description
11
11
 
@@ -81,6 +81,7 @@ If you would like to use a local template that is not on GitHub, then created a
81
81
  [--template=TEMPLATE] # Custom template to use
82
82
  [--template-mode=TEMPLATE_MODE] # Template mode: replace or additive
83
83
  [--type=TYPE] # Type option creates a subfolder under .codebuild
84
+ [--variables], [--no-variables] # Create variables starter files
84
85
  [--verbose], [--no-verbose]
85
86
  [--noop], [--no-noop]
86
87
  ```
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild start
2
+ title: cb start
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild start
8
+ cb start
9
9
 
10
10
  ## Description
11
11
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: codebuild version
2
+ title: cb version
3
3
  reference: true
4
4
  ---
5
5
 
6
6
  ## Usage
7
7
 
8
- codebuild version
8
+ cb version
9
9
 
10
10
  ## Description
11
11
 
@@ -12,7 +12,7 @@ In a hurry? No problem! Here's a quick start to get going.
12
12
  cb init # generates starter .codebuild files
13
13
  # edit .codebuild/buildspec.yml
14
14
  cb deploy # create the CodeBuild project via CloudFormation
15
- cb start # start a CodeBuild project. Runs the buildspec.ym
15
+ cb start # start a CodeBuild project. Runs the buildspec.yml
16
16
 
17
17
  ## What Happened?
18
18
 
@@ -3,10 +3,10 @@ title: CLI Reference
3
3
  ---
4
4
  {% include reference.md %}
5
5
 
6
- * [codebuild completion]({% link _reference/codebuild-completion.md %})
7
- * [codebuild completion_script]({% link _reference/codebuild-completion_script.md %})
8
- * [codebuild delete]({% link _reference/codebuild-delete.md %})
9
- * [codebuild deploy]({% link _reference/codebuild-deploy.md %})
10
- * [codebuild init]({% link _reference/codebuild-init.md %})
11
- * [codebuild start]({% link _reference/codebuild-start.md %})
12
- * [codebuild version]({% link _reference/codebuild-version.md %})
6
+ * [cb completion]({% link _reference/cb-completion.md %})
7
+ * [cb completion_script]({% link _reference/cb-completion_script.md %})
8
+ * [cb delete]({% link _reference/cb-delete.md %})
9
+ * [cb deploy]({% link _reference/cb-deploy.md %})
10
+ * [cb init]({% link _reference/cb-init.md %})
11
+ * [cb start]({% link _reference/cb-start.md %})
12
+ * [cb version]({% link _reference/cb-version.md %})
@@ -32,10 +32,11 @@ module Codebuild
32
32
  return if ENV['TEST']
33
33
  return unless File.exist?("#{Codebuild.root}/.codebuild/settings.yml") # for rake docs
34
34
  return unless settings # Only load if within Codebuild project and there's a settings.yml
35
- data = settings[Codebuild.env] || {}
36
- if data["aws_profile"]
37
- puts "Using AWS_PROFILE=#{data["aws_profile"]} from CB_ENV=#{Codebuild.env} in config/settings.yml"
38
- ENV['AWS_PROFILE'] = data["aws_profile"]
35
+
36
+ data = settings || {}
37
+ if data[:aws_profile]
38
+ puts "Using AWS_PROFILE=#{data[:aws_profile]} from CB_ENV=#{Codebuild.env} in config/settings.yml"
39
+ ENV['AWS_PROFILE'] = data[:aws_profile]
39
40
  end
40
41
  end
41
42
 
@@ -25,6 +25,7 @@ module Codebuild
25
25
  end
26
26
 
27
27
  def find_stack(stack_name)
28
+ return if ENV['TEST']
28
29
  resp = cfn.describe_stacks(stack_name: stack_name)
29
30
  resp.stacks.first
30
31
  rescue Aws::CloudFormation::Errors::ValidationError => e
@@ -24,7 +24,11 @@ module Codebuild
24
24
  }
25
25
  }]
26
26
 
27
- @properties[:managed_policy_arns] = @managed_policy_arns if @managed_policy_arns && !@managed_policy_arns.empty?
27
+ if @managed_policy_arns && !@managed_policy_arns.empty?
28
+ @properties[:managed_policy_arns] = @managed_policy_arns
29
+ else
30
+ @properties[:managed_policy_arns] = default_managed_policy_arns
31
+ end
28
32
 
29
33
  resource = {
30
34
  IamRole: {
@@ -74,5 +78,10 @@ module Codebuild
74
78
  resource: "*"
75
79
  }]
76
80
  end
81
+
82
+ def default_managed_policy_arns
83
+ # Useful when using with CodePipeline
84
+ ["arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess"]
85
+ end
77
86
  end
78
87
  end
@@ -1,3 +1,3 @@
1
1
  module Codebuild
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -1,12 +1,7 @@
1
1
  describe Codebuild::CLI do
2
2
  before(:all) do
3
3
  @args = "--noop"
4
- @old_root = Dir.pwd
5
- Dir.chdir("spec/fixtures/app")
6
- @codebuild_bin = "../../../exe/codebuild"
7
- end
8
- after(:all) do
9
- Dir.chdir(@old_root)
4
+ @codebuild_bin = "exe/codebuild"
10
5
  end
11
6
 
12
7
  describe "codebuild" do
@@ -4,6 +4,12 @@ ENV["TEST"] = "1"
4
4
  # require 'simplecov'
5
5
  # SimpleCov.start
6
6
 
7
+ # Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
8
+ ENV['HOME'] = File.join(Dir.pwd,'spec/fixtures/home')
9
+
10
+ ENV['CB_ROOT'] = "spec/fixtures/app"
11
+
12
+
7
13
  require "pp"
8
14
  require "byebug"
9
15
  root = File.expand_path("../", File.dirname(__FILE__))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2019-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -267,13 +267,13 @@ files:
267
267
  - docs/_includes/subnav.html
268
268
  - docs/_includes/tutorials.md
269
269
  - docs/_layouts/default.html
270
- - docs/_reference/codebuild-completion.md
271
- - docs/_reference/codebuild-completion_script.md
272
- - docs/_reference/codebuild-delete.md
273
- - docs/_reference/codebuild-deploy.md
274
- - docs/_reference/codebuild-init.md
275
- - docs/_reference/codebuild-start.md
276
- - docs/_reference/codebuild-version.md
270
+ - docs/_reference/cb-completion.md
271
+ - docs/_reference/cb-completion_script.md
272
+ - docs/_reference/cb-delete.md
273
+ - docs/_reference/cb-deploy.md
274
+ - docs/_reference/cb-init.md
275
+ - docs/_reference/cb-start.md
276
+ - docs/_reference/cb-version.md
277
277
  - docs/_sass/_bootstrap-overrides.scss
278
278
  - docs/_sass/_contact.scss
279
279
  - docs/_sass/_cta.scss