gantree 0.4.9.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +3 -4
- data/circle.yml +13 -0
- data/lib/gantree.rb +2 -0
- data/lib/gantree/base.rb +7 -2
- data/lib/gantree/cli.rb +15 -15
- data/lib/gantree/deploy.rb +40 -164
- data/lib/gantree/deploy_applications.rb +47 -0
- data/lib/gantree/deploy_version.rb +108 -0
- data/lib/gantree/docker.rb +8 -8
- data/lib/gantree/notification.rb +1 -5
- data/lib/gantree/version.rb +1 -1
- data/spec/lib/gantree/cli_spec.rb +12 -13
- data/spec/lib/gantree/deploy_spec.rb +3 -11
- metadata +43 -82
- data/spec/lib/gantree/create_spec.rb +0 -21
- data/spec/lib/gantree/delete_spec.rb +0 -20
- data/spec/lib/gantree/update_spec.rb +0 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e885b83834412d374c592d09e2ccb605318ca4ba
|
4
|
+
data.tar.gz: 0be2e35ba2997c67e9730d40acf02d654b4a0e0f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 06fdbee2f644bb2f890402b4195a12a1677ee97da4e14827ef9cae93d5ba89352d7c91a70d33fed98b4a451e5644e33e89191ee4882c87f82b03daec6c2d76b5
|
7
|
+
data.tar.gz: c36e0db768daf3a64ab4aa84bb2ec67afb6556bc98c0eda9a04754d43dffd22ad1caf2f6320b1204db4650d2d962b177e50ff5c81751b020c1634bca2a6051e6
|
data/.travis.yml
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.1.3
|
4
|
+
- 2.1.3
|
5
5
|
before_script:
|
6
|
-
- echo "{"https://index.docker.io/v1/":{"auth":"$DOCKER_TOKEN","email":"$DOCKER_EMAIL"}"
|
7
|
-
|
8
|
-
- echo "{'cfn_bucket' : 'br-templates', 'domain' : 'brenv.net'}" > $HOME/.gantreecfg
|
6
|
+
- echo "{"https://index.docker.io/v1/":{"auth":"$DOCKER_TOKEN","email":"$DOCKER_EMAIL"}" > $HOME/.dockercfg
|
7
|
+
- wget -P /$HOME/ http://bleacher-report.d.pr/1jaEC.gantreecfg
|
9
8
|
env:
|
10
9
|
global:
|
11
10
|
- secure: OoLMnBOcoXTPOimdyh4ju8yW2YpLBXEOdljN1gVQzjIIv24cQ0BxWAAktjExntkYAjnRpxzTKK5ZkWadXm8NK7TtzFU80padk+WYVzuE1Xngxw/OhS1Z6NYL8+D3ortSANqoOB6r/Z13Sb5XClYDWlj5/GGzf4AerY5xgh2nJQc=
|
data/circle.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
machine:
|
2
|
+
ruby:
|
3
|
+
version: 2.1.3
|
4
|
+
services:
|
5
|
+
- docker
|
6
|
+
dependencies:
|
7
|
+
pre:
|
8
|
+
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
9
|
+
- wget -P $HOME/gantree/ http://bleacher-report.d.pr/1jaEC.gantreecfg
|
10
|
+
- mv $HOME/gantree/1jaEC.gantreecfg $HOME/gantree/.gantreecfg
|
11
|
+
test:
|
12
|
+
override:
|
13
|
+
- bundle exec rake
|
data/lib/gantree.rb
CHANGED
@@ -2,6 +2,8 @@ $:.unshift(File.expand_path("../", __FILE__))
|
|
2
2
|
require "gantree/base"
|
3
3
|
require "gantree/version"
|
4
4
|
require "gantree/deploy"
|
5
|
+
require "gantree/deploy_applications"
|
6
|
+
require "gantree/deploy_version"
|
5
7
|
require "gantree/init"
|
6
8
|
require "gantree/delete"
|
7
9
|
require "gantree/update"
|
data/lib/gantree/base.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "colorize"
|
1
2
|
module Gantree
|
2
3
|
class Base
|
3
4
|
def check_credentials
|
@@ -32,7 +33,7 @@ module Gantree
|
|
32
33
|
|
33
34
|
|
34
35
|
def tag
|
35
|
-
origin = `git config --get remote.origin.url`.match("
|
36
|
+
origin = `git config --get remote.origin.url`.match("com(.*)\/")[1].gsub(":","").gsub("/","").strip
|
36
37
|
branch = `git rev-parse --abbrev-ref HEAD`.gsub("/", "_").strip
|
37
38
|
hash = `git rev-parse --verify --short #{branch}`.strip
|
38
39
|
"#{origin}-#{branch}-#{hash}"
|
@@ -41,7 +42,7 @@ module Gantree
|
|
41
42
|
def create_default_env
|
42
43
|
tags = @options[:stack_name].split("-")
|
43
44
|
if tags.length == 3
|
44
|
-
|
45
|
+
[tags[1],tags[0],"app",tags[2]].join('-')
|
45
46
|
else
|
46
47
|
raise "Please Set Envinronment Name with -e"
|
47
48
|
end
|
@@ -92,6 +93,10 @@ module Gantree
|
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
96
|
+
def error_msg msg
|
97
|
+
puts msg.red
|
98
|
+
exit 1
|
99
|
+
end
|
95
100
|
end
|
96
101
|
end
|
97
102
|
|
data/lib/gantree/cli.rb
CHANGED
@@ -16,6 +16,7 @@ module Gantree
|
|
16
16
|
option :silent, :aliases => "-s", :desc => "mute notifications"
|
17
17
|
option :image_path, :aliases => "-i", :desc => "docker hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
|
18
18
|
option :autodetect_app_role, :desc => "use naming convention to determin role (true|false)", :type => :boolean, :default => true
|
19
|
+
option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
|
19
20
|
def deploy name
|
20
21
|
Gantree::Deploy.new(name, merge_defaults(options)).run
|
21
22
|
end
|
@@ -94,6 +95,7 @@ module Gantree
|
|
94
95
|
option :autodetect_app_role, :desc => "use naming convention to determin role (true|flase)", :type => :boolean
|
95
96
|
option :image_path, :aliases => "-i", :desc => "hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
|
96
97
|
option :hush, :desc => "quite puts messages", :default => true
|
98
|
+
option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
|
97
99
|
def ship server
|
98
100
|
docker = Gantree::Docker.new(merge_defaults(options))
|
99
101
|
docker.build
|
@@ -110,23 +112,21 @@ module Gantree
|
|
110
112
|
protected
|
111
113
|
|
112
114
|
def merge_defaults(options={})
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
local_opts = JSON.parse(File.open(local_cfg).read)
|
118
|
-
defaults = home_opts.merge(local_opts)
|
119
|
-
hash = defaults.merge(options)
|
120
|
-
elsif File.exist?(local_cfg)
|
121
|
-
defaults = JSON.parse(File.open(local_cfg).read)
|
122
|
-
hash = defaults.merge(options)
|
123
|
-
elsif File.exist?(home_cfg)
|
124
|
-
defaults = JSON.parse(File.open(home_cfg).read)
|
125
|
-
hash = defaults.merge(options)
|
126
|
-
else
|
127
|
-
hash = options
|
115
|
+
configs = ["#{ENV['HOME']}/.gantreecfg",".gantreecfg"]
|
116
|
+
hash = {}
|
117
|
+
configs.each do |config|
|
118
|
+
hash.merge!(merge_config(options,config)) if config_exists?(config)
|
128
119
|
end
|
129
120
|
Hash[hash.map{ |k, v| [k.to_sym, v] }]
|
121
|
+
end
|
122
|
+
|
123
|
+
def merge_config options, config
|
124
|
+
defaults = JSON.parse(File.open(config).read)
|
125
|
+
defaults.merge(options)
|
126
|
+
end
|
127
|
+
|
128
|
+
def config_exists? config
|
129
|
+
File.exist? config
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
data/lib/gantree/deploy.rb
CHANGED
@@ -14,66 +14,37 @@ module Gantree
|
|
14
14
|
@options = options
|
15
15
|
@ext = @options[:ext]
|
16
16
|
@dockerrun_file = "Dockerrun.aws.json"
|
17
|
+
print_options
|
17
18
|
end
|
18
19
|
|
19
20
|
def run
|
21
|
+
check_eb_bucket
|
20
22
|
if application?
|
21
|
-
|
22
|
-
@environments = eb.describe_environments({ :application_name => @app })[:environments]
|
23
|
-
if multiple_environments?
|
24
|
-
deploy_to_all
|
25
|
-
elsif environment_found?
|
26
|
-
deploy_to_one
|
27
|
-
else
|
28
|
-
puts "ERROR: There are no environments in this application".red
|
29
|
-
exit 1
|
30
|
-
end
|
23
|
+
DeployApplication.new(@name,@options).run
|
31
24
|
elsif environment?
|
32
25
|
puts "Found Environment: #{name}".green
|
33
26
|
deploy([name])
|
34
27
|
else
|
35
|
-
|
36
|
-
exit 1
|
28
|
+
error_msg "You leave me with nothing to deploy".red
|
37
29
|
end
|
38
30
|
end
|
39
31
|
|
40
|
-
def application?
|
41
|
-
results = eb.describe_applications({ application_names: ["#{@name}"]})
|
42
|
-
if results[:applications].length > 1
|
43
|
-
raise "There are more than 1 matching application names"
|
44
|
-
elsif results[:applications].length == 0
|
45
|
-
return false
|
46
|
-
else
|
47
|
-
@app = results[:applications][0][:application_name]
|
48
|
-
return true
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def multiple_environments?
|
53
|
-
@environments.length > 1 ? true : false
|
54
|
-
end
|
55
|
-
|
56
32
|
def environment_found?
|
57
33
|
@environments.length >=1 ? true : false
|
58
34
|
end
|
59
35
|
|
60
|
-
def deploy_to_all
|
61
|
-
puts "WARN: Deploying to All Environments in the Application: #{@name}".yellow
|
62
|
-
sleep 3
|
63
|
-
envs = []
|
64
|
-
@environments.each do |env|
|
65
|
-
envs << env[:environment_name]
|
66
|
-
end
|
67
|
-
puts "envs: #{envs}"
|
68
|
-
deploy(envs)
|
69
|
-
end
|
70
|
-
|
71
36
|
def deploy_to_one
|
72
37
|
env = @environments.first[:environment_name]
|
73
38
|
puts "Found Environment: #{env}".green
|
74
39
|
deploy([env])
|
75
40
|
end
|
76
41
|
|
42
|
+
def application?
|
43
|
+
results = eb.describe_applications({ application_names: ["#{@name}"]})
|
44
|
+
results[:applications].length == 1 ? true : false
|
45
|
+
end
|
46
|
+
|
47
|
+
|
77
48
|
def environment?
|
78
49
|
results = eb.describe_environments({ environment_names: ["#{@name}"]})[:environments]
|
79
50
|
if results.length == 0
|
@@ -86,12 +57,12 @@ module Gantree
|
|
86
57
|
end
|
87
58
|
|
88
59
|
def deploy(envs)
|
89
|
-
print_options
|
90
60
|
check_dir_name(envs) unless @options[:force]
|
91
61
|
return if @options[:dry_run]
|
92
|
-
|
62
|
+
version = DeployVersion.new(@options)
|
63
|
+
@packaged_version = version.run
|
93
64
|
upload_to_s3
|
94
|
-
clean_up
|
65
|
+
version.clean_up
|
95
66
|
create_eb_version
|
96
67
|
update_application(envs)
|
97
68
|
if @options[:slack]
|
@@ -102,22 +73,20 @@ module Gantree
|
|
102
73
|
end
|
103
74
|
|
104
75
|
def upload_to_s3
|
105
|
-
|
106
|
-
|
107
|
-
puts "uploading #{@packaged_version} to #{@app}-versions"
|
108
|
-
s3.buckets["#{@app}-versions"].objects[key].write(:file => @packaged_version)
|
76
|
+
puts "uploading #{@packaged_version} to #{set_bucket}"
|
77
|
+
s3.buckets["#{set_bucket}"].objects["#{@app}-#{@packaged_version}"].write(:file => @packaged_version)
|
109
78
|
end
|
110
79
|
|
111
80
|
def create_eb_version
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
81
|
+
begin
|
82
|
+
eb.create_application_version({
|
83
|
+
:application_name => "#{@app}",
|
84
|
+
:version_label => "#{@packaged_version}",
|
85
|
+
:source_bundle => {
|
86
|
+
:s3_bucket => "#{set_bucket}",
|
87
|
+
:s3_key => "#{@app}-#{@packaged_version}"
|
88
|
+
}
|
89
|
+
})
|
121
90
|
rescue AWS::ElasticBeanstalk::Errors::InvalidParameterValue => e
|
122
91
|
puts "No Application named #{@app} found #{e}"
|
123
92
|
end
|
@@ -128,8 +97,7 @@ module Gantree
|
|
128
97
|
begin
|
129
98
|
eb.update_environment({
|
130
99
|
:environment_name => env,
|
131
|
-
:version_label => @packaged_version
|
132
|
-
:option_settings => autodetect_app_role(env)
|
100
|
+
:version_label => @packaged_version
|
133
101
|
})
|
134
102
|
puts "Deployed #{@packaged_version} to #{env} on #{@app}".green
|
135
103
|
rescue AWS::ElasticBeanstalk::Errors::InvalidParameterValue => e
|
@@ -139,122 +107,30 @@ module Gantree
|
|
139
107
|
end
|
140
108
|
end
|
141
109
|
|
142
|
-
def
|
143
|
-
|
144
|
-
|
145
|
-
puts
|
146
|
-
hash = `git rev-parse --verify --short #{branch}`.strip
|
147
|
-
puts "hash #{hash}"
|
148
|
-
version = "#{@app}-#{hash}-#{time_stamp}"
|
149
|
-
puts "version: #{version}"
|
150
|
-
#auto_detect_app_role if @options[:autodetect_app_role] == true
|
151
|
-
set_image_path if @options[:image_path]
|
152
|
-
set_tag_to_deploy if @options[:tag]
|
153
|
-
unless ext?
|
154
|
-
new_dockerrun = "#{version}-Dockerrun.aws.json"
|
155
|
-
FileUtils.cp("Dockerrun.aws.json", new_dockerrun)
|
156
|
-
new_dockerrun
|
157
|
-
else
|
158
|
-
zip = "#{version}.zip"
|
159
|
-
clone_repo if repo?
|
160
|
-
Archive::Zip.archive(zip, ['.ebextensions/', @dockerrun_file])
|
161
|
-
zip
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def set_tag_to_deploy
|
166
|
-
docker = JSON.parse(IO.read(@dockerrun_file))
|
167
|
-
image = docker["Image"]["Name"]
|
168
|
-
image.gsub!(/:(.*)$/, ":#{@options[:tag]}")
|
169
|
-
IO.write(@dockerrun_file, JSON.pretty_generate(docker))
|
170
|
-
end
|
171
|
-
|
172
|
-
def set_image_path
|
173
|
-
docker = JSON.parse(IO.read(@dockerrun_file))
|
174
|
-
image = docker["Image"]["Name"]
|
175
|
-
image.gsub!(/(.*):/, "#{@options[:image_path]}:")
|
176
|
-
IO.write(@dockerrun_file, JSON.pretty_generate(docker))
|
177
|
-
image
|
178
|
-
end
|
179
|
-
|
180
|
-
def autodetect_app_role env
|
181
|
-
enabled = @options[:autodetect_app_role]
|
182
|
-
if enabled == true || enabled == "true"
|
183
|
-
role = env.split('-')[2]
|
184
|
-
puts "Deploying app as a #{role}"
|
185
|
-
[{:option_name => "ROLE", :value => role, :namespace => "aws:elasticbeanstalk:application:environment" }]
|
186
|
-
else
|
187
|
-
[]
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def ext?
|
192
|
-
if @ext
|
193
|
-
true
|
194
|
-
else
|
195
|
-
false
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def repo?
|
200
|
-
if @ext.include? "github"
|
201
|
-
puts "Cloning: #{@ext}..."
|
202
|
-
true
|
203
|
-
else
|
204
|
-
false
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
def local?
|
209
|
-
File.directory?(@ext)
|
210
|
-
end
|
211
|
-
|
212
|
-
def get_ext_repo
|
213
|
-
if ext_branch?
|
214
|
-
repo = @ext.sub(":#{get_ext_branch}", '')
|
215
|
-
else
|
216
|
-
@ext
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
def ext_branch?
|
221
|
-
if @ext.count(":") == 2
|
222
|
-
true
|
223
|
-
else
|
224
|
-
false
|
225
|
-
end
|
110
|
+
def check_dir_name envs
|
111
|
+
dir_name = File.basename(Dir.getwd)
|
112
|
+
msg = "WARN: You are deploying from a repo that doesn't match #{@app}"
|
113
|
+
puts msg.yellow if envs.any? { |env| env.include?(dir_name) } == false
|
226
114
|
end
|
227
115
|
|
228
|
-
def
|
229
|
-
|
230
|
-
|
116
|
+
def check_eb_bucket
|
117
|
+
bucket = set_bucket
|
118
|
+
s3.buckets.create(bucket) unless s3.buckets[bucket].exists?
|
231
119
|
end
|
232
120
|
|
233
|
-
def
|
234
|
-
if
|
235
|
-
|
121
|
+
def set_bucket
|
122
|
+
if @options[:eb_bucket]
|
123
|
+
bucket = @options[:eb_bucket]
|
236
124
|
else
|
237
|
-
|
125
|
+
bucket = generate_eb_bucket
|
238
126
|
end
|
239
127
|
end
|
240
|
-
|
241
|
-
def
|
242
|
-
|
243
|
-
bucket
|
244
|
-
s3.buckets.create(name) unless bucket.exists?
|
245
|
-
end
|
246
|
-
|
247
|
-
def clean_up
|
248
|
-
FileUtils.rm_rf(@packaged_version)
|
249
|
-
`git checkout Dockerrun.aws.json` # reverts back to original Dockerrun.aws.json
|
250
|
-
`rm -rf .ebextensions/` if ext?
|
128
|
+
|
129
|
+
def generate_eb_bucket
|
130
|
+
unique_hash = Digest::SHA1.hexdigest ENV['AWS_ACCESS_KEY_ID']
|
131
|
+
"eb-bucket-#{unique_hash}"
|
251
132
|
end
|
252
133
|
|
253
|
-
def check_dir_name envs
|
254
|
-
dir_name = File.basename(Dir.getwd)
|
255
|
-
msg = "WARN: You are deploying from a repo that doesn't match #{@app}"
|
256
|
-
puts msg.yellow if envs.any? { |env| env.include?(dir_name) } == false
|
257
|
-
end
|
258
134
|
end
|
259
135
|
end
|
260
136
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'archive/zip'
|
3
|
+
require 'colorize'
|
4
|
+
require_relative 'notification'
|
5
|
+
|
6
|
+
module Gantree
|
7
|
+
class DeployApplication < Deploy
|
8
|
+
attr_accessor :options
|
9
|
+
|
10
|
+
def initialize name, options
|
11
|
+
@options = options
|
12
|
+
@name = name
|
13
|
+
puts "Found Application: #{@name}".green
|
14
|
+
@environments = eb.describe_environments({ :application_name => @name })[:environments]
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
if multiple_environments?
|
19
|
+
deploy_to_all
|
20
|
+
elsif environment_found?
|
21
|
+
deploy_to_one
|
22
|
+
else
|
23
|
+
error_msg "ERROR: There are no environments in this application"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def multiple_environments?
|
28
|
+
@environments.length > 1 ? true : false
|
29
|
+
end
|
30
|
+
|
31
|
+
def environment_found?
|
32
|
+
@environments.length >=1 ? true : false
|
33
|
+
end
|
34
|
+
|
35
|
+
def deploy_to_all
|
36
|
+
puts "WARN: Deploying to All Environments in the Application: #{@name}".yellow
|
37
|
+
sleep 3
|
38
|
+
envs = []
|
39
|
+
@environments.each do |env|
|
40
|
+
envs << env[:environment_name]
|
41
|
+
end
|
42
|
+
puts "envs: #{envs}"
|
43
|
+
deploy(envs)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'archive/zip'
|
3
|
+
require 'colorize'
|
4
|
+
require_relative 'notification'
|
5
|
+
|
6
|
+
module Gantree
|
7
|
+
class DeployVersion < Deploy
|
8
|
+
|
9
|
+
def initialize options
|
10
|
+
@options = options
|
11
|
+
@ext = @options[:ext]
|
12
|
+
@dockerrun_file = "Dockerrun.aws.json"
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
@packaged_version = create_version_files
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_tag_to_deploy
|
20
|
+
docker = JSON.parse(IO.read(@dockerrun_file))
|
21
|
+
image = docker["Image"]["Name"]
|
22
|
+
image.gsub!(/:(.*)$/, ":#{@options[:tag]}")
|
23
|
+
IO.write(@dockerrun_file, JSON.pretty_generate(docker))
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_image_path
|
27
|
+
docker = JSON.parse(IO.read(@dockerrun_file))
|
28
|
+
image = docker["Image"]["Name"]
|
29
|
+
image.gsub!(/(.*):/, "#{@options[:image_path]}:")
|
30
|
+
IO.write(@dockerrun_file, JSON.pretty_generate(docker))
|
31
|
+
image
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_version_files
|
35
|
+
version = "#{tag}-#{Time.now.strftime("%b-%d-%Y-%a-%H-%M-%S")}"
|
36
|
+
puts "version: #{version}"
|
37
|
+
set_image_path if @options[:image_path]
|
38
|
+
set_tag_to_deploy if @options[:tag]
|
39
|
+
unless ext?
|
40
|
+
new_dockerrun = "#{version}-Dockerrun.aws.json"
|
41
|
+
FileUtils.cp("Dockerrun.aws.json", new_dockerrun)
|
42
|
+
new_dockerrun
|
43
|
+
else
|
44
|
+
zip = "#{version}.zip"
|
45
|
+
clone_repo if repo?
|
46
|
+
Archive::Zip.archive(zip, ['.ebextensions/', @dockerrun_file])
|
47
|
+
zip
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def ext?
|
52
|
+
if @ext
|
53
|
+
true
|
54
|
+
else
|
55
|
+
false
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def repo?
|
60
|
+
if @ext.include? "github"
|
61
|
+
puts "Cloning: #{@ext}..."
|
62
|
+
true
|
63
|
+
else
|
64
|
+
false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def local?
|
69
|
+
File.directory?(@ext)
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_ext_repo
|
73
|
+
if ext_branch?
|
74
|
+
@ext.sub(":#{get_ext_branch}", '')
|
75
|
+
else
|
76
|
+
@ext
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def ext_branch?
|
81
|
+
if @ext.count(":") == 2
|
82
|
+
true
|
83
|
+
else
|
84
|
+
false
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def get_ext_branch
|
89
|
+
branch = @ext.match(/:.*(:.*)$/)[1]
|
90
|
+
branch.tr(':','')
|
91
|
+
end
|
92
|
+
|
93
|
+
def clone_repo
|
94
|
+
if ext_branch?
|
95
|
+
`git clone -b #{get_ext_branch} #{get_ext_repo}`
|
96
|
+
else
|
97
|
+
`git clone #{get_ext_repo}`
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def clean_up
|
102
|
+
FileUtils.rm_rf(@packaged_version)
|
103
|
+
`git checkout Dockerrun.aws.json` # reverts back to original Dockerrun.aws.json
|
104
|
+
`rm -rf .ebextensions/` if ext?
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
data/lib/gantree/docker.rb
CHANGED
@@ -12,11 +12,11 @@ module Gantree
|
|
12
12
|
@tag = @options[:tag] ||= tag
|
13
13
|
end
|
14
14
|
|
15
|
-
def build
|
15
|
+
def build
|
16
16
|
puts "Building..."
|
17
|
-
|
18
|
-
if
|
19
|
-
puts "Image Built: #{@image_path}:#{@tag}".green
|
17
|
+
build_status = system("docker build -t #{@image_path}:#{@tag} .")
|
18
|
+
if build_status.success?
|
19
|
+
puts "Image Built: #{@image_path}:#{@tag}".green
|
20
20
|
puts "gantree push --image-path #{@image_path} -t #{@tag}" unless @options[:hush]
|
21
21
|
puts "gantree deploy app_name -t #{@tag}" unless @options[:hush]
|
22
22
|
else
|
@@ -26,11 +26,11 @@ module Gantree
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def push
|
29
|
+
def push
|
30
30
|
puts "Pushing to #{@image_path}:#{@tag} ..."
|
31
|
-
|
32
|
-
if
|
33
|
-
puts "Image Pushed: #{@image_path}:#{@tag}".green
|
31
|
+
push_status = "docker push #{@image_path}:#{@tag}"
|
32
|
+
if push_status.success?
|
33
|
+
puts "Image Pushed: #{@image_path}:#{@tag}".green
|
34
34
|
puts "gantree deploy app_name -t #{@tag}" unless @options[:hush]
|
35
35
|
else
|
36
36
|
puts "Error: Image was not pushed successfully".red
|
data/lib/gantree/notification.rb
CHANGED
@@ -2,11 +2,7 @@ require 'slackr'
|
|
2
2
|
class Notification
|
3
3
|
|
4
4
|
def initialize(options={})
|
5
|
-
@slack = Slackr.connect(options["team"], options["token"]
|
6
|
-
"channel" => options["channel"],
|
7
|
-
"username" => options["username"],
|
8
|
-
"icon_url" => options["icon_url"]
|
9
|
-
})
|
5
|
+
@slack = Slackr.connect(options["team"], options["token"])
|
10
6
|
end
|
11
7
|
|
12
8
|
def say(msg)
|
data/lib/gantree/version.rb
CHANGED
@@ -8,13 +8,12 @@ require 'spec_helper'
|
|
8
8
|
describe Gantree::CLI do
|
9
9
|
before(:all) do
|
10
10
|
|
11
|
-
@app = "stag-
|
12
|
-
@env = "
|
11
|
+
@app = "stag-carburetor-app-s2"
|
12
|
+
@env = "carburetor"
|
13
13
|
@owner = "bleacher"
|
14
14
|
@repo = "cauldron"
|
15
15
|
@tag = "master"
|
16
16
|
@user = "feelobot"
|
17
|
-
@new_env = "cms-stag-s3"
|
18
17
|
end
|
19
18
|
|
20
19
|
describe "init" do
|
@@ -32,39 +31,39 @@ describe Gantree::CLI do
|
|
32
31
|
end
|
33
32
|
|
34
33
|
it "specifies the bucket" do
|
35
|
-
out = execute("bin/gantree init -u #{@user} -b
|
36
|
-
expect(out).to include "bucket:
|
34
|
+
out = execute("bin/gantree init -u #{@user} -b docker-cfgs #{@owner}/#{@repo}:#{@tag} --dry-run")
|
35
|
+
expect(out).to include "bucket: docker-cfgs"
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
39
|
describe "deploy" do
|
41
40
|
it "should deploy images" do
|
42
41
|
execute("bin/gantree init #{@owner}/#{@repo}:#{@tag} --dry-run")
|
43
|
-
out = execute("bin/gantree deploy #{@env} --dry-run --silent")
|
42
|
+
out = execute("bin/gantree deploy #{@env} --dry-run --eb-bucket br-eb-versions --silent")
|
44
43
|
expect(out).to include("Found Application: #{@env}")
|
45
44
|
expect(out).to include("silent: silent")
|
46
45
|
end
|
47
46
|
|
48
47
|
it "should deploy images with remote extensions" do
|
49
|
-
out = execute("bin/gantree deploy #{@app} -x 'git@github.com:br/.ebextensions' --dry-run --silent")
|
48
|
+
out = execute("bin/gantree deploy #{@app} -x 'git@github.com:br/.ebextensions' --eb-bucket br-eb-versions --dry-run --silent")
|
50
49
|
expect(out).to include("Found Environment: #{@app}")
|
51
|
-
expect(out).to include("
|
50
|
+
expect(out).to include(".ebextensions")
|
52
51
|
expect(out).to include("silent: silent")
|
53
52
|
end
|
54
53
|
|
55
54
|
it "should deploy images with remote extensions on a branch" do
|
56
|
-
out = execute("bin/gantree deploy #{@env} -x 'git@github.com:br/.ebextensions:basic' --dry-run --silent")
|
55
|
+
out = execute("bin/gantree deploy #{@env} -x 'git@github.com:br/.ebextensions:basic' --eb-bucket br_eb_versions --dry-run --silent")
|
57
56
|
expect(out).to include("Found Application: #{@env}")
|
58
|
-
expect(out).to include("
|
57
|
+
expect(out).to include(".ebextensions:basic")
|
59
58
|
expect(out).to include("silent: silent")
|
60
59
|
end
|
61
60
|
|
62
61
|
it "should notify slack of deploys" do
|
63
|
-
out = execute("bin/gantree deploy #{@env} --dry-run")
|
62
|
+
out = execute("bin/gantree deploy #{@env} --eb-bucket br_eb_versions --dry-run")
|
64
63
|
expect(out).to include("Found Application: #{@env}")
|
65
64
|
end
|
66
65
|
end
|
67
|
-
|
66
|
+
=begin
|
68
67
|
describe "create" do
|
69
68
|
it "should create clusters" do
|
70
69
|
out = execute("bin/gantree create #{@env} --dry-run --cfn-bucket templates")
|
@@ -103,7 +102,7 @@ describe Gantree::CLI do
|
|
103
102
|
expect(out).to include "Deleting"
|
104
103
|
end
|
105
104
|
end
|
106
|
-
|
105
|
+
=end
|
107
106
|
describe "#version" do
|
108
107
|
it "should output gantree version" do
|
109
108
|
out = execute("bin/gantree version")
|
@@ -16,20 +16,12 @@ describe Gantree::Deploy do
|
|
16
16
|
|
17
17
|
it "returns branch name of repo url" do
|
18
18
|
options = { ext: "git@github.com:br/.ebextensions:basic" }
|
19
|
-
|
20
|
-
expect(deploy.send(:get_ext_branch)).to eq "basic"
|
19
|
+
expect(Gantree::DeployVersion.new(options).send(:get_ext_branch)).to eq "basic"
|
21
20
|
end
|
22
21
|
|
23
22
|
it "returns just the repo url" do
|
24
23
|
options = { ext: "git@github.com:br/.ebextensions:basic" }
|
25
|
-
|
26
|
-
expect(deploy.send(:get_ext_repo)).to eq "git@github.com:br/.ebextensions"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "sets app roles if enabled" do
|
30
|
-
options = { autodetect_app_role: true}
|
31
|
-
deploy = Gantree::Deploy.new("stag-knarr-listener-s1", options)
|
32
|
-
expect(deploy.send(:autodetect_app_role, "stag-knarr-listener-s1")).to eq([{:option_name=>"ROLE", :value=>"listener", :namespace=>"aws:elasticbeanstalk:application:environment"}])
|
24
|
+
expect(Gantree::DeployVersion.new(options).send(:get_ext_repo)).to eq "git@github.com:br/.ebextensions"
|
33
25
|
end
|
34
26
|
|
35
27
|
it "AWS gets the correct keys" do
|
@@ -77,4 +69,4 @@ def dockerrun
|
|
77
69
|
]
|
78
70
|
}
|
79
71
|
'
|
80
|
-
end
|
72
|
+
end
|
metadata
CHANGED
@@ -1,100 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gantree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Felix
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: thor
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: aws-sdk-v1
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 1.55.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 1.55.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: hashie
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: colorize
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rubyzip
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: cloudformation-ruby-dsl
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - '='
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - '='
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,39 +97,34 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: archive-zip
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- - ~>
|
101
|
+
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 0.7.0
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- - ~>
|
108
|
+
- - "~>"
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: 0.7.0
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: json
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ">="
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :runtime
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - ">="
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: slackr
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
129
|
- - '='
|
148
130
|
- !ruby/object:Gem::Version
|
@@ -150,7 +132,6 @@ dependencies:
|
|
150
132
|
type: :runtime
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
136
|
- - '='
|
156
137
|
- !ruby/object:Gem::Version
|
@@ -158,129 +139,113 @@ dependencies:
|
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: highline
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
|
-
- -
|
143
|
+
- - ">="
|
164
144
|
- !ruby/object:Gem::Version
|
165
145
|
version: '0'
|
166
146
|
type: :runtime
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- -
|
150
|
+
- - ">="
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: '0'
|
174
153
|
- !ruby/object:Gem::Dependency
|
175
154
|
name: pry
|
176
155
|
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
156
|
requirements:
|
179
|
-
- -
|
157
|
+
- - ">="
|
180
158
|
- !ruby/object:Gem::Version
|
181
159
|
version: '0'
|
182
160
|
type: :runtime
|
183
161
|
prerelease: false
|
184
162
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
163
|
requirements:
|
187
|
-
- -
|
164
|
+
- - ">="
|
188
165
|
- !ruby/object:Gem::Version
|
189
166
|
version: '0'
|
190
167
|
- !ruby/object:Gem::Dependency
|
191
168
|
name: bundler
|
192
169
|
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
170
|
requirements:
|
195
|
-
- - ~>
|
171
|
+
- - "~>"
|
196
172
|
- !ruby/object:Gem::Version
|
197
173
|
version: '1.3'
|
198
174
|
type: :development
|
199
175
|
prerelease: false
|
200
176
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
177
|
requirements:
|
203
|
-
- - ~>
|
178
|
+
- - "~>"
|
204
179
|
- !ruby/object:Gem::Version
|
205
180
|
version: '1.3'
|
206
181
|
- !ruby/object:Gem::Dependency
|
207
182
|
name: rake
|
208
183
|
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
184
|
requirements:
|
211
|
-
- -
|
185
|
+
- - ">="
|
212
186
|
- !ruby/object:Gem::Version
|
213
187
|
version: '0'
|
214
188
|
type: :development
|
215
189
|
prerelease: false
|
216
190
|
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
191
|
requirements:
|
219
|
-
- -
|
192
|
+
- - ">="
|
220
193
|
- !ruby/object:Gem::Version
|
221
194
|
version: '0'
|
222
195
|
- !ruby/object:Gem::Dependency
|
223
196
|
name: guard
|
224
197
|
requirement: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
198
|
requirements:
|
227
|
-
- -
|
199
|
+
- - ">="
|
228
200
|
- !ruby/object:Gem::Version
|
229
201
|
version: '0'
|
230
202
|
type: :development
|
231
203
|
prerelease: false
|
232
204
|
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
none: false
|
234
205
|
requirements:
|
235
|
-
- -
|
206
|
+
- - ">="
|
236
207
|
- !ruby/object:Gem::Version
|
237
208
|
version: '0'
|
238
209
|
- !ruby/object:Gem::Dependency
|
239
210
|
name: guard-bundler
|
240
211
|
requirement: !ruby/object:Gem::Requirement
|
241
|
-
none: false
|
242
212
|
requirements:
|
243
|
-
- -
|
213
|
+
- - ">="
|
244
214
|
- !ruby/object:Gem::Version
|
245
215
|
version: '0'
|
246
216
|
type: :development
|
247
217
|
prerelease: false
|
248
218
|
version_requirements: !ruby/object:Gem::Requirement
|
249
|
-
none: false
|
250
219
|
requirements:
|
251
|
-
- -
|
220
|
+
- - ">="
|
252
221
|
- !ruby/object:Gem::Version
|
253
222
|
version: '0'
|
254
223
|
- !ruby/object:Gem::Dependency
|
255
224
|
name: guard-rspec
|
256
225
|
requirement: !ruby/object:Gem::Requirement
|
257
|
-
none: false
|
258
226
|
requirements:
|
259
|
-
- -
|
227
|
+
- - ">="
|
260
228
|
- !ruby/object:Gem::Version
|
261
229
|
version: '0'
|
262
230
|
type: :development
|
263
231
|
prerelease: false
|
264
232
|
version_requirements: !ruby/object:Gem::Requirement
|
265
|
-
none: false
|
266
233
|
requirements:
|
267
|
-
- -
|
234
|
+
- - ">="
|
268
235
|
- !ruby/object:Gem::Version
|
269
236
|
version: '0'
|
270
237
|
- !ruby/object:Gem::Dependency
|
271
238
|
name: vcr
|
272
239
|
requirement: !ruby/object:Gem::Requirement
|
273
|
-
none: false
|
274
240
|
requirements:
|
275
|
-
- -
|
241
|
+
- - ">="
|
276
242
|
- !ruby/object:Gem::Version
|
277
243
|
version: '0'
|
278
244
|
type: :development
|
279
245
|
prerelease: false
|
280
246
|
version_requirements: !ruby/object:Gem::Requirement
|
281
|
-
none: false
|
282
247
|
requirements:
|
283
|
-
- -
|
248
|
+
- - ">="
|
284
249
|
- !ruby/object:Gem::Version
|
285
250
|
version: '0'
|
286
251
|
description: cli tool for automating docker deploys to elastic beanstalk
|
@@ -291,9 +256,9 @@ executables:
|
|
291
256
|
extensions: []
|
292
257
|
extra_rdoc_files: []
|
293
258
|
files:
|
294
|
-
- .gitignore
|
295
|
-
- .ruby-version
|
296
|
-
- .travis.yml
|
259
|
+
- ".gitignore"
|
260
|
+
- ".ruby-version"
|
261
|
+
- ".travis.yml"
|
297
262
|
- Gemfile
|
298
263
|
- Gemfile.lock
|
299
264
|
- Guardfile
|
@@ -301,6 +266,7 @@ files:
|
|
301
266
|
- README.md
|
302
267
|
- Rakefile
|
303
268
|
- bin/gantree
|
269
|
+
- circle.yml
|
304
270
|
- gantree.gemspec
|
305
271
|
- lib/gantree.rb
|
306
272
|
- lib/gantree/app.rb
|
@@ -313,53 +279,48 @@ files:
|
|
313
279
|
- lib/gantree/create.rb
|
314
280
|
- lib/gantree/delete.rb
|
315
281
|
- lib/gantree/deploy.rb
|
282
|
+
- lib/gantree/deploy_applications.rb
|
283
|
+
- lib/gantree/deploy_version.rb
|
316
284
|
- lib/gantree/docker.rb
|
317
285
|
- lib/gantree/init.rb
|
318
286
|
- lib/gantree/notification.rb
|
319
287
|
- lib/gantree/update.rb
|
320
288
|
- lib/gantree/version.rb
|
321
289
|
- spec/lib/gantree/cli_spec.rb
|
322
|
-
- spec/lib/gantree/create_spec.rb
|
323
|
-
- spec/lib/gantree/delete_spec.rb
|
324
290
|
- spec/lib/gantree/deploy_spec.rb
|
325
291
|
- spec/lib/gantree/docker_spec.rb
|
326
292
|
- spec/lib/gantree/init_spec.rb
|
327
|
-
- spec/lib/gantree/update_spec.rb
|
328
293
|
- spec/spec_helper.rb
|
329
294
|
homepage: https://github.com/feelobot/gantree
|
330
295
|
licenses:
|
331
296
|
- MIT
|
297
|
+
metadata: {}
|
332
298
|
post_install_message:
|
333
299
|
rdoc_options: []
|
334
300
|
require_paths:
|
335
301
|
- lib
|
336
302
|
required_ruby_version: !ruby/object:Gem::Requirement
|
337
|
-
none: false
|
338
303
|
requirements:
|
339
|
-
- -
|
304
|
+
- - ">="
|
340
305
|
- !ruby/object:Gem::Version
|
341
306
|
version: '0'
|
342
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
|
-
none: false
|
344
308
|
requirements:
|
345
|
-
- -
|
309
|
+
- - ">="
|
346
310
|
- !ruby/object:Gem::Version
|
347
311
|
version: '0'
|
348
312
|
requirements: []
|
349
313
|
rubyforge_project:
|
350
|
-
rubygems_version:
|
314
|
+
rubygems_version: 2.2.2
|
351
315
|
signing_key:
|
352
|
-
specification_version:
|
316
|
+
specification_version: 4
|
353
317
|
summary: This tool is intended to help you setup a Dockerrun.aws.json which allows
|
354
318
|
you to deploy a prebuilt image of your application to Elastic Beanstalk. This also
|
355
319
|
allows you to do versioned deploys to your Elastic Beanstalk application and create
|
356
320
|
an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service.
|
357
321
|
test_files:
|
358
322
|
- spec/lib/gantree/cli_spec.rb
|
359
|
-
- spec/lib/gantree/create_spec.rb
|
360
|
-
- spec/lib/gantree/delete_spec.rb
|
361
323
|
- spec/lib/gantree/deploy_spec.rb
|
362
324
|
- spec/lib/gantree/docker_spec.rb
|
363
325
|
- spec/lib/gantree/init_spec.rb
|
364
|
-
- spec/lib/gantree/update_spec.rb
|
365
326
|
- spec/spec_helper.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "pry"
|
3
|
-
|
4
|
-
describe Gantree::Update do
|
5
|
-
before(:all) do
|
6
|
-
ENV['AWS_ACCESS_KEY_ID'] = 'FAKE_AWS_ACCESS_KEY'
|
7
|
-
ENV['AWS_SECRET_ACCESS_KEY'] = 'FAKE_AWS_SECRET_ACCESS_KEY'
|
8
|
-
|
9
|
-
@stack_name = "knarr-stag-s1"
|
10
|
-
@env = "stag-knarr-app-s1"
|
11
|
-
@owner = "bleacher"
|
12
|
-
@repo = "cauldron"
|
13
|
-
@tag = "master"
|
14
|
-
@user = "feelobot"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "performs a cloudformation stack create"
|
18
|
-
it "can add an application role to the stack template"
|
19
|
-
it "can update to a specific solution stack"
|
20
|
-
it "can update to the latest solution stack automatically"
|
21
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "pry"
|
3
|
-
|
4
|
-
describe Gantree::Delete do
|
5
|
-
before(:all) do
|
6
|
-
AWS.stub!
|
7
|
-
ENV['AWS_ACCESS_KEY_ID'] = 'FAKE_AWS_ACCESS_KEY'
|
8
|
-
ENV['AWS_SECRET_ACCESS_KEY'] = 'FAKE_AWS_SECRET_ACCESS_KEY'
|
9
|
-
@stack_name = "knarr-stag-s1"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "prompts for confirmation"
|
13
|
-
it "prompt requires 'y' to delete"
|
14
|
-
it "prompt is canceled on any other input"
|
15
|
-
let(:delete) { Gantree::Delete.new(@stack_name,{:force => true})}
|
16
|
-
it "prompt can be overrided with --force" do
|
17
|
-
expect { delete.run}.to output("Deleting stack from aws\n").to_stdout
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "pry"
|
3
|
-
|
4
|
-
describe Gantree::Update do
|
5
|
-
before(:all) do
|
6
|
-
AWS.stub!
|
7
|
-
ENV['AWS_ACCESS_KEY_ID'] = 'FAKE_AWS_ACCESS_KEY'
|
8
|
-
ENV['AWS_SECRET_ACCESS_KEY'] = 'FAKE_AWS_SECRET_ACCESS_KEY'
|
9
|
-
|
10
|
-
@stack_name = "cms-stag-s2"
|
11
|
-
@env = "stag-cms-app-s1"
|
12
|
-
@owner = "bleacher"
|
13
|
-
@repo = "cauldron"
|
14
|
-
@tag = "master"
|
15
|
-
@user = "feelobot"
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:update) { Gantree::Update.new(@stack_name,{:dry_run => true}).run}
|
19
|
-
it "performs a cloudformation stack update" do
|
20
|
-
expect { update }.to output("Updating stack from local cfn repo\n").to_stdout
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "change_solution_stack" do
|
24
|
-
let!(:update) { Gantree::Update.new(@stack_name,{:dry_run => true,:solution => "64bit Amazon Linux 2014.09 v1.0.10 running Docker 1.3.2"})}
|
25
|
-
it "can update to a specific solution stack using --role 'solution name'" do
|
26
|
-
expect { update.change_solution_stack }.to output("\e[0;32;49mUpdated solution to 64bit Amazon Linux 2014.09 v1.0.10 running Docker 1.3.2\e[0m\n").to_stdout
|
27
|
-
end
|
28
|
-
let!(:update) { Gantree::Update.new(@stack_name,{:dry_run => true,:solution => "64bit Amazon Linux 2014.09 v1.0.10 running Docker 1.3.2"})}
|
29
|
-
it "can update to the latest solution stack automatically using --role latest" do
|
30
|
-
#expect { update.get_latest_docker_solution }.to output("asda").to_stdout
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "add_role" do
|
35
|
-
let(:update) { Gantree::Update.new(@stack_name,{:role => "worker", :dry_run => true})}
|
36
|
-
it "can add an worker role to the stack template with --role" do
|
37
|
-
expect{ update.add_role "worker"}.to_not output("\e[0;31;49mRole already exists\e[0m\n").to_stdout
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|