moonshot 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moonshot/artifact_repository/s3_bucket.rb +16 -2
- data/lib/moonshot/artifact_repository/s3_bucket_via_github_releases.rb +2 -2
- data/lib/moonshot/build_mechanism/github_release.rb +1 -1
- data/lib/moonshot/controller.rb +2 -0
- data/lib/moonshot/deployment_mechanism/code_deploy.rb +10 -6
- data/lib/moonshot/stack.rb +3 -1
- data/lib/moonshot/stack_template.rb +5 -1
- 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: 706a76719c8af3e934f0f141d79ca04513456fa6
|
4
|
+
data.tar.gz: 7f4912bacb3d49ba8015d71130db779ef1e912ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd5749505b66b86c639aef84e862a3b83360ee66528d34930131282754cec3d018f7dbad38bc0d6c9887bfc5b8d9b8aa850b50fa1535fa2949511c2b49cabb2
|
7
|
+
data.tar.gz: f2d265eaf095ad3e387cef1ce435405875645873f74ce938bd1b0f547e11a1042f0fc0138c4a7b88c4b55602ff9c6923cccb98130532a72f8211c35166cd4a8a
|
@@ -26,7 +26,7 @@ class Moonshot::ArtifactRepository::S3Bucket
|
|
26
26
|
key = filename_for_version(version_name)
|
27
27
|
|
28
28
|
ilog.start_threaded "Uploading #{file} to s3://#{bucket_name}/#{key}" do |s|
|
29
|
-
|
29
|
+
upload_to_s3(file, key)
|
30
30
|
s.success "Uploaded s3://#{bucket_name}/#{key} successfully."
|
31
31
|
end
|
32
32
|
end
|
@@ -37,6 +37,15 @@ class Moonshot::ArtifactRepository::S3Bucket
|
|
37
37
|
|
38
38
|
private
|
39
39
|
|
40
|
+
def upload_to_s3(file, key)
|
41
|
+
s3_client.put_object(
|
42
|
+
key: key,
|
43
|
+
body: File.open(file),
|
44
|
+
bucket: @bucket_name,
|
45
|
+
storage_class: 'STANDARD_IA'
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
40
49
|
def doctor_check_bucket_exists
|
41
50
|
s3_client.get_bucket_location(bucket: @bucket_name)
|
42
51
|
success "Bucket '#{@bucket_name}' exists."
|
@@ -49,7 +58,12 @@ class Moonshot::ArtifactRepository::S3Bucket
|
|
49
58
|
end
|
50
59
|
|
51
60
|
def doctor_check_bucket_writable
|
52
|
-
s3_client.put_object(
|
61
|
+
s3_client.put_object(
|
62
|
+
key: 'test-object',
|
63
|
+
body: '',
|
64
|
+
bucket: @bucket_name,
|
65
|
+
storage_class: 'REDUCED_REDUNDANCY'
|
66
|
+
)
|
53
67
|
s3_client.delete_object(key: 'test-object', bucket: @bucket_name)
|
54
68
|
success 'Bucket is writable, new builds can be uploaded.'
|
55
69
|
rescue => e
|
@@ -71,8 +71,8 @@ module Moonshot::ArtifactRepository
|
|
71
71
|
Dir.mktmpdir('github_to_s3', Dir.getwd) do |tmpdir|
|
72
72
|
Dir.chdir(tmpdir) do
|
73
73
|
sh_out("hub release download #{version}")
|
74
|
-
file =
|
75
|
-
|
74
|
+
file = Dir.glob("*#{version}*.tar.gz").fetch(0)
|
75
|
+
upload_to_s3(file, s3_name)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -71,7 +71,7 @@ module Moonshot::BuildMechanism
|
|
71
71
|
say("Changelog for #{version}", :yellow)
|
72
72
|
say("#{@changes}\n\n")
|
73
73
|
|
74
|
-
q = "Do you
|
74
|
+
q = "Do you want to tag and release this commit as #{version}? [y/n]"
|
75
75
|
raise Thor::Error, 'Release declined.' unless yes?(q)
|
76
76
|
end
|
77
77
|
|
data/lib/moonshot/controller.rb
CHANGED
@@ -16,13 +16,17 @@ class Moonshot::DeploymentMechanism::CodeDeploy # rubocop:disable ClassLength
|
|
16
16
|
# @param asg [String]
|
17
17
|
# The logical name of the AutoScalingGroup to create and manage a Deployment
|
18
18
|
# Group for in CodeDeploy.
|
19
|
+
# @param role [String]
|
20
|
+
# IAM role with AWSCodeDeployRole policy. CodeDeployRole is considered as
|
21
|
+
# default role if its not specified.
|
19
22
|
# @param app_name [String, nil] (nil)
|
20
23
|
# The name of the CodeDeploy Application and Deployment Group. By default,
|
21
24
|
# this is the same as the stack name, and probably what you want. If you
|
22
25
|
# have multiple deployments in a single Stack, they must have unique names.
|
23
|
-
def initialize(asg:, app_name: nil)
|
26
|
+
def initialize(asg:, role: 'CodeDeployRole', app_name: nil)
|
24
27
|
@asg_logical_id = asg
|
25
28
|
@app_name = app_name
|
29
|
+
@codedeploy_role = role
|
26
30
|
end
|
27
31
|
|
28
32
|
def post_create_hook
|
@@ -180,9 +184,9 @@ class Moonshot::DeploymentMechanism::CodeDeploy # rubocop:disable ClassLength
|
|
180
184
|
end
|
181
185
|
|
182
186
|
def role
|
183
|
-
iam_client.get_role(role_name:
|
187
|
+
iam_client.get_role(role_name: @codedeploy_role).role
|
184
188
|
rescue Aws::IAM::Errors::NoSuchEntity
|
185
|
-
raise Thor::Error,
|
189
|
+
raise Thor::Error, "Did not find an IAM Role: #{@codedeploy_role}"
|
186
190
|
end
|
187
191
|
|
188
192
|
def delete_deployment_group
|
@@ -281,8 +285,8 @@ class Moonshot::DeploymentMechanism::CodeDeploy # rubocop:disable ClassLength
|
|
281
285
|
end
|
282
286
|
|
283
287
|
def doctor_check_code_deploy_role
|
284
|
-
iam_client.get_role(role_name:
|
285
|
-
success(
|
288
|
+
iam_client.get_role(role_name: @codedeploy_role).role
|
289
|
+
success("#{@codedeploy_role} exists.")
|
286
290
|
rescue => e
|
287
291
|
help = <<-EOF
|
288
292
|
Error: #{e.message}
|
@@ -290,7 +294,7 @@ Error: #{e.message}
|
|
290
294
|
For information on provisioning an account for use with CodeDeploy, see:
|
291
295
|
http://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-create-service-role.html
|
292
296
|
EOF
|
293
|
-
critical(
|
297
|
+
critical("Could not find #{@codedeploy_role}, ", help)
|
294
298
|
end
|
295
299
|
|
296
300
|
def doctor_check_auto_scaling_resource_defined
|
data/lib/moonshot/stack.rb
CHANGED
@@ -60,7 +60,9 @@ module Moonshot
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
should_wait ? wait_for_stack_state(:stack_update_complete, 'updated') : true
|
63
|
+
success = should_wait ? wait_for_stack_state(:stack_update_complete, 'updated') : true
|
64
|
+
raise Thor::Error, 'Failed to update the CloudFormation Stack.' unless success
|
65
|
+
success
|
64
66
|
end
|
65
67
|
|
66
68
|
def delete
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Moonshot
|
2
4
|
# A StackTemplate loads the JSON template from disk and stores information
|
3
5
|
# about it.
|
@@ -18,7 +20,9 @@ module Moonshot
|
|
18
20
|
raise
|
19
21
|
end
|
20
22
|
|
21
|
-
|
23
|
+
# The maximum TemplateBody length is 51,200 bytes, so we remove
|
24
|
+
# formatting white space.
|
25
|
+
@body = JSON.parse(File.read(filename)).to_json
|
22
26
|
end
|
23
27
|
|
24
28
|
def parameters
|
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: 0.7.
|
4
|
+
version: 0.7.1
|
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: 2016-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|