cody 0.9.6 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -9
- data/CHANGELOG.md +22 -0
- data/Gemfile +0 -2
- data/cody.gemspec +3 -3
- data/lib/cody.rb +4 -8
- data/lib/cody/aws_services.rb +1 -1
- data/lib/cody/aws_services/helpers.rb +20 -3
- data/lib/cody/cli.rb +4 -13
- data/lib/cody/{badge.rb → cli/badge.rb} +1 -1
- data/lib/cody/{base.rb → cli/base.rb} +9 -3
- data/lib/cody/{delete.rb → cli/delete.rb} +3 -3
- data/lib/cody/cli/deploy.rb +7 -0
- data/lib/cody/cli/help.rb +11 -0
- data/lib/cody/{help → cli/help}/deploy.md +0 -0
- data/lib/cody/{help → cli/help}/init.md +0 -0
- data/lib/cody/{help → cli/help}/logs.md +0 -0
- data/lib/cody/{help → cli/help}/start.md +0 -0
- data/lib/cody/{help → cli/help}/stop.md +0 -0
- data/lib/cody/{init.rb → cli/init.rb} +1 -2
- data/lib/cody/{list.rb → cli/list.rb} +23 -4
- data/lib/cody/{logs.rb → cli/logs.rb} +3 -2
- data/lib/cody/{sequence.rb → cli/sequence.rb} +3 -3
- data/lib/cody/{start.rb → cli/start.rb} +3 -3
- data/lib/cody/{status.rb → cli/status.rb} +2 -1
- data/lib/cody/{stop.rb → cli/stop.rb} +2 -1
- data/lib/cody/command.rb +11 -0
- data/lib/cody/core.rb +5 -5
- data/lib/cody/dsl/base.rb +9 -0
- data/lib/cody/dsl/project.rb +67 -49
- data/lib/cody/dsl/role.rb +11 -11
- data/lib/cody/dsl/schedule.rb +8 -8
- data/lib/cody/list/no_builds_project.rb +1 -1
- data/lib/cody/list/project.rb +3 -1
- data/lib/cody/project.rb +22 -23
- data/lib/cody/role.rb +20 -20
- data/lib/cody/schedule.rb +37 -37
- data/lib/cody/stack.rb +16 -71
- data/lib/cody/stack/base.rb +104 -0
- data/lib/cody/{create.rb → stack/create.rb} +2 -2
- data/lib/cody/{update.rb → stack/update.rb} +2 -2
- data/lib/cody/tailer.rb +1 -1
- data/lib/cody/version.rb +1 -1
- data/lib/template/project/buildspec.yml +1 -1
- data/lib/template/project/project.rb.tt +5 -19
- metadata +64 -70
- data/lib/cody/completer.rb +0 -159
- data/lib/cody/completer/script.rb +0 -6
- data/lib/cody/completer/script.sh +0 -10
- data/lib/cody/deploy.rb +0 -40
- data/lib/cody/help.rb +0 -9
- data/lib/cody/help/completion.md +0 -22
- data/lib/cody/help/completion_script.md +0 -3
- data/vendor/aws_data/CHANGELOG.md +0 -7
- data/vendor/aws_data/Gemfile +0 -4
- data/vendor/aws_data/LICENSE.txt +0 -21
- data/vendor/aws_data/README.md +0 -42
- data/vendor/aws_data/Rakefile +0 -6
- data/vendor/aws_data/aws_data.gemspec +0 -30
- data/vendor/aws_data/bin/console +0 -14
- data/vendor/aws_data/bin/setup +0 -8
- data/vendor/aws_data/lib/aws_data.rb +0 -91
- data/vendor/aws_data/lib/aws_data/version.rb +0 -3
- data/vendor/aws_data/spec/aws_data_spec.rb +0 -5
- data/vendor/aws_data/spec/spec_helper.rb +0 -14
- data/vendor/cfn-status/Gemfile +0 -4
- data/vendor/cfn-status/LICENSE.txt +0 -21
- data/vendor/cfn-status/README.md +0 -56
- data/vendor/cfn-status/Rakefile +0 -6
- data/vendor/cfn-status/bin/console +0 -14
- data/vendor/cfn-status/bin/setup +0 -8
- data/vendor/cfn-status/cfn-status.gemspec +0 -30
- data/vendor/cfn-status/lib/cfn/aws_service.rb +0 -56
- data/vendor/cfn-status/lib/cfn/status.rb +0 -220
- data/vendor/cfn-status/lib/cfn/status/version.rb +0 -5
- data/vendor/cfn-status/spec/cfn/status_spec.rb +0 -81
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +0 -1080
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +0 -1080
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +0 -1086
- data/vendor/cfn-status/spec/spec_helper.rb +0 -14
- data/vendor/cfn_camelizer/CHANGELOG.md +0 -10
- data/vendor/cfn_camelizer/Gemfile +0 -4
- data/vendor/cfn_camelizer/LICENSE.txt +0 -21
- data/vendor/cfn_camelizer/README.md +0 -40
- data/vendor/cfn_camelizer/Rakefile +0 -6
- data/vendor/cfn_camelizer/bin/console +0 -14
- data/vendor/cfn_camelizer/bin/setup +0 -8
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +0 -32
- data/vendor/cfn_camelizer/lib/camelizer.yml +0 -33
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +0 -92
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +0 -3
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +0 -79
- data/vendor/cfn_camelizer/spec/spec_helper.rb +0 -14
data/lib/cody/dsl/base.rb
CHANGED
@@ -7,5 +7,14 @@ module Cody::Dsl
|
|
7
7
|
@full_project_name = options[:full_project_name] # includes -development at the end
|
8
8
|
@properties = default_properties # defaults make project.rb simpler
|
9
9
|
end
|
10
|
+
|
11
|
+
# In v1.0.0 defaults to not auto-camelize
|
12
|
+
def auto_camelize(data)
|
13
|
+
if Cody.settings[:auto_camelize]
|
14
|
+
CfnCamelizer.transform(data)
|
15
|
+
else
|
16
|
+
data.deep_stringify_keys!
|
17
|
+
end
|
18
|
+
end
|
10
19
|
end
|
11
20
|
end
|
data/lib/cody/dsl/project.rb
CHANGED
@@ -3,35 +3,50 @@ module Cody::Dsl
|
|
3
3
|
include Ssm
|
4
4
|
|
5
5
|
PROPERTIES = %w[
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
Artifacts
|
7
|
+
BadgeEnabled
|
8
|
+
Cache
|
9
|
+
Description
|
10
|
+
EncryptionKey
|
11
|
+
Environment
|
12
|
+
LogsConfig
|
13
|
+
Name
|
14
|
+
QueuedTimeoutInMinutes
|
15
|
+
SecondaryArtifacts
|
16
|
+
SecondarySources
|
17
|
+
ServiceRole
|
18
|
+
Source
|
19
|
+
Tags
|
20
|
+
TimeoutInMinutes
|
21
|
+
Triggers
|
22
|
+
VpcConfig
|
23
23
|
]
|
24
24
|
PROPERTIES.each do |prop|
|
25
|
-
define_method(prop) do |v|
|
25
|
+
define_method(prop.underscore) do |v|
|
26
26
|
@properties[prop.to_sym] = v
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
# Convenience wrapper methods
|
31
31
|
def github_url(url)
|
32
|
-
@properties[:
|
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
|
+
|
45
|
+
def buildspec(file=".cody/buildspec.yaml")
|
46
|
+
@properties[:Source][:BuildSpec] = file
|
47
|
+
end
|
48
|
+
alias_method :build_spec, :buildspec
|
49
|
+
|
35
50
|
# So it looks like the auth resource property doesnt really get used.
|
36
51
|
# Instead an account level credential is worked. Refer to:
|
37
52
|
# https://github.com/tongueroo/cody/blob/master/readme/github_oauth.md
|
@@ -39,47 +54,50 @@ module Cody::Dsl
|
|
39
54
|
# Keeping this method around in case the CloudFormation method works one day,
|
40
55
|
# or end up figuring out to use it properly.
|
41
56
|
def github_token(token)
|
42
|
-
@properties[:
|
57
|
+
@properties[:Source][:Auth][:Resource] = token
|
43
58
|
end
|
44
59
|
|
45
60
|
def github_source(options={})
|
46
61
|
source = {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
report_build_status: true,
|
62
|
+
Type: options[:Type] || "GITHUB",
|
63
|
+
Location: options[:Location],
|
64
|
+
GitCloneDepth: 1,
|
65
|
+
GitSubmodulesConfig: { fetch_submodules: true },
|
66
|
+
BuildSpec: options[:BuildSpec] || ".cody/buildspec.yml", # options[:Buildspec] accounts for type already
|
53
67
|
}
|
54
68
|
|
55
|
-
if
|
56
|
-
source[:
|
57
|
-
|
58
|
-
|
69
|
+
if source[:Type] =~ /GITHUB/
|
70
|
+
source[:ReportBuildStatus] = true
|
71
|
+
end
|
72
|
+
|
73
|
+
if options[:OauthToken]
|
74
|
+
source[:Auth] = {
|
75
|
+
Type: "OAUTH",
|
76
|
+
Resource: options[:OauthToken],
|
59
77
|
}
|
60
78
|
end
|
61
79
|
|
62
|
-
@properties[:
|
80
|
+
@properties[:Source] = source
|
63
81
|
end
|
64
82
|
|
65
83
|
def linux_image(name)
|
66
|
-
linux_environment(
|
84
|
+
linux_environment(Image: name)
|
67
85
|
end
|
68
86
|
|
69
87
|
def linux_environment(options={})
|
70
|
-
image = options[:
|
88
|
+
image = options[:Image] || "aws/codebuild/amazonlinux2-x86_64-standard:2.0"
|
71
89
|
env = {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
90
|
+
ComputeType: options[:ComputeType] || "BUILD_GENERAL1_SMALL",
|
91
|
+
ImagePullCredentialsType: "CODEBUILD", # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-imagepullcredentialstype
|
92
|
+
PrivilegedMode: true,
|
93
|
+
Image: image,
|
94
|
+
Type: "LINUX_CONTAINER"
|
77
95
|
}
|
78
96
|
# @mapped_env_vars is in memory
|
79
|
-
env[:
|
97
|
+
env[:EnvironmentVariables] = @mapped_env_vars if @mapped_env_vars
|
80
98
|
# options has highest precedence
|
81
|
-
env[:
|
82
|
-
@properties[:
|
99
|
+
env[:EnvironmentVariables] = options[:EnvironmentVariables] if options[:EnvironmentVariables]
|
100
|
+
@properties[:Environment] = env
|
83
101
|
end
|
84
102
|
|
85
103
|
def environment_variables(vars)
|
@@ -87,20 +105,20 @@ module Cody::Dsl
|
|
87
105
|
@mapped_env_vars = vars.map { |k,v|
|
88
106
|
k, v = k.to_s, v.to_s
|
89
107
|
if v =~ /^ssm:/
|
90
|
-
{
|
108
|
+
{ Type: "PARAMETER_STORE", Name: k, Value: v.sub('ssm:','') }
|
91
109
|
else
|
92
|
-
{
|
110
|
+
{ Type: "PLAINTEXT", Name: k, Value: v }
|
93
111
|
end
|
94
112
|
}
|
95
|
-
@properties[:
|
96
|
-
@properties[:
|
113
|
+
@properties[:Environment] ||= {}
|
114
|
+
@properties[:Environment][:EnvironmentVariables] = @mapped_env_vars
|
97
115
|
end
|
98
116
|
|
99
117
|
def local_cache(enable=true)
|
100
118
|
cache = if enable
|
101
119
|
{
|
102
|
-
|
103
|
-
|
120
|
+
Type: "LOCAL",
|
121
|
+
Modes: [
|
104
122
|
"LOCAL_DOCKER_LAYER_CACHE",
|
105
123
|
"LOCAL_SOURCE_CACHE",
|
106
124
|
"LOCAL_CUSTOM_CACHE"
|
@@ -109,11 +127,11 @@ module Cody::Dsl
|
|
109
127
|
else
|
110
128
|
{type: "NO_CACHE"}
|
111
129
|
end
|
112
|
-
@properties[:
|
130
|
+
@properties[:Cache] = cache
|
113
131
|
end
|
114
132
|
|
115
133
|
def type
|
116
|
-
@options[:type]
|
134
|
+
@options[:type] # should be lowercase
|
117
135
|
end
|
118
136
|
end
|
119
137
|
end
|
data/lib/cody/dsl/role.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Cody::Dsl
|
2
2
|
module Role
|
3
3
|
PROPERTIES = %w[
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
AssumeRolePolicyDocument
|
5
|
+
ManagedPolicyArns
|
6
|
+
MaxSessionDuration
|
7
|
+
Path
|
8
|
+
PermissionsBoundary
|
9
|
+
Policies
|
10
|
+
RoleName
|
11
11
|
]
|
12
12
|
PROPERTIES.each do |prop|
|
13
|
-
define_method(prop) do |v|
|
13
|
+
define_method(prop.underscore) do |v|
|
14
14
|
@properties[prop.to_sym] = v
|
15
15
|
end
|
16
16
|
end
|
@@ -27,9 +27,9 @@ module Cody::Dsl
|
|
27
27
|
# Expands simple string from: logs => logs:*
|
28
28
|
definition = "#{definition}:*" unless definition.include?(':')
|
29
29
|
{
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
Action: [definition],
|
31
|
+
Effect: "Allow",
|
32
|
+
Resource: "*",
|
33
33
|
}
|
34
34
|
when Hash
|
35
35
|
definition
|
data/lib/cody/dsl/schedule.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Cody::Dsl
|
2
2
|
module Schedule
|
3
3
|
PROPERTIES = %w[
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
Description
|
5
|
+
EventPattern
|
6
|
+
Name
|
7
|
+
RoleArn
|
8
|
+
ScheduleExpression
|
9
|
+
State
|
10
|
+
Targets
|
11
11
|
]
|
12
12
|
PROPERTIES.each do |prop|
|
13
|
-
define_method(prop) do |v|
|
13
|
+
define_method(prop.underscore) do |v|
|
14
14
|
@properties[prop.to_sym] = v
|
15
15
|
end
|
16
16
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Represents a project with no builds yet. In this case we just return an info message for the columns.
|
2
2
|
# This allows `cody list` to work without breaking for Fresh projects with zero builds.
|
3
|
-
|
3
|
+
module Cody::List
|
4
4
|
class NoBuildsProject
|
5
5
|
def method_missing(meth, *args, &block)
|
6
6
|
"no builds"
|
data/lib/cody/list/project.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# Wrap project in object to allow lazy loading of status
|
2
|
-
|
2
|
+
module Cody::List
|
3
3
|
class Project
|
4
4
|
include Cody::AwsServices
|
5
5
|
extend Memoist
|
6
6
|
|
7
7
|
delegate :build_status, :start_time, :end_time, to: :build
|
8
|
+
alias_method :time, :end_time
|
9
|
+
alias_method :status, :build_status
|
8
10
|
|
9
11
|
attr_reader :name
|
10
12
|
def initialize(name)
|
data/lib/cody/project.rb
CHANGED
@@ -20,40 +20,39 @@ module Cody
|
|
20
20
|
load_variables
|
21
21
|
evaluate(@project_path)
|
22
22
|
resource = {
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
CodeBuild: {
|
24
|
+
Type: "AWS::CodeBuild::Project",
|
25
|
+
Properties: @properties
|
26
26
|
}
|
27
27
|
}
|
28
|
-
|
28
|
+
auto_camelize(resource)
|
29
29
|
end
|
30
30
|
|
31
31
|
def default_properties
|
32
32
|
{
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
Name: @full_project_name,
|
34
|
+
Description: @full_project_name,
|
35
|
+
Artifacts: { Type: "NO_ARTIFACTS" },
|
36
|
+
ServiceRole: { Ref: "IamRole" },
|
37
|
+
BadgeEnabled: true,
|
38
|
+
TimeoutInMinutes: 20,
|
39
|
+
LogsConfig: {
|
40
|
+
CloudWatchLogs: {
|
41
|
+
Status: "ENABLED",
|
42
42
|
# the default log group name is thankfully the project name
|
43
43
|
}
|
44
44
|
},
|
45
|
-
|
46
|
-
|
45
|
+
Source: {
|
46
|
+
Type: "GITHUB",
|
47
47
|
# location: "", # required
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
# auth doesnt seem to work, refer to https://github.com/tongueroo/cody/blob/master/readme/
|
52
|
-
#
|
53
|
-
#
|
54
|
-
# #
|
48
|
+
# GitCloneDepth: 1,
|
49
|
+
GitSubmodulesConfig: { FetchSubmodules: true },
|
50
|
+
BuildSpec: build_spec,
|
51
|
+
# auth doesnt seem to work, refer to https://github.com/tongueroo/cody/blob/master/readme/GithubOauth.md
|
52
|
+
# Auth: {
|
53
|
+
# Type: "OAUTH",
|
54
|
+
# # Resource: "", # required
|
55
55
|
# },
|
56
|
-
report_build_status: true,
|
57
56
|
}
|
58
57
|
}
|
59
58
|
end
|
data/lib/cody/role.rb
CHANGED
@@ -15,23 +15,23 @@ module Cody
|
|
15
15
|
def run
|
16
16
|
load_variables
|
17
17
|
evaluate(@role_path) if File.exist?(@role_path)
|
18
|
-
@properties[:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@properties[:Policies] = [{
|
19
|
+
PolicyName: "CodeBuildAccess",
|
20
|
+
PolicyDocument: {
|
21
|
+
Version: "2012-10-17",
|
22
|
+
Statement: derived_iam_statements
|
23
23
|
}
|
24
24
|
}]
|
25
25
|
|
26
|
-
@properties[:
|
26
|
+
@properties[:ManagedPolicyArns] ||= @managed_policy_arns || default_managed_policy_arns
|
27
27
|
|
28
28
|
resource = {
|
29
29
|
IamRole: {
|
30
|
-
|
31
|
-
|
30
|
+
Type: "AWS::IAM::Role",
|
31
|
+
Properties: @properties
|
32
32
|
}
|
33
33
|
}
|
34
|
-
|
34
|
+
auto_camelize(resource)
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
@@ -41,17 +41,17 @@ module Cody
|
|
41
41
|
|
42
42
|
def default_properties
|
43
43
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
AssumeRolePolicyDocument: {
|
45
|
+
Statement: [{
|
46
|
+
Action: ["sts:AssumeRole"],
|
47
|
+
Effect: "Allow",
|
48
|
+
Principal: {
|
49
|
+
Service: ["codebuild.amazonaws.com"]
|
50
50
|
}
|
51
51
|
}],
|
52
|
-
|
52
|
+
Version: "2012-10-17"
|
53
53
|
},
|
54
|
-
|
54
|
+
Path: "/"
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
@@ -61,7 +61,7 @@ module Cody
|
|
61
61
|
|
62
62
|
def default_iam_statements
|
63
63
|
[{
|
64
|
-
|
64
|
+
Action: [
|
65
65
|
"logs:CreateLogGroup",
|
66
66
|
"logs:CreateLogStream",
|
67
67
|
"logs:PutLogEvents",
|
@@ -69,8 +69,8 @@ module Cody
|
|
69
69
|
"ssm:DescribeParameters",
|
70
70
|
"ssm:GetParameter*",
|
71
71
|
],
|
72
|
-
|
73
|
-
|
72
|
+
Effect: "Allow",
|
73
|
+
Resource: "*"
|
74
74
|
}]
|
75
75
|
end
|
76
76
|
|
data/lib/cody/schedule.rb
CHANGED
@@ -17,27 +17,27 @@ module Cody
|
|
17
17
|
load_variables
|
18
18
|
evaluate(@schedule_path)
|
19
19
|
|
20
|
-
@properties[:
|
20
|
+
@properties[:ScheduleExpression] = @schedule_expression if @schedule_expression
|
21
21
|
set_rule_event! if @rule_event_props
|
22
22
|
return if old_properties == @properties # empty schedule.rb file
|
23
23
|
|
24
24
|
resource = {
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
EventsRule: {
|
26
|
+
Type: "AWS::Events::Rule",
|
27
|
+
Properties: @properties
|
28
28
|
},
|
29
|
-
|
29
|
+
EventsRuleRole: events_rule_role,
|
30
30
|
}
|
31
|
-
|
31
|
+
auto_camelize(resource)
|
32
32
|
end
|
33
33
|
|
34
34
|
def set_rule_event!
|
35
35
|
props = @rule_event_props
|
36
|
-
if props.key?(:
|
37
|
-
description = props.key?(:
|
38
|
-
rule_props = {
|
39
|
-
else # if props.key?(:
|
40
|
-
props[:
|
36
|
+
if props.key?(:Detail)
|
37
|
+
description = props.key?(:Description) ? props.delete(:Description) : rule_description
|
38
|
+
rule_props = { EventPattern: props, description: description }
|
39
|
+
else # if props.key?(:EventPattern)
|
40
|
+
props[:Description] ||= rule_description
|
41
41
|
rule_props = props
|
42
42
|
end
|
43
43
|
|
@@ -48,15 +48,15 @@ module Cody
|
|
48
48
|
description = "Cody #{@options[:full_project_name]}"
|
49
49
|
name = description.gsub(" ", "-").downcase
|
50
50
|
{
|
51
|
-
|
52
|
-
#
|
53
|
-
|
54
|
-
#
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
Description: "#{description} CodeBuild project",
|
52
|
+
# EventPattern: ,
|
53
|
+
Name: name,
|
54
|
+
# ScheduleExpression: ,
|
55
|
+
State: "ENABLED",
|
56
|
+
Targets: [{
|
57
|
+
Arn: { "Fn::GetAtt": "CodeBuild.Arn" },
|
58
|
+
RoleArn: { "Fn::GetAtt": "EventsRuleRole.Arn" }, # required for specific CodeBuild target.
|
59
|
+
Id: "CodeBuildTarget",
|
60
60
|
}]
|
61
61
|
}
|
62
62
|
end
|
@@ -68,25 +68,25 @@ module Cody
|
|
68
68
|
|
69
69
|
def events_rule_role
|
70
70
|
{
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
Type: "AWS::IAM::Role",
|
72
|
+
Properties: {
|
73
|
+
AssumeRolePolicyDocument: {
|
74
|
+
Statement: [{
|
75
|
+
Action: [ "sts:AssumeRole" ],
|
76
|
+
Effect: "Allow",
|
77
|
+
Principal: { Service: [ "events.amazonaws.com" ] }
|
78
78
|
}],
|
79
|
-
|
79
|
+
Version: "2012-10-17"
|
80
80
|
},
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
81
|
+
Path: "/",
|
82
|
+
Policies: [{
|
83
|
+
PolicyName: "CodeBuildAccess",
|
84
|
+
PolicyDocument: {
|
85
|
+
Version: "2012-10-17",
|
86
|
+
Statement: [{
|
87
|
+
Action: "codebuild:StartBuild",
|
88
|
+
Effect: "Allow",
|
89
|
+
Resource: "arn:aws:codebuild:#{aws_data.region}:#{aws_data.account}:project/#{@options[:full_project_name]}"
|
90
90
|
}]
|
91
91
|
}
|
92
92
|
}]
|