Skip to content

Commit db5adf1

Browse files
committed
Add support for updating an applications version in the cmdb through stacks (via orc as a gem)
1 parent 86c193e commit db5adf1

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ gem 'mcollective-client', '2.8.2'
55
gem 'puppet', '3.7.5'
66
gem 'rspec', '3.3.0' # used by stacks test command
77
gem 'rubocop', '0.32.1'
8+
gem 'orc', :git => 'https://github.com/tim-group/orc.git', :ref => '9bd34ed0b9d7db51dd84cd944e7e4d117d5b79c2'
89

910
group :development do
1011
gem 'ci_reporter_rspec', '1.0.0'

Gemfile.lock

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
GIT
2+
remote: https://github.com/tim-group/orc.git
3+
revision: 9bd34ed0b9d7db51dd84cd944e7e4d117d5b79c2
4+
ref: 9bd34ed0b9d7db51dd84cd944e7e4d117d5b79c2
5+
specs:
6+
orc (0.1.0.pre.9bd34ed)
7+
git
8+
19
GEM
210
remote: https://rubygems.org/
311
specs:
@@ -20,6 +28,8 @@ GEM
2028
facter (2.5.7)
2129
facter (2.5.7-universal-darwin)
2230
CFPropertyList (~> 2.2)
31+
git (1.7.0)
32+
rchardet (~> 1.8)
2333
hiera (1.3.4)
2434
json_pure
2535
json (2.3.0)
@@ -45,6 +55,7 @@ GEM
4555
rainbow (2.2.2)
4656
rake
4757
rake (10.1.0)
58+
rchardet (1.8.0)
4859
rspec (3.3.0)
4960
rspec-core (~> 3.3.0)
5061
rspec-expectations (~> 3.3.0)
@@ -78,6 +89,7 @@ DEPENDENCIES
7889
ci_reporter_rspec (= 1.0.0)
7990
collimator (= 0.0.3)
8091
mcollective-client (= 2.8.2)
92+
orc!
8193
pry
8294
pry-byebug
8395
puppet (= 3.7.5)

bin/stacks

+5-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Options:
9797
reprovision [-e] -s "clean", and then "provision" a stack
9898
[--ignore-spectre-patching-host-policy]
9999
[--no-dependencies]
100+
[--update-version] <version> update the application version in cmdb prior to reprovision
100101
sbdiff show compile diff between latest stackbuilder and local stackbuilder.
101102
spec [-e] -s print the spec of the specified stack. Stack must be a single fqdn. Used for debugging
102103
terminus create a yaml puppet terminus
@@ -165,7 +166,8 @@ GetoptLong.new(
165166
['--no-tmux', GetoptLong::NO_ARGUMENT],
166167
['--no-dependencies', GetoptLong::NO_ARGUMENT],
167168
['--stash', GetoptLong::NO_ARGUMENT],
168-
['--no-validate', GetoptLong::NO_ARGUMENT]
169+
['--no-validate', GetoptLong::NO_ARGUMENT],
170+
['--update-version', GetoptLong::REQUIRED_ARGUMENT]
169171
).each do |opt, arg|
170172
opt_sym = opt[2..-1].to_sym
171173
case opt
@@ -194,6 +196,8 @@ GetoptLong.new(
194196
$options[:stash] = true
195197
when '--no-validate'
196198
$options[:validate] = false
199+
when '--update-version'
200+
$options[:update_version] = arg
197201
else
198202
$options[opt_sym] = arg
199203
end

lib/stackbuilder/support/cmd.rb

+16
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
require 'stackbuilder/support/mcollective'
99
require 'stackbuilder/support/kubernetes_vm_model'
1010
require 'open3'
11+
require 'orc/factory'
1112

1213
# public methods in this class (and whose name is included in the :cmds instance variable) are valid stacks commands.
1314
# the only argument is argv, i.e. the remaining cli arguments not recognized by getoptlong.
@@ -324,6 +325,21 @@ def reprovision(_argv)
324325
end
325326
end
326327

328+
unless $options[:update_version].nil?
329+
vm_targets.each do |_t|
330+
fail '--update-version for VMs has not yet been implemented'
331+
end
332+
333+
k8s_targets.each do |t|
334+
orc_factory = Orc::Factory.new(
335+
:application => t.application,
336+
:environment => t.environment.name,
337+
:group => 'blue'
338+
)
339+
orc_factory.high_level_orchestration.install($options[:update_version])
340+
end
341+
end
342+
327343
($options[:dependencies] ? expand_dependencies(k8s_targets) : k8s_targets).each do |t|
328344
apply_k8s(t)
329345
end

0 commit comments

Comments
 (0)