mtncd 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +77 -0
- data/README.md +27 -0
- data/README.rdoc +6 -0
- data/Rakefile +45 -0
- data/bin/mtncd +300 -0
- data/features/mtncd.feature +8 -0
- data/features/step_definitions/mtncd_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/mtncd/version.rb +3 -0
- data/lib/mtncd.rb +4 -0
- data/mtncd.gemspec +28 -0
- data/mtncd.rdoc +5 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +192 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTJlNzcwODU3MjhkMGRkNDlhNDYwOTgwZTBjZTM3MGRkZTA0N2I3Mg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTlmZjJhOTE1M2FhOTM2Yzg4Yjk2ZTU0ODc4NmVlYTZmMjVjNDA1NQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzlkZDgwOGE4ZjRhZGExMzQ4MjkzNWVmMmNiYzJjYmEzOWU5NTQ4ZTBiNjRi
|
10
|
+
ZTgxNWEzMTMzODQyMTg5NmEzYjkzOGZiOGNiYmYwZmVhZGE5Zjc3NTZhN2Yy
|
11
|
+
YWY1NzNiNGJhY2E0NTQwY2QyYzg2ZDVjOGY4NmFiZmM0MGYyM2Y=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTY5YjYwMGIxN2E3ODVmZDMwYmE3Y2FhYWI3MzUyZDI5MWMyYTY0YTI5Y2Yw
|
14
|
+
YTNhNmUxN2YyOWMwZGQ0YTk5OWU5ZTU5YjEzMDM2YjdiY2ZmNGRlMWMxZTMy
|
15
|
+
NDlhYThjZWQzNDc1YTcxZDc0NjhiNGZiMWZmYTE3MDFmMGE3Yjc=
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mtncd (0.0.1)
|
5
|
+
awesome_print
|
6
|
+
gli (= 2.12.2)
|
7
|
+
msgpack
|
8
|
+
redis
|
9
|
+
resque
|
10
|
+
serfx
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
aruba (0.6.1)
|
16
|
+
childprocess (>= 0.3.6)
|
17
|
+
cucumber (>= 1.1.1)
|
18
|
+
rspec-expectations (>= 2.7.0)
|
19
|
+
awesome_print (1.2.0)
|
20
|
+
builder (3.2.2)
|
21
|
+
childprocess (0.5.5)
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
23
|
+
cucumber (1.3.17)
|
24
|
+
builder (>= 2.1.2)
|
25
|
+
diff-lcs (>= 1.1.3)
|
26
|
+
gherkin (~> 2.12)
|
27
|
+
multi_json (>= 1.7.5, < 2.0)
|
28
|
+
multi_test (>= 0.1.1)
|
29
|
+
diff-lcs (1.2.5)
|
30
|
+
ffi (1.9.6)
|
31
|
+
gherkin (2.12.2)
|
32
|
+
multi_json (~> 1.3)
|
33
|
+
gli (2.12.2)
|
34
|
+
json (1.8.1)
|
35
|
+
mixlib-log (1.6.0)
|
36
|
+
mono_logger (1.1.0)
|
37
|
+
msgpack (0.5.8)
|
38
|
+
multi_json (1.10.1)
|
39
|
+
multi_test (0.1.1)
|
40
|
+
rack (1.5.2)
|
41
|
+
rack-protection (1.5.3)
|
42
|
+
rack
|
43
|
+
rake (10.3.2)
|
44
|
+
rdoc (4.1.2)
|
45
|
+
json (~> 1.4)
|
46
|
+
redis (3.1.0)
|
47
|
+
redis-namespace (1.5.1)
|
48
|
+
redis (~> 3.0, >= 3.0.4)
|
49
|
+
resque (1.25.2)
|
50
|
+
mono_logger (~> 1.0)
|
51
|
+
multi_json (~> 1.0)
|
52
|
+
redis-namespace (~> 1.3)
|
53
|
+
sinatra (>= 0.9.2)
|
54
|
+
vegas (~> 0.1.2)
|
55
|
+
rspec-expectations (3.1.2)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.1.0)
|
58
|
+
rspec-support (3.1.2)
|
59
|
+
serfx (0.0.7)
|
60
|
+
mixlib-log
|
61
|
+
msgpack
|
62
|
+
sinatra (1.4.5)
|
63
|
+
rack (~> 1.4)
|
64
|
+
rack-protection (~> 1.4)
|
65
|
+
tilt (~> 1.3, >= 1.3.4)
|
66
|
+
tilt (1.4.1)
|
67
|
+
vegas (0.1.11)
|
68
|
+
rack (>= 1.0.0)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
aruba
|
75
|
+
mtncd!
|
76
|
+
rake
|
77
|
+
rdoc
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Example yaml config file (.mtncdconf)
|
2
|
+
---
|
3
|
+
node: test
|
4
|
+
role: central
|
5
|
+
default_exclude: mtn\-aws2
|
6
|
+
deploy:
|
7
|
+
global:
|
8
|
+
stop: stop_deploy
|
9
|
+
start: deploy
|
10
|
+
local:
|
11
|
+
stop: stop_deploy
|
12
|
+
start: deploy
|
13
|
+
system:
|
14
|
+
resque:
|
15
|
+
workers: 0
|
16
|
+
redis:
|
17
|
+
ip: 127.0.0.1
|
18
|
+
port: 6379
|
19
|
+
serf:
|
20
|
+
global:
|
21
|
+
ip: < some ip >
|
22
|
+
port: < some port >
|
23
|
+
auth: super secret token
|
24
|
+
local:
|
25
|
+
ip: < some ip >
|
26
|
+
port: < some port >
|
27
|
+
auth: super secret token
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
require "bundler/gem_tasks"
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = "README.rdoc"
|
10
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
11
|
+
rd.title = 'Your application title'
|
12
|
+
end
|
13
|
+
|
14
|
+
spec = eval(File.read('mtncd.gemspec'))
|
15
|
+
|
16
|
+
Gem::PackageTask.new(spec) do |pkg|
|
17
|
+
end
|
18
|
+
CUKE_RESULTS = 'results.html'
|
19
|
+
CLEAN << CUKE_RESULTS
|
20
|
+
desc 'Run features'
|
21
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
22
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
23
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
24
|
+
t.cucumber_opts = opts
|
25
|
+
t.fork = false
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
29
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
30
|
+
tag_opts = ' --tags ~@pending'
|
31
|
+
tag_opts = ' --tags @wip'
|
32
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
33
|
+
t.fork = false
|
34
|
+
end
|
35
|
+
|
36
|
+
task :cucumber => :features
|
37
|
+
task 'cucumber:wip' => 'features:wip'
|
38
|
+
task :wip => 'features:wip'
|
39
|
+
require 'rake/testtask'
|
40
|
+
Rake::TestTask.new do |t|
|
41
|
+
t.libs << "test"
|
42
|
+
t.test_files = FileList['test/*_test.rb']
|
43
|
+
end
|
44
|
+
|
45
|
+
task :default => [:test,:features]
|
data/bin/mtncd
ADDED
@@ -0,0 +1,300 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding
|
3
|
+
require 'gli'
|
4
|
+
begin # XXX: Remove this begin/rescue before distributing your app
|
5
|
+
require 'mtncd'
|
6
|
+
require 'yaml'
|
7
|
+
require 'securerandom'
|
8
|
+
require 'serfx'
|
9
|
+
require 'resque'
|
10
|
+
require 'msgpack'
|
11
|
+
require 'awesome_print'
|
12
|
+
require 'redis'
|
13
|
+
require 'open3'
|
14
|
+
|
15
|
+
rescue LoadError
|
16
|
+
STDERR.puts "In development, you need to use `bundle exec bin/mtncd` to run your app"
|
17
|
+
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
18
|
+
STDERR.puts "Feel free to remove this message from bin/mtncd now"
|
19
|
+
exit 64
|
20
|
+
end
|
21
|
+
|
22
|
+
include GLI::App
|
23
|
+
|
24
|
+
program_desc 'Helper tools for controlling MTN CICD pipeline'
|
25
|
+
|
26
|
+
version Mtncd::VERSION
|
27
|
+
|
28
|
+
subcommand_option_handling :normal
|
29
|
+
arguments :strict
|
30
|
+
|
31
|
+
desc 'start or stop a deployment'
|
32
|
+
command :deploy do |deploy|
|
33
|
+
|
34
|
+
deploy.desc "starts a deployment"
|
35
|
+
deploy.command :start do |start|
|
36
|
+
|
37
|
+
start.desc 'deploy starting with environment'
|
38
|
+
start.default_value 'integration'
|
39
|
+
start.flag :env, :must_match => {
|
40
|
+
'integration' => :integ,
|
41
|
+
'staging' => :stage,
|
42
|
+
'prod' => :prod
|
43
|
+
}
|
44
|
+
|
45
|
+
start.desc 'use deployment id'
|
46
|
+
start.default_value SecureRandom.uuid
|
47
|
+
start.flag :id
|
48
|
+
|
49
|
+
start.desc 'local or global cluster command'
|
50
|
+
start.default_value 'global'
|
51
|
+
start.flag :cluster, :must_match => {
|
52
|
+
'global' => :global,
|
53
|
+
'local' => :local
|
54
|
+
}
|
55
|
+
|
56
|
+
start.desc 'regex matching shipcodes to exclude from a deploy (overrides config file)'
|
57
|
+
start.flag :exclude
|
58
|
+
|
59
|
+
start.desc 'comma-separated list of ship codes'
|
60
|
+
start.flag :ships
|
61
|
+
|
62
|
+
start.desc 'single deployment (environment or ship)'
|
63
|
+
start.default_value false
|
64
|
+
start.switch :single
|
65
|
+
|
66
|
+
start.action do |global_options,options,args|
|
67
|
+
if $config['role'] == 'sled' && options[:cluster] == :global
|
68
|
+
raise "global commands are only available on central or infra nodes"
|
69
|
+
end
|
70
|
+
|
71
|
+
if $config['role'] == 'central' && options[:cluster] == :local
|
72
|
+
raise "local commands are only available on infra or sled nodes"
|
73
|
+
end
|
74
|
+
|
75
|
+
event_options_hash = {
|
76
|
+
'id' => "#{options[:id]}",
|
77
|
+
'single' => options[:single],
|
78
|
+
}
|
79
|
+
event_options_hash['exclusion'] = options[:exclude].nil? ? $config['default_exclude'] : options[:exclude]
|
80
|
+
event_options_hash['env'] = options[:env] unless options[:env].nil?
|
81
|
+
event_options_hash['shipcodes'] = options[:ships].split(",") unless options[:ships].nil?
|
82
|
+
|
83
|
+
serf_options_hash = {
|
84
|
+
'ip' => $config['system']['serf'][options[:cluster]]['ip'],
|
85
|
+
'port' => $config['system']['serf'][options[:cluster]]['port'],
|
86
|
+
'auth' => $config['system']['serf'][options[:cluster]]['auth'],
|
87
|
+
'event' => $config['deploy'][options[:cluster]]['start']
|
88
|
+
}
|
89
|
+
|
90
|
+
begin
|
91
|
+
Serfx.connect(host: serf_options_hash['ip'], port: serf_options_hash['port'], authkey: serf_options_hash['auth']) do |conn|
|
92
|
+
resp = conn.event(serf_options_hash['event'], event_options_hash.to_msgpack, false)
|
93
|
+
puts "deploy start success: #{resp.body}"
|
94
|
+
end
|
95
|
+
rescue Serfx::RPCError => e
|
96
|
+
raise "Error running 'deploy start' : #{e.message}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
deploy.desc "stops a deployment"
|
102
|
+
deploy.command :stop do |stop|
|
103
|
+
stop.desc 'use deployment id'
|
104
|
+
stop.flag :id, :required => true
|
105
|
+
|
106
|
+
stop.desc 'local or global cluster command'
|
107
|
+
stop.default_value 'global'
|
108
|
+
stop.flag :cluster, :must_match => {
|
109
|
+
"global" => :global,
|
110
|
+
"local" => :local
|
111
|
+
}
|
112
|
+
|
113
|
+
stop.action do |global_options,options,args|
|
114
|
+
if $config['role'] == 'sled' && options[:cluster] == :global
|
115
|
+
raise "global commands are only available on central or infra nodes"
|
116
|
+
end
|
117
|
+
|
118
|
+
if $config['role'] == 'central' && options[:cluster] == :local
|
119
|
+
raise "local commands are only available on infra or sled nodes"
|
120
|
+
end
|
121
|
+
|
122
|
+
event_options_hash = {
|
123
|
+
'id' => "#{options[:id]}"
|
124
|
+
}
|
125
|
+
|
126
|
+
serf_options_hash = {
|
127
|
+
'ip' => $config['system']['serf'][options[:cluster]]['ip'],
|
128
|
+
'port' => $config['system']['serf'][options[:cluster]]['port'],
|
129
|
+
'auth' => $config['system']['serf'][options[:cluster]]['auth'],
|
130
|
+
'event' => $config['deploy'][options[:cluster]]['stop']
|
131
|
+
}
|
132
|
+
|
133
|
+
begin
|
134
|
+
Serfx.connect(host: serf_options_hash['ip'], port: serf_options_hash['port'], authkey: serf_options_hash['auth']) do |conn|
|
135
|
+
resp = conn.event(serf_options_hash['event'], event_options_hash.to_msgpack, false)
|
136
|
+
puts "deploy stop success: #{resp.body}"
|
137
|
+
end
|
138
|
+
rescue Serfx::RPCError => e
|
139
|
+
raise "Error running 'deploy stop' : #{e.message}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
deploy.desc "checks the status of a deployment"
|
145
|
+
deploy.command :status do |status|
|
146
|
+
status.action do |global_options,options,args|
|
147
|
+
puts "not yet implemented"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
desc 'cluster status'
|
154
|
+
command :status do |status|
|
155
|
+
status.desc 'local or global cluster'
|
156
|
+
status.default_value 'global'
|
157
|
+
status.flag :cluster, :must_match => {
|
158
|
+
'global' => :global,
|
159
|
+
'local' => :local
|
160
|
+
}
|
161
|
+
|
162
|
+
status.action do |global_options,options,args|
|
163
|
+
if $config['role'] == 'sled' && options[:cluster] == :global
|
164
|
+
raise "global status is only available on central or infra nodes"
|
165
|
+
end
|
166
|
+
|
167
|
+
if $config['role'] == 'central' && options[:cluster] == :local
|
168
|
+
raise "local status is only available on infra or sled nodes"
|
169
|
+
end
|
170
|
+
|
171
|
+
serf_options_hash = {
|
172
|
+
'ip' => $config['system']['serf'][options[:cluster]]['ip'],
|
173
|
+
'port' => $config['system']['serf'][options[:cluster]]['port'],
|
174
|
+
'auth' => $config['system']['serf'][options[:cluster]]['auth']
|
175
|
+
}
|
176
|
+
|
177
|
+
command_string = serf_options_hash['auth'].nil? ? "serf members -rpc-addr=#{serf_options_hash['ip']}:#{serf_options_hash['port']}" : "serf members -rpc-addr=#{serf_options_hash['ip']}:#{serf_options_hash['port']} -rpc-auth=#{serf_options_hash['auth']}"
|
178
|
+
|
179
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3(command_string)
|
180
|
+
if wait_thr.value == 0
|
181
|
+
puts stdout.read
|
182
|
+
else
|
183
|
+
puts "local failed: #{stdout.read}"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
desc 'Status of pipeline components on this particular machine'
|
190
|
+
command :system do |system|
|
191
|
+
system.action do |global_options,options,args|
|
192
|
+
success = true
|
193
|
+
# check redis
|
194
|
+
result = "OK"
|
195
|
+
begin
|
196
|
+
redis = Redis.new(:host => $config['system']['redis']['ip'], :port => $config['system']['redis']['port'])
|
197
|
+
rescue
|
198
|
+
result = "\033[31mFAIL\033[0m"
|
199
|
+
success = false
|
200
|
+
end
|
201
|
+
puts "Redis - Connected to #{$config['system']['redis']['ip']}:#{$config['system']['redis']['port']} - [#{result}]"
|
202
|
+
|
203
|
+
# check resque
|
204
|
+
Resque.redis = "#{$config['system']['redis']['ip']}:#{$config['system']['redis']['port']}"
|
205
|
+
result = (Resque.workers.count == $config['system']['resque']['workers']) ? "OK" : "\033[31mFAIL\033[0m"
|
206
|
+
success = Resque.workers.count == $config['system']['resque']['workers'] unless success == false
|
207
|
+
puts "Resque - Should have #{$config['system']['resque']['workers']} workers, running #{Resque.workers.count} workers - [#{result}]"
|
208
|
+
|
209
|
+
# check serf
|
210
|
+
if $config['role'] != 'central'
|
211
|
+
begin
|
212
|
+
Serfx.connect(host: $config['system']['serf']['local']['ip'], port: $config['system']['serf']['local']['port'], authkey:$config['system']['serf']['local']['auth']) do |conn|
|
213
|
+
result = (conn.members.body['Members'].length > 1) ? "OK" : "\033[31mFAIL\033[0m"
|
214
|
+
end
|
215
|
+
rescue Serfx::RPCError => e
|
216
|
+
result = "\033[31mFAIL\033[0m"
|
217
|
+
success = false
|
218
|
+
end
|
219
|
+
|
220
|
+
puts "Serf Local Cluster - connected and has more than one member - [#{result}]"
|
221
|
+
end
|
222
|
+
|
223
|
+
if $config['role'] != 'sled'
|
224
|
+
begin
|
225
|
+
Serfx.connect(host: $config['system']['serf']['global']['ip'], port: $config['system']['serf']['global']['port'], authkey:$config['system']['serf']['global']['auth']) do |conn|
|
226
|
+
result = (conn.members.body['Members'].length > 1) ? "OK" : "\033[31mFAIL\033[0m"
|
227
|
+
end
|
228
|
+
rescue Serfx::RPCError => e
|
229
|
+
result = "\033[31mFAIL\033[0m"
|
230
|
+
success = false
|
231
|
+
end
|
232
|
+
|
233
|
+
puts "Serf Global Cluster - connected and has more than one member - [#{result}]"
|
234
|
+
end
|
235
|
+
|
236
|
+
raise "Pipeline node #{$config['node']} is likely unstable" unless success == true
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
pre do |global,command,options,args|
|
241
|
+
$config = nil
|
242
|
+
begin
|
243
|
+
$config = YAML.load_file(File.join(Dir.home, '.mtncdconf'))
|
244
|
+
rescue
|
245
|
+
raise "Missing #{File.join(Dir.home, '.mtncdconf')}"
|
246
|
+
end
|
247
|
+
|
248
|
+
# check the file
|
249
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['node'].nil?
|
250
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['role'].nil?
|
251
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy'].nil?
|
252
|
+
|
253
|
+
if $config['role'] == 'central' || $config['role'] == 'ship'
|
254
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy']['global'].nil?
|
255
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy']['global']['stop'].nil?
|
256
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy']['global']['start'].nil?
|
257
|
+
end
|
258
|
+
|
259
|
+
if $config['role'] == 'ship' || $config['role'] == 'sled'
|
260
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy']['local'].nil?
|
261
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy']['local']['stop'].nil?
|
262
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['deploy']['local']['start'].nil?
|
263
|
+
end
|
264
|
+
|
265
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system'].nil?
|
266
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['resque'].nil?
|
267
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['resque']['workers'].nil?
|
268
|
+
|
269
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['redis'].nil?
|
270
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['redis']['ip'].nil?
|
271
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['redis']['port'].nil?
|
272
|
+
|
273
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf'].nil?
|
274
|
+
if $config['role'] == 'central' || $config['role'] == 'ship'
|
275
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf']['global'].nil?
|
276
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf']['global']['ip'].nil?
|
277
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf']['global']['port'].nil?
|
278
|
+
end
|
279
|
+
if $config['role'] == 'ship' || $config['role'] == 'sled'
|
280
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf']['local'].nil?
|
281
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf']['local']['ip'].nil?
|
282
|
+
raise "Invalid #{File.join(Dir.home, '.mtncdconf')}" if $config['system']['serf']['local']['port'].nil?
|
283
|
+
end
|
284
|
+
|
285
|
+
true
|
286
|
+
end
|
287
|
+
|
288
|
+
post do |global,command,options,args|
|
289
|
+
# Post logic here
|
290
|
+
# Use skips_post before a command to skip this
|
291
|
+
# block on that command only
|
292
|
+
end
|
293
|
+
|
294
|
+
on_error do |exception|
|
295
|
+
# Error logic here
|
296
|
+
# return false to skip default error handling
|
297
|
+
true
|
298
|
+
end
|
299
|
+
|
300
|
+
exit run(ARGV)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
data/lib/mtncd.rb
ADDED
data/mtncd.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','mtncd','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'mtncd'
|
5
|
+
s.version = Mtncd::VERSION
|
6
|
+
s.author = 'MTN Satellite Communications'
|
7
|
+
s.email = 'marat_garafutdinov@mtnsat.com'
|
8
|
+
s.homepage = 'https://github.com/mtnsat'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'A helper tool for MTN CICD pipeline'
|
11
|
+
s.files = `git ls-files`.split("
|
12
|
+
")
|
13
|
+
s.require_paths << 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.extra_rdoc_files = ['README.rdoc','mtncd.rdoc']
|
16
|
+
s.rdoc_options << '--title' << 'mtncd' << '--main' << 'README.rdoc' << '-ri'
|
17
|
+
s.bindir = 'bin'
|
18
|
+
s.executables << 'mtncd'
|
19
|
+
s.add_dependency('resque', '1.25.2')
|
20
|
+
s.add_dependency('serfx', '0.0.8')
|
21
|
+
s.add_dependency('msgpack', '0.5.9')
|
22
|
+
s.add_dependency('awesome_print', '1.2.0')
|
23
|
+
s.add_dependency('redis', '3.1.0')
|
24
|
+
s.add_development_dependency('rake')
|
25
|
+
s.add_development_dependency('rdoc')
|
26
|
+
s.add_development_dependency('aruba')
|
27
|
+
s.add_runtime_dependency('gli','2.12.2')
|
28
|
+
end
|
data/mtncd.rdoc
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mtncd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MTN Satellite Communications
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: resque
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.25.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.25.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: serfx
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.8
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.8
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: msgpack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.9
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.9
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: awesome_print
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: redis
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rdoc
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: aruba
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: gli
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.12.2
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.12.2
|
139
|
+
description:
|
140
|
+
email: marat_garafutdinov@mtnsat.com
|
141
|
+
executables:
|
142
|
+
- mtncd
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files:
|
145
|
+
- README.rdoc
|
146
|
+
- mtncd.rdoc
|
147
|
+
files:
|
148
|
+
- Gemfile
|
149
|
+
- Gemfile.lock
|
150
|
+
- README.md
|
151
|
+
- README.rdoc
|
152
|
+
- Rakefile
|
153
|
+
- bin/mtncd
|
154
|
+
- features/mtncd.feature
|
155
|
+
- features/step_definitions/mtncd_steps.rb
|
156
|
+
- features/support/env.rb
|
157
|
+
- lib/mtncd.rb
|
158
|
+
- lib/mtncd/version.rb
|
159
|
+
- mtncd.gemspec
|
160
|
+
- mtncd.rdoc
|
161
|
+
- test/default_test.rb
|
162
|
+
- test/test_helper.rb
|
163
|
+
homepage: https://github.com/mtnsat
|
164
|
+
licenses: []
|
165
|
+
metadata: {}
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options:
|
168
|
+
- --title
|
169
|
+
- mtncd
|
170
|
+
- --main
|
171
|
+
- README.rdoc
|
172
|
+
- -ri
|
173
|
+
require_paths:
|
174
|
+
- lib
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ! '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubyforge_project:
|
188
|
+
rubygems_version: 2.2.2
|
189
|
+
signing_key:
|
190
|
+
specification_version: 4
|
191
|
+
summary: A helper tool for MTN CICD pipeline
|
192
|
+
test_files: []
|