bbc-cosmos-tools 0.1.2 → 0.1.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7190ff2e94981faebca714317e92216e4158b69
|
4
|
+
data.tar.gz: 22c74bf8e9a3e2e7ff70360a5f05bf2999c2246f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66373735b82214ca4e9b3a4c79ddaa8838dc9dfe8691f37cf135f62cfffe0945d1fb0f983b72b8aacd324624b86cdbbcbad726cae624c5416db898a98494360b
|
7
|
+
data.tar.gz: b2164e242b15e93c2dd73c78889b1d9fd49a20c1704534622e7773ae5237ef7f7715933c516dd187d69844098118b857da9361e6fa9c93c7db0085d052913ce1
|
@@ -58,6 +58,11 @@ module BBC
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def error(message, die = true)
|
62
|
+
say "#{message}\n", :red
|
63
|
+
exit 1 if die
|
64
|
+
end
|
65
|
+
|
61
66
|
private
|
62
67
|
|
63
68
|
def setup_config
|
@@ -70,11 +75,6 @@ module BBC
|
|
70
75
|
)
|
71
76
|
end
|
72
77
|
|
73
|
-
def error(message, die = true)
|
74
|
-
say "#{message}\n", :red
|
75
|
-
exit 1 if die
|
76
|
-
end
|
77
|
-
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -51,44 +51,68 @@ module BBC
|
|
51
51
|
end
|
52
52
|
|
53
53
|
desc "release deploy [COMPONENT = nil, RELEASE_ID = nil]", "Deploys a release to the specific enironment"
|
54
|
-
method_option :tags, :type => :array, :default => nil
|
54
|
+
method_option :tags, :type => :array, :default => nil, :desc => "The tags of the components you want to deploy (i.e 'renderer')"
|
55
|
+
method_option :from, :type => :string, :default => 'release', :desc => "The location that the deployment shold be taken from (release|int|test)"
|
55
56
|
def deploy(component = nil, release_id = nil)
|
56
|
-
begin
|
57
57
|
|
58
58
|
say banner
|
59
59
|
|
60
60
|
components(options, component).each do |id|
|
61
|
+
begin
|
62
|
+
|
63
|
+
component_release = release_id
|
64
|
+
if release_id.nil?
|
65
|
+
|
66
|
+
raise("From location cannot be the same as deployment location") if options[:from] == options[:env]
|
67
|
+
post_data = {}
|
68
|
+
endpoint = config.app['deploy']
|
69
|
+
|
70
|
+
case options[:from]
|
71
|
+
when 'release'
|
72
|
+
response = api.get sprintf(config.app['release'], id)
|
73
|
+
api_error response unless response.success?
|
74
|
+
component_release = JSON.parse(response.body)['releases'].first['version']
|
75
|
+
post_data = {
|
76
|
+
'release_version' => component_release
|
77
|
+
}
|
78
|
+
when 'int', 'test', 'live'
|
79
|
+
|
80
|
+
endpoint = config.app['snapshot_deploy']
|
81
|
+
response = api.get sprintf(config.app['deployments'], id, options[:from])
|
82
|
+
api_error response unless response.success?
|
83
|
+
snapshot_id = JSON.parse(response.body).first['snapshot']['snapshot_id']
|
84
|
+
post_data = {
|
85
|
+
'snapshot_id' => snapshot_id
|
86
|
+
}
|
87
|
+
|
88
|
+
else
|
89
|
+
raise("Invalid location: #{options[:from]} to deploy from")
|
90
|
+
end
|
91
|
+
end
|
61
92
|
|
62
|
-
|
63
|
-
if release_id.nil?
|
64
|
-
response = api.get sprintf(config.app['release'], id)
|
65
|
-
api_error response unless response.success?
|
66
|
-
component_release = JSON.parse(response.body)['releases'].first['version']
|
67
|
-
end
|
93
|
+
response = api.post sprintf(endpoint, options[:env], id), JSON.generate(post_data)
|
68
94
|
|
69
|
-
|
70
|
-
response = api.post sprintf(config.app['deploy'], options[:env], id), post_data
|
95
|
+
if response.success?
|
71
96
|
|
72
|
-
|
97
|
+
say get_key_value("\nComponent", id)
|
98
|
+
say get_key_value("Version", post_data['snapshot_id'] ? post_data['snapshot_id'] : post_data['release_version'])
|
73
99
|
|
74
|
-
|
75
|
-
|
100
|
+
data = JSON.parse(response.body)
|
101
|
+
say "\nDeployment started successfully: #{config.app['api']}#{data['url']}\n", :green
|
76
102
|
|
77
|
-
|
78
|
-
|
103
|
+
else
|
104
|
+
api_error response
|
105
|
+
end
|
79
106
|
|
80
|
-
|
81
|
-
|
107
|
+
rescue Exception => e
|
108
|
+
error(e.message, false)
|
82
109
|
end
|
83
|
-
|
84
110
|
end
|
85
111
|
|
86
|
-
rescue Exception => e
|
87
|
-
error e.message
|
88
|
-
end
|
89
112
|
end
|
90
113
|
|
91
114
|
desc "release deployed [COMPONENT = nil]", "Lists releases deloyed for a component in the specified environment"
|
115
|
+
method_option :tags, :type => :array, :default => nil, :desc => "The tags of the components you want to deploy (i.e 'renderer')"
|
92
116
|
def deployed(component = nil)
|
93
117
|
begin
|
94
118
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc-cosmos-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|