cody 1.0.1 → 1.0.5

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: 13988c2d00cdc267da97b361bc2345a39cdb4d9b4919c18c74643f5b545b5e18
4
- data.tar.gz: 33e6ac92deb5858b85fb85a68657a18dfb9a9a224b76bc8317dce62b3a1efb76
3
+ metadata.gz: 90a937e24f42e829b40d2ed3631bd95edda91340124ac0786d218e617fdcd1af
4
+ data.tar.gz: cbbdb195156c43bdbcb0e1e9edd41f3d71051f4897024e866d5e932fca249e53
5
5
  SHA512:
6
- metadata.gz: d6d0df76e76c60d4df42165020be8077d17318da0c077a90bbcf1f799b1fe7deed90c819061d610b3e8cba713c276ccca36da47fa5e91650301a271728f867c3
7
- data.tar.gz: a956e457a24eda488c74127005996d90282179c57d442fea5f87889bbefff2f2d23cd49e33a2d646fdd912b75beb417e2a7d3b0ad1dda7da76c8895d17f3957b
6
+ metadata.gz: 8a8bbfd5858f54eb8c878e5bdf8722d13ecda1e386f36a08a69cb709988e9332dc811bb5b3fd8e06a1f3091fd812e5b5add1ddf162687f8c84f8af540ccb1dc7
7
+ data.tar.gz: 17d1ad1e451779b7699f81704468d46cdd798cbdf438566671fa2ca224c1618078509e022eb27d24e6980b1be41de5f0f016db7abbd271d239125a93430d6e01
data/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ ## [1.0.5] - 2021-08-28
7
+ - add params overrides option
8
+ - docs: fix ecs permission, add iam:GetRole
9
+ - edge case: yaml has nothing but comments
10
+ - improve settings merge
11
+ - update vpc config exmaple with camelcase
12
+
13
+ ## [1.0.4] - 2021-01-08
14
+ - loosen activesupport version pin
15
+
16
+ ## [1.0.3] - 2021-01-08
17
+ - [#31](https://github.com/tongueroo/cody/pull/31) surface context message with error message for during provisioning fa…
18
+ - docs: update ci jets v3
19
+ - raise error option
20
+
21
+ ## [1.0.2]
22
+ - #30 Allow multiple git providers
23
+
6
24
  ## [1.0.1]
7
25
  - fix EventsRuleRole Service camelcase
8
26
 
data/README.md CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  [![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
11
11
 
12
+ Please **watch/star** this repo to help grow and support the project.
13
+
12
14
  Cody is an AWS CodeBuild Management Tool. Cody lets you create AWS CodeBuild projects with a beautiful DSL. The documentation site is at: [cody.run](https://cody.run/)
13
15
 
14
16
  ## Quick Start
data/cody.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "activesupport", "~> 6.0.0"
25
+ spec.add_dependency "activesupport"
26
26
  spec.add_dependency "aws-logs"
27
27
  spec.add_dependency "aws-mfa-secure"
28
28
  spec.add_dependency "aws-sdk-cloudformation"
@@ -15,6 +15,7 @@ class Cody::CLI
15
15
  source_version: source_version
16
16
  }
17
17
  params[:environment_variables_override] = environment_variables_override if @options[:env_vars]
18
+ params.merge!(@options[:overrides]) if @options[:overrides]
18
19
  resp = codebuild.start_build(params)
19
20
 
20
21
  puts "Build started for project: #{project_name}"
@@ -54,8 +55,13 @@ class Cody::CLI
54
55
  end
55
56
  resource.physical_resource_id # codebuild project name
56
57
  else
57
- puts "ERROR: Unable to find the codebuild project with either full_project_name: #{@full_project_name} or project_name: #{@project_name}".color(:red)
58
- exit 1
58
+ message = "ERROR: Unable to find the codebuild project with either full_project_name: #{@full_project_name} or project_name: #{@project_name}"
59
+ if @options[:raise_error]
60
+ raise(message)
61
+ else
62
+ puts message.color(:red)
63
+ exit 1
64
+ end
59
65
  end
60
66
  end
61
67
 
@@ -32,6 +32,16 @@ module Cody::Dsl
32
32
  @properties[:Source][:Location] = url
33
33
  end
34
34
 
35
+ # Convenience wrapper methods
36
+ def git_provider(type="GITHUB")
37
+ @properties[:Source][:Type] = type
38
+ end
39
+
40
+ # Convenience wrapper methods
41
+ def git_branch(branch_or_tag)
42
+ @properties[:SourceVersion] = branch_or_tag
43
+ end
44
+
35
45
  def buildspec(file=".cody/buildspec.yaml")
36
46
  @properties[:Source][:BuildSpec] = file
37
47
  end
@@ -49,14 +59,17 @@ module Cody::Dsl
49
59
 
50
60
  def github_source(options={})
51
61
  source = {
52
- Type: "GITHUB",
62
+ Type: options[:Type] || "GITHUB",
53
63
  Location: options[:Location],
54
64
  GitCloneDepth: 1,
55
65
  GitSubmodulesConfig: { fetch_submodules: true },
56
66
  BuildSpec: options[:BuildSpec] || ".cody/buildspec.yml", # options[:Buildspec] accounts for type already
57
- ReportBuildStatus: true,
58
67
  }
59
68
 
69
+ if source[:Type] =~ /GITHUB/
70
+ source[:ReportBuildStatus] = true
71
+ end
72
+
60
73
  if options[:OauthToken]
61
74
  source[:Auth] = {
62
75
  Type: "OAUTH",
data/lib/cody/project.rb CHANGED
@@ -53,7 +53,6 @@ module Cody
53
53
  # Type: "OAUTH",
54
54
  # # Resource: "", # required
55
55
  # },
56
- ReportBuildStatus: true,
57
56
  }
58
57
  }
59
58
  end
data/lib/cody/setting.rb CHANGED
@@ -25,7 +25,10 @@ module Cody
25
25
 
26
26
  all_envs = default.deep_merge(user.deep_merge(project))
27
27
  all_envs = merge_base(all_envs)
28
- data = all_envs[cb_env] || all_envs["base"] || {}
28
+
29
+ env_data = all_envs[cb_env] || {}
30
+ base_data = all_envs["base"] || {}
31
+ data = base_data.merge(env_data)
29
32
  data.deep_symbolize_keys
30
33
  end
31
34
  memoize :data
@@ -37,6 +40,7 @@ module Cody
37
40
  path = "#{cb_root}/.cody/settings.yml"
38
41
  if File.exist?(path)
39
42
  settings = YAML.load_file(path)
43
+ settings = {} unless settings.is_a?(Hash) # in case YAML has nothing but comments
40
44
  env = settings.find do |_env, section|
41
45
  section ||= {}
42
46
  ENV['AWS_PROFILE'] && ENV['AWS_PROFILE'] == section['aws_profile']
@@ -54,6 +58,7 @@ module Cody
54
58
 
55
59
  content = RenderMePretty.result(path)
56
60
  data = YAML.load(content)
61
+ data = {} unless data.is_a?(Hash) # in case YAML has nothing but comments
57
62
  # If key is is accidentally set to nil it screws up the merge_base later.
58
63
  # So ensure that all keys with nil value are set to {}
59
64
  data.each do |env, _setting|
data/lib/cody/tailer.rb CHANGED
@@ -54,6 +54,14 @@ module Cody
54
54
  puts "Failed Phases:"
55
55
  failed_phases.each do |phase|
56
56
  puts "#{phase.phase_type}: #{phase.phase_status.color(:red)}"
57
+ context = phase.contexts.last
58
+ if context # show error details: Unable to pull customer's container image https://gist.github.com/tongueroo/22e4ca3d4cde002108ff506eba9062f6
59
+ message = context.message
60
+ puts message
61
+ if message.include?("CannotPullContainerError") && message.include?("access denied")
62
+ puts "See: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-ecr.html"
63
+ end
64
+ end
57
65
  end
58
66
  end
59
67
 
data/lib/cody/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cody
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cody
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-09 00:00:00.000000000 Z
11
+ date: 2021-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-logs
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
387
387
  - !ruby/object:Gem::Version
388
388
  version: '0'
389
389
  requirements: []
390
- rubygems_version: 3.1.2
390
+ rubygems_version: 3.2.5
391
391
  signing_key:
392
392
  specification_version: 4
393
393
  summary: Cody provides a beautiful DSL to create and manage AWS CodeBuild projects