moonshot 2.0.0.beta3 → 2.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moonshot/build_mechanism/github_release.rb +12 -2
- data/lib/moonshot/command_line.rb +2 -0
- data/lib/moonshot/controller_config.rb +1 -0
- data/lib/moonshot/stack.rb +43 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c356399f35faaaf5a8607cdd8981be62eeae1ec5
|
4
|
+
data.tar.gz: 5b84246b209003da95a2ec5debcd5418786efe93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 329a31f99d19662734d917c41036dbeef77398319feb9afe93e7375c3b57d1cbbda4a368e9b05d22a64620db4cc49d6a6f5359cfeeccac6e08b60fb504e325df
|
7
|
+
data.tar.gz: a7917a5b06f86e4442e03ee976b48b6360eb7eef12c87634774a76b2f3983fca3a373a2391ec94a0088788c28620c916492f5fba421ae51ee186b8f0fc3d2d8d
|
@@ -17,10 +17,20 @@ module Moonshot::BuildMechanism
|
|
17
17
|
def_delegator :@build_mechanism, :output_file
|
18
18
|
|
19
19
|
# @param build_mechanism Delegates building after GitHub release is created.
|
20
|
-
def initialize(build_mechanism,
|
20
|
+
def initialize(build_mechanism,
|
21
|
+
ci_status_timeout: 600,
|
22
|
+
max_tag_find_timeout: 240,
|
23
|
+
skip_ci_status: false)
|
21
24
|
@build_mechanism = build_mechanism
|
22
25
|
@ci_status_timeout = ci_status_timeout
|
23
26
|
@max_tag_find_timeout = max_tag_find_timeout
|
27
|
+
@skip_ci_status = skip_ci_status
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_cli_hook(parser)
|
31
|
+
parser.on('-s', '--[no-]skip-ci-status', 'Skips checks on CI jobs', TrueClass) do |value|
|
32
|
+
@skip_ci_status = value
|
33
|
+
end
|
24
34
|
end
|
25
35
|
|
26
36
|
def doctor_hook
|
@@ -159,7 +169,7 @@ module Moonshot::BuildMechanism
|
|
159
169
|
sh_step(cmd, msg: "Validate commit #{@sha}.") do |_, out|
|
160
170
|
@commit_detail = out
|
161
171
|
end
|
162
|
-
@ci_statuses = check_ci_status(@sha)
|
172
|
+
@ci_statuses = check_ci_status(@sha) if @skip_ci_status == false
|
163
173
|
end
|
164
174
|
|
165
175
|
def validate_changelog(version)
|
data/lib/moonshot/stack.rb
CHANGED
@@ -176,14 +176,39 @@ module Moonshot
|
|
176
176
|
raise "Could not describe stack: #{name}"
|
177
177
|
end
|
178
178
|
|
179
|
+
def upload_template_to_s3
|
180
|
+
unless @config.template_s3_bucket
|
181
|
+
raise 'The S3 bucket to store the template in is not configured.'
|
182
|
+
end
|
183
|
+
|
184
|
+
s3_object_key = "#{@name}-#{Time.now.getutc.to_i}-#{File.basename(template.filename)}"
|
185
|
+
template_url = "http://#{@config.template_s3_bucket}.s3.amazonaws.com/#{s3_object_key}"
|
186
|
+
|
187
|
+
@ilog.start "Uploading template to #{template_url}" do |s|
|
188
|
+
s3_client.put_object(
|
189
|
+
bucket: @config.template_s3_bucket,
|
190
|
+
key: s3_object_key,
|
191
|
+
body: template.body
|
192
|
+
)
|
193
|
+
s.success "Template has been uploaded successfully to #{template_url}"
|
194
|
+
end
|
195
|
+
|
196
|
+
template_url
|
197
|
+
end
|
198
|
+
|
179
199
|
def create_stack
|
180
|
-
|
200
|
+
parameters = {
|
181
201
|
stack_name: @name,
|
182
|
-
template_body: template.body,
|
183
202
|
capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM),
|
184
203
|
parameters: @config.parameters.values.map(&:to_cf),
|
185
204
|
tags: make_tags
|
186
|
-
|
205
|
+
}
|
206
|
+
if @config.template_s3_bucket
|
207
|
+
parameters[:template_url] = upload_template_to_s3
|
208
|
+
else
|
209
|
+
parameters[:template_body] = template.body
|
210
|
+
end
|
211
|
+
cf_client.create_stack(parameters)
|
187
212
|
rescue Aws::CloudFormation::Errors::AccessDenied
|
188
213
|
raise 'You are not authorized to perform create_stack calls.'
|
189
214
|
end
|
@@ -195,14 +220,20 @@ module Moonshot
|
|
195
220
|
Time.now.utc.to_i.to_s
|
196
221
|
].join('-')
|
197
222
|
|
198
|
-
|
223
|
+
parameters = {
|
199
224
|
change_set_name: change_set_name,
|
200
225
|
description: "Moonshot update command for application '#{Moonshot.config.app_name}'",
|
201
226
|
stack_name: @name,
|
202
|
-
template_body: template.body,
|
203
227
|
capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM),
|
204
228
|
parameters: @config.parameters.values.map(&:to_cf)
|
205
|
-
|
229
|
+
}
|
230
|
+
if @config.template_s3_bucket
|
231
|
+
parameters[:template_url] = upload_template_to_s3
|
232
|
+
else
|
233
|
+
parameters[:template_body] = template.body
|
234
|
+
end
|
235
|
+
|
236
|
+
cf_client.create_change_set(parameters)
|
206
237
|
|
207
238
|
change_set_name
|
208
239
|
end
|
@@ -289,7 +320,12 @@ module Moonshot
|
|
289
320
|
end
|
290
321
|
|
291
322
|
def doctor_check_template_against_aws
|
292
|
-
|
323
|
+
if @config.template_s3_bucket
|
324
|
+
parameters[:template_url] = upload_template_to_s3
|
325
|
+
else
|
326
|
+
parameters[:template_body] = template.body
|
327
|
+
end
|
328
|
+
cf_client.validate_template(parameters)
|
293
329
|
success('CloudFormation template is valid.')
|
294
330
|
rescue => e
|
295
331
|
critical('Invalid CloudFormation template!', e.message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moonshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloud Engineering <engineering@acquia.com>
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|