deploy-context 2.13.24 → 2.13.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/deploy-context +15 -1
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/context-knife-context.rb +26 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/context-manager.rb +100 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/cookbook-studio.rb +72 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/cucumber-studio.rb +45 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/cucumber-suite.rb +201 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/default-studio.rb +172 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/chef.rb +57 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/context.rb +42 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/cookbook.rb +121 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/cucumber.rb +42 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/deployer.rb +83 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/git.rb +62 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/habitat.rb +112 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/ruby.rb +138 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/vagrant.rb +7 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/habitat-studio.rb +50 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/helpers/command.rb +91 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/helpers/gemspec.rb +93 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/helpers/rake_tasks.rb +150 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/knife/default_knife_context.rb +35 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/knife/dummy_knife.rb +43 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/ruby-studio.rb +56 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/cucumber.rb +22 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/deploy.rb +61 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/git.rb +54 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/habitat.rb +67 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/inspec.rb +26 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/kitchen.rb +59 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/knife.rb +43 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/rake.rb +18 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/ruby.rb +14 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/supermarket.rb +14 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/base.rb +167 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/default.rb +38 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/deployer.rb +24 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context.rb +65 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-cucumber.rb +18 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-git.rb +53 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-habitat.rb +74 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-inspec.rb +29 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-kitchen.rb +59 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-knife.rb +45 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-rake.rb +12 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-ruby.rb +10 -0
- data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-supermarket.rb +10 -0
- data.tar.gz.sig +0 -0
- metadata +47 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5c1ee7c942245b1ec0a0470ff73dc34f3a5078d987b7d04ad51a1927eee1579
|
4
|
+
data.tar.gz: 0caa84cbb6d373ebcc78bdbe927c08056f1739884842aa449559492c37564f69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73ff148a4c00ce6310dac6356b0db217471fcad21edec1c74bade50cc34fe4d68f0f83d9e746549f6afbc4f4389c9b22da19be1bfe6edae8b5954e8866c89363
|
7
|
+
data.tar.gz: 2ab8b0a8efdcf1a5db8fdcf46d55501412550d1eb52f9c9eac1da9b48c9d2ec79b66244b8fb3a0213f600f5c8f1f34314de9ed91b699b9db6375c4e7b2da92ba
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/deploy-context
CHANGED
@@ -1,3 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
apps = %w(git kitchen knife git habitat git inspect supermarket git rake install git)
|
4
|
+
steps = %w(initialize planning execution closure)
|
5
|
+
|
6
|
+
%w(git kitchen knife habitat inspect supermarket rake install).each do |app|
|
7
|
+
system("knife deploy-context cucumber initialize #{app}")
|
8
|
+
end
|
9
|
+
|
10
|
+
%w(git kitchen knife git habitat git inspect supermarket git rake install git).each do |app|
|
11
|
+
system("knife deploy-context cucumber planning #{app}")
|
12
|
+
system("knife deploy-context cucumber execution #{app}")
|
13
|
+
end
|
14
|
+
|
15
|
+
%w(git kitchen knife habitat inspect supermarket rake install).each do |app|
|
16
|
+
system("knife deploy-context cucumber closure #{app}")
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
require_relative 'context-manager'
|
3
|
+
|
4
|
+
module Context
|
5
|
+
class ContextKnifeContext < DefaultStudio
|
6
|
+
banner "knife context knife context"
|
7
|
+
|
8
|
+
deps do
|
9
|
+
Knife::DefaultKnifeContext.load_deps
|
10
|
+
end
|
11
|
+
|
12
|
+
option :context,
|
13
|
+
:description => "Load an object internally on it"
|
14
|
+
|
15
|
+
def run
|
16
|
+
# Context::DeployContext.deployer.send(config[:omg])
|
17
|
+
if config[:omg]
|
18
|
+
# Oh yeah, we are pumped.
|
19
|
+
puts "OMG HELLO WORLD!!!8!!88"
|
20
|
+
else
|
21
|
+
# meh
|
22
|
+
puts "I am just a fucking example. 8"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
|
2
|
+
require_relative 'deploy-context/cucumber-studio'
|
3
|
+
|
4
|
+
module Context
|
5
|
+
class Manager < DefaultStudio
|
6
|
+
attr_reader :contexts
|
7
|
+
|
8
|
+
# 2
|
9
|
+
def do_download
|
10
|
+
super
|
11
|
+
contexts.each do |context|
|
12
|
+
context.do_download
|
13
|
+
end
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
# 3
|
18
|
+
def do_verify
|
19
|
+
super
|
20
|
+
contexts.each do |context|
|
21
|
+
context.do_verify
|
22
|
+
end
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
# 4
|
27
|
+
def do_clean
|
28
|
+
super
|
29
|
+
contexts.each do |context|
|
30
|
+
context.do_clean
|
31
|
+
end
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
# 5
|
36
|
+
def do_unpack
|
37
|
+
super
|
38
|
+
contexts.each do |context|
|
39
|
+
context.do_unpack
|
40
|
+
end
|
41
|
+
true
|
42
|
+
end
|
43
|
+
|
44
|
+
# 6
|
45
|
+
def do_prepare
|
46
|
+
super
|
47
|
+
contexts.each do |context|
|
48
|
+
context.do_prepare
|
49
|
+
end
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
# 7
|
54
|
+
def do_build
|
55
|
+
super
|
56
|
+
contexts.each do |context|
|
57
|
+
context.do_build
|
58
|
+
end
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
# 8
|
63
|
+
def do_check
|
64
|
+
super
|
65
|
+
contexts.each do |context|
|
66
|
+
context.do_check
|
67
|
+
end
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
# 9
|
72
|
+
def do_install
|
73
|
+
super
|
74
|
+
contexts.each do |context|
|
75
|
+
context.do_install
|
76
|
+
end
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
# 10
|
81
|
+
def do_strip
|
82
|
+
super
|
83
|
+
def do_install
|
84
|
+
contexts.each do |context|
|
85
|
+
context.do_strip
|
86
|
+
end
|
87
|
+
true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# 11
|
92
|
+
def do_end
|
93
|
+
super
|
94
|
+
contexts.each do |context|
|
95
|
+
context.do_end
|
96
|
+
end
|
97
|
+
true
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require_relative 'ruby-studio'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
class ContextCookbookStudio < DefaultStudio
|
5
|
+
banner "knife context cookbook studio"
|
6
|
+
|
7
|
+
deps do
|
8
|
+
Knife::DefaultKnifeContext.load_deps
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
case name_args[0]
|
13
|
+
when 'converge'
|
14
|
+
kitchen(self, name_args)
|
15
|
+
when 'verify'
|
16
|
+
kitchen(self, name_args)
|
17
|
+
when 'destroy'
|
18
|
+
kitchen(self, name_args)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# 4
|
23
|
+
def do_clean
|
24
|
+
super
|
25
|
+
delete_file_only_if_exist(get_context_file(self, 'Policyfile.lock.json'))
|
26
|
+
kitchen(%w(destroy))
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
# 6
|
31
|
+
def do_prepare
|
32
|
+
cookbook_build(self)
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
# 7
|
37
|
+
def do_build
|
38
|
+
cookbook_install(self)
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
# 8
|
43
|
+
def do_check
|
44
|
+
cookbook_test(self)
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
# 9
|
49
|
+
def do_install
|
50
|
+
knife_push(self)
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
54
|
+
# 10
|
55
|
+
def do_strip
|
56
|
+
super
|
57
|
+
cookbook_push(self)
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# 11
|
62
|
+
def do_end
|
63
|
+
super
|
64
|
+
supermarket_push(self)
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
def studio_available?
|
69
|
+
is_binary_available?('kitchen') && is_binary_available?('knife') && super
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'habitat-studio'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
class ContextCucumberStudio < DefaultStudio
|
5
|
+
banner "knife context cucumber studio"
|
6
|
+
|
7
|
+
deps do
|
8
|
+
Knife::DefaultKnifeContext.load_deps
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
case name_args[1]
|
13
|
+
when 'destroy'
|
14
|
+
execute_command(%w(knife context cookbook studio destroy)) if name_args[0] == 'kitchen'
|
15
|
+
when 'enter'
|
16
|
+
execute_command(%w(knife context habitat studio enter)) if name_args[0] == 'habitat'
|
17
|
+
when 'build'
|
18
|
+
execute_command(%w(knife context habitat studio build) + name_args) if name_args[0] == 'habitat'
|
19
|
+
else
|
20
|
+
if name_args[0]
|
21
|
+
additionnal_tag = name_args[1].nil? ? [] : ['--tags', "@#{name_args[1]}"]
|
22
|
+
case name_args[0]
|
23
|
+
when 'cycle'
|
24
|
+
cucumber(self, ['--profile', 'preinit'] + additionnal_tag)
|
25
|
+
cucumber(self, ['--profile', 'initialize'] + additionnal_tag)
|
26
|
+
cucumber(self, ['--profile', 'planning'] + additionnal_tag)
|
27
|
+
cucumber(self, ['--profile', 'execution'] + additionnal_tag)
|
28
|
+
cucumber(self, ['--profile', 'closure'] + additionnal_tag)
|
29
|
+
cucumber(self, ['--profile', 'post_mortem'] + additionnal_tag)
|
30
|
+
when 'bump'
|
31
|
+
execute_command(%w(chef exec git version-bump patch))
|
32
|
+
else
|
33
|
+
cucumber(self, ['--profile', name_args[0]] + additionnal_tag)
|
34
|
+
end
|
35
|
+
# else
|
36
|
+
# cucumber(self)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def studio_available?
|
42
|
+
is_binary_available?('cucumber') && super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
|
2
|
+
require_relative 'deploy/context'
|
3
|
+
require_relative 'deploy/chef'
|
4
|
+
require_relative 'deploy/cookbook'
|
5
|
+
require_relative 'deploy/cucumber'
|
6
|
+
require_relative 'deploy/deployer'
|
7
|
+
require_relative 'deploy/git'
|
8
|
+
require_relative 'deploy/habitat'
|
9
|
+
require_relative 'deploy/ruby'
|
10
|
+
require_relative 'deploy/vagrant'
|
11
|
+
|
12
|
+
require_relative 'steps/cucumber'
|
13
|
+
require_relative 'steps/git'
|
14
|
+
require_relative 'steps/habitat'
|
15
|
+
require_relative 'steps/inspec'
|
16
|
+
require_relative 'steps/kitchen'
|
17
|
+
require_relative 'steps/knife'
|
18
|
+
require_relative 'steps/rake'
|
19
|
+
require_relative 'steps/ruby'
|
20
|
+
require_relative 'steps/supermarket'
|
21
|
+
|
22
|
+
require_relative 'steps/deploy'
|
23
|
+
|
24
|
+
module Context
|
25
|
+
module CucumberSuiteHelper
|
26
|
+
include Context::CommandHelper
|
27
|
+
include DeployHelpers::DeployerHelper
|
28
|
+
include DeployHelpers::ChefHelper
|
29
|
+
include DeployHelpers::GitHelper
|
30
|
+
include DeployHelpers::RubyHelper
|
31
|
+
include DeployHelpers::ContextHelper
|
32
|
+
include DeployHelpers::CookbookHelper
|
33
|
+
include DeployHelpers::HabitatHelper
|
34
|
+
include DeployHelpers::CucumberHelper
|
35
|
+
|
36
|
+
include Studio::Base
|
37
|
+
include Studio::Default
|
38
|
+
|
39
|
+
include Steps::Deploy
|
40
|
+
include Steps::CucumberSteps
|
41
|
+
include Steps::GitSteps
|
42
|
+
include Steps::HabitatSteps
|
43
|
+
include Steps::InspecSteps
|
44
|
+
include Steps::KitchenSteps
|
45
|
+
include Steps::KnifeSteps
|
46
|
+
include Steps::RakeSteps
|
47
|
+
include Steps::RubySteps
|
48
|
+
include Steps::SupermarketSteps
|
49
|
+
|
50
|
+
def context_suite
|
51
|
+
if @context_suite.nil?
|
52
|
+
@context_suite = OpenStruct.new
|
53
|
+
@context_suite.status_file = 'deploy-status.json'
|
54
|
+
# @context_suite.suite_kitchen = "patatae"
|
55
|
+
@context_suite.status = :initialisation
|
56
|
+
end
|
57
|
+
@context_suite
|
58
|
+
end
|
59
|
+
|
60
|
+
def verify_kitchen_status
|
61
|
+
context_suite.status = case kitchen_status['last_action']
|
62
|
+
when "verify"
|
63
|
+
kitchen_status['last_error'].nil? ? :verified : :verification_fail
|
64
|
+
when "converge"
|
65
|
+
kitchen_status['last_error'].nil? ? :converged : :converge_fail
|
66
|
+
when nil
|
67
|
+
:destroyed
|
68
|
+
else
|
69
|
+
warning_context_log("Kitchen status", kitchen_status['last_action'].inspect)
|
70
|
+
:unknown
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def dirty_branch?
|
75
|
+
`git status --porcelain`.split('\n').count > 0
|
76
|
+
end
|
77
|
+
|
78
|
+
def branch_exist?
|
79
|
+
system("git branch --list #{context_suite.branch_name}")
|
80
|
+
end
|
81
|
+
|
82
|
+
def git_commit_successfully?(context_suite)
|
83
|
+
system("git commit --message 'Automatic cucumber commit on branch #{context_suite.branch_name}'")
|
84
|
+
end
|
85
|
+
|
86
|
+
def merge_with_branch_successfull?(source_branch)
|
87
|
+
system("git merge #{source_branch} #{context_suite.branch_name}")
|
88
|
+
end
|
89
|
+
|
90
|
+
def merge_to_master_successfull?
|
91
|
+
merge_with_branch_successfull?(context_suite.branch_name, 'master')
|
92
|
+
end
|
93
|
+
|
94
|
+
def switch_branch_successful?
|
95
|
+
system("git checkout #{context_suite.branch_name}")
|
96
|
+
end
|
97
|
+
|
98
|
+
def kitchen_suite_exist?
|
99
|
+
system("kitchen list #{context_suite.suite_kitchen}")
|
100
|
+
end
|
101
|
+
|
102
|
+
def verify_kitchen?
|
103
|
+
system("kitchen verify #{context_suite.suite_kitchen}")
|
104
|
+
end
|
105
|
+
|
106
|
+
def verify_secret?(secret_key)
|
107
|
+
system("hab origin secret list | grep #{secret_key}")
|
108
|
+
end
|
109
|
+
|
110
|
+
def kitchen_converged_successfully?
|
111
|
+
system("kitchen converge #{context_suite.suite_kitchen}")
|
112
|
+
end
|
113
|
+
|
114
|
+
def kitchen_destroyed_correctly?
|
115
|
+
system("kitchen destroy #{context_suite.suite_kitchen}")
|
116
|
+
end
|
117
|
+
|
118
|
+
def kitchen_tested_successfully?
|
119
|
+
system("kitchen test #{context_suite.suite_kitchen}")
|
120
|
+
end
|
121
|
+
|
122
|
+
def habitat_task_different?
|
123
|
+
jop_id = last_job_status[1]
|
124
|
+
jop_id != File.read('HAB_BUILD_ID')
|
125
|
+
end
|
126
|
+
|
127
|
+
def habitat_task_completed?
|
128
|
+
jop_status = last_job_status[2]
|
129
|
+
jop_status == 'Complete'
|
130
|
+
end
|
131
|
+
|
132
|
+
def job_status_raw
|
133
|
+
`hab bldr job status --origin #{context_suite.organisation_name} | grep #{context_suite.organisation_name}/#{context_suite.application_name}`
|
134
|
+
end
|
135
|
+
|
136
|
+
def last_job_status
|
137
|
+
job_status_arr = job_status_raw.split('\n')
|
138
|
+
jop_status = job_status_arr[0].split(' ')
|
139
|
+
end
|
140
|
+
|
141
|
+
def habitat_new_task?
|
142
|
+
jop_status = last_job_status[2]
|
143
|
+
jop_status == 'Dispatching'
|
144
|
+
end
|
145
|
+
|
146
|
+
def write_build_id
|
147
|
+
jop_id = last_job_status[1]
|
148
|
+
File.write('HAB_BUILD_ID', jop_id)
|
149
|
+
end
|
150
|
+
|
151
|
+
def write_cookbook_version
|
152
|
+
short_version = Gem::Version.new(GVB.version).canonical_segments[0..2].join('.')
|
153
|
+
File.write('VERSION', short_version)
|
154
|
+
File.write('DATE', GVB.date)
|
155
|
+
File.write('habitat/plan.sh/VERSION', short_version)
|
156
|
+
File.write('habitat/plan.sh/DATE', GVB.date)
|
157
|
+
end
|
158
|
+
|
159
|
+
def verify_habitat?
|
160
|
+
system("hab studio run echo")
|
161
|
+
end
|
162
|
+
|
163
|
+
def plan_build_successfully?
|
164
|
+
system("hab studio build #{context_suite.plan_path}")
|
165
|
+
end
|
166
|
+
|
167
|
+
def context_status
|
168
|
+
JSON.parse(File.read(context_suite.status_file))[:status]
|
169
|
+
end
|
170
|
+
|
171
|
+
def kitchen_status
|
172
|
+
JSON.parse(`kitchen list #{context_suite.suite_kitchen} --json`).detect{|suite| suite['instance'].include?(context_suite.suite_kitchen)}
|
173
|
+
end
|
174
|
+
|
175
|
+
def command_available?(app_name, sub_command)
|
176
|
+
system("knife #{app_name} #{sub_command}")
|
177
|
+
end
|
178
|
+
|
179
|
+
def stop_test(message, status)
|
180
|
+
wrap_message = "#{status}:: #{message}"
|
181
|
+
update_status status
|
182
|
+
abort(wrap_message)
|
183
|
+
end
|
184
|
+
|
185
|
+
def update_status(new_status)
|
186
|
+
context_suite.status = new_status
|
187
|
+
update_status_file
|
188
|
+
end
|
189
|
+
|
190
|
+
def update_status_file
|
191
|
+
File.write(context_suite.status_file, JSON.pretty_generate({
|
192
|
+
status_file: context_suite.status_file,
|
193
|
+
kitchen_suite: context_suite.kitchen_suite,
|
194
|
+
plan_path: context_suite.plan_path,
|
195
|
+
branch_name: context_suite.branch_name,
|
196
|
+
status: context_suite.status,
|
197
|
+
}
|
198
|
+
))
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require 'git-version-bump'
|
7
|
+
|
8
|
+
require_relative 'helpers/command'
|
9
|
+
require_relative 'helpers/rake_tasks'
|
10
|
+
|
11
|
+
require_relative 'studio/default'
|
12
|
+
require_relative 'studio/deployer'
|
13
|
+
|
14
|
+
require_relative 'knife/default_knife_context'
|
15
|
+
require_relative 'cucumber-suite'
|
16
|
+
|
17
|
+
# require_relative 'ruby-studio'
|
18
|
+
# require_relative 'cookbook-studio'
|
19
|
+
# require_relative 'habitat-studio'
|
20
|
+
# require_relative 'cucumber-studio'
|
21
|
+
|
22
|
+
module Context
|
23
|
+
class DefaultStudio < Knife::DefaultKnifeContext
|
24
|
+
include CucumberSuiteHelper
|
25
|
+
|
26
|
+
# attr_reader :context_name
|
27
|
+
# attr_reader :context_folder
|
28
|
+
|
29
|
+
# attr_accessor :existing_cucumber_runtime
|
30
|
+
# attr_accessor :existing_cucumber_configuration
|
31
|
+
|
32
|
+
# attr_reader :organisation_name
|
33
|
+
|
34
|
+
attr_reader :ruby_studio
|
35
|
+
attr_reader :cookbook_studio
|
36
|
+
attr_reader :habitat_studio
|
37
|
+
attr_reader :cucumber_studio
|
38
|
+
|
39
|
+
# attr_reader :context_state
|
40
|
+
|
41
|
+
banner 'knife default studio'
|
42
|
+
|
43
|
+
deps do
|
44
|
+
end
|
45
|
+
|
46
|
+
option :context_name,
|
47
|
+
:short => '-N',
|
48
|
+
:long => '--context-name',
|
49
|
+
:description => "Name of the context"
|
50
|
+
|
51
|
+
option :ruby_studio,
|
52
|
+
:short => '-B',
|
53
|
+
:long => '--ruby-studio',
|
54
|
+
:description => "Path of the ruby studio"
|
55
|
+
|
56
|
+
option :cookbook_studio,
|
57
|
+
:short => '-B',
|
58
|
+
:long => '--cookbook-studio',
|
59
|
+
:description => "Path of the cookbook studio"
|
60
|
+
|
61
|
+
option :habitat_studio,
|
62
|
+
:short => '-H',
|
63
|
+
:long => '--habitat-studio',
|
64
|
+
:description => "Path of the habitat studio"
|
65
|
+
|
66
|
+
option :cucumber_studio,
|
67
|
+
:short => '-C',
|
68
|
+
:long => '--cucumber-studio',
|
69
|
+
:description => "Path of the cucumber studio"
|
70
|
+
|
71
|
+
option :context_state,
|
72
|
+
:short => '-S',
|
73
|
+
:long => '--context-state',
|
74
|
+
:description => "Set the value of the state before run"
|
75
|
+
|
76
|
+
# def initialize(argv)
|
77
|
+
# end
|
78
|
+
|
79
|
+
# def initialize(context_organisation_name, deployer_context_name, deploycontext_folder, default_ruby_studio = nil)
|
80
|
+
# @context_name = deployer_context_name
|
81
|
+
# @context_folder = deploycontext_folder # move_folder(deploycontext_folder)
|
82
|
+
# @organisation_name = context_organisation_name
|
83
|
+
# @ruby_studio = default_ruby_studio
|
84
|
+
# end
|
85
|
+
|
86
|
+
def context_name
|
87
|
+
config[:context_name]
|
88
|
+
end
|
89
|
+
|
90
|
+
def context_folder
|
91
|
+
config[:context_folder]
|
92
|
+
end
|
93
|
+
|
94
|
+
def existing_cucumber_runtime
|
95
|
+
config[:existing_cucumber_runtime]
|
96
|
+
end
|
97
|
+
|
98
|
+
def existing_cucumber_configuration
|
99
|
+
config[:existing_cucumber_configuration]
|
100
|
+
end
|
101
|
+
|
102
|
+
def organisation_name
|
103
|
+
config[:organisation_name]
|
104
|
+
end
|
105
|
+
|
106
|
+
def ruby_studio
|
107
|
+
@ruby_studio = RubyStudio.new if @ruby_studio.nil?
|
108
|
+
@ruby_studio
|
109
|
+
end
|
110
|
+
|
111
|
+
def cookbook_studio
|
112
|
+
@cookbook_studio = CookbookStudio.new if @cookbook_studio.nil?
|
113
|
+
@cookbook_studio
|
114
|
+
end
|
115
|
+
|
116
|
+
def habitat_studio
|
117
|
+
@habitat_studio = HabitatStudio.new if @habitat_studio.nil?
|
118
|
+
@habitat_studio
|
119
|
+
end
|
120
|
+
|
121
|
+
def cucumber_studio
|
122
|
+
@cucumber_studio = CucumberStudio.new if @cucumber_studio.nil?
|
123
|
+
@cucumber_studio
|
124
|
+
end
|
125
|
+
|
126
|
+
def studio_order
|
127
|
+
[ruby_studio, cookbook_studio, habitat_studio, cucumber_studio]
|
128
|
+
end
|
129
|
+
|
130
|
+
def do_begin
|
131
|
+
# @ruby_studio = Context::RubyStudio.new(organisation_name, context_name, context_folder) if ruby_studio.nil?
|
132
|
+
|
133
|
+
# @cookbook_studio = Context::CookbookStudio.new(organisation_name, context_name, context_folder, ruby_studio) if cookbook_studio.nil?
|
134
|
+
|
135
|
+
# @habitat_studio = Context::HabitatStudio.new(organisation_name, context_name, context_folder, ruby_studio) if habitat_studio.nil?
|
136
|
+
|
137
|
+
# @cucumber_studio = Context::CucumberStudio.new(organisation_name, context_name, context_folder, ruby_studio) if cucumber_studio.nil?
|
138
|
+
|
139
|
+
studio_order
|
140
|
+
end
|
141
|
+
|
142
|
+
# 2
|
143
|
+
def do_download
|
144
|
+
git_build(self)
|
145
|
+
end
|
146
|
+
|
147
|
+
# 3
|
148
|
+
def do_verify
|
149
|
+
git_build(self)
|
150
|
+
end
|
151
|
+
|
152
|
+
# 4
|
153
|
+
def do_clean
|
154
|
+
delete_file_only_if_exist(get_context_file(self, 'respond.txt'))
|
155
|
+
true
|
156
|
+
end
|
157
|
+
|
158
|
+
# 10
|
159
|
+
def do_strip
|
160
|
+
git_build(self)
|
161
|
+
end
|
162
|
+
|
163
|
+
# 11
|
164
|
+
def do_end
|
165
|
+
git_commit(self)
|
166
|
+
end
|
167
|
+
|
168
|
+
def studio_available?
|
169
|
+
is_binary_available?('git')
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|