deploy-context 2.13.23 → 2.13.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative 'cookbook-studio'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
class ContextHabitatStudio < DefaultStudio
|
5
|
+
banner "knife context habitat studio"
|
6
|
+
|
7
|
+
deps do
|
8
|
+
Knife::DefaultKnifeContext.load_deps
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
if name_args.count > 2
|
13
|
+
context_log "name_args = #{name_args[2...]}"
|
14
|
+
habitat(self, %w(studio) + name_args[2...])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def do_clean
|
19
|
+
super
|
20
|
+
delete_file_only_if_exist(get_context_file(self, 'respond.txt'))
|
21
|
+
delete_folder_only_if_exist(get_context_file(self, 'results/logs'))
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
def do_install
|
26
|
+
super
|
27
|
+
bundle_gem self, ['install', context_name]
|
28
|
+
build_habitat(self)
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
# 10
|
33
|
+
def do_strip
|
34
|
+
super
|
35
|
+
Dir.chdir context_folder
|
36
|
+
start_habitat_job(self)
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
# 11
|
41
|
+
def do_end
|
42
|
+
super
|
43
|
+
promote_habitat(self)
|
44
|
+
end
|
45
|
+
|
46
|
+
def studio_available?
|
47
|
+
is_binary_available?('hab') && super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Context
|
2
|
+
module CommandHelper
|
3
|
+
def debug?
|
4
|
+
ENV.key?('CONTEXTDEBUG') && ! ENV['CONTEXTDEBUG'].nil? && ENV['CONTEXTDEBUG']
|
5
|
+
end
|
6
|
+
|
7
|
+
def context_log(message)
|
8
|
+
return log message if respond_to? :log
|
9
|
+
puts message
|
10
|
+
end
|
11
|
+
|
12
|
+
def debug_context_log(name, message)
|
13
|
+
return debug_log message if respond_to? :debug_log
|
14
|
+
debug_message = "\n\n#{name} DEBUG: #{message}\n\n"
|
15
|
+
context_log debug_message if debug?
|
16
|
+
end
|
17
|
+
|
18
|
+
def warning_context_log(name, message)
|
19
|
+
return warning_log message if respond_to? :warning_log
|
20
|
+
warning_message = "\n\n#{name} WARNING: #{message}\n\n"
|
21
|
+
context_log warning_message
|
22
|
+
end
|
23
|
+
|
24
|
+
def error_context_log(name, message)
|
25
|
+
return error_log message if respond_to? :error_log
|
26
|
+
error_message = "\n\n#{name} ERROR: #{message}\n\n"
|
27
|
+
context_log error_message
|
28
|
+
context_log caller
|
29
|
+
abort(error_message)
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
33
|
+
def is_admin?
|
34
|
+
Process::Sys.getuid != 0
|
35
|
+
end
|
36
|
+
|
37
|
+
def temp_dir
|
38
|
+
File.join(context_folder, 'results')
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_shell_data(command_line)
|
42
|
+
debug_context_log 'Get data from command', command_line
|
43
|
+
`#{command_line.join(' ')}`
|
44
|
+
end
|
45
|
+
|
46
|
+
def execute_command(command, command_type = :system)
|
47
|
+
command_state = case command_type
|
48
|
+
when :system
|
49
|
+
system(command.join(' '))
|
50
|
+
when :run_as_admin
|
51
|
+
execute_command(sudo_command(command), command_type)
|
52
|
+
when :get_data
|
53
|
+
debug_context_log "get data command = #{command} on type #{command_type}"
|
54
|
+
get_shell_data(command)
|
55
|
+
when :fork
|
56
|
+
fork(command.join(' '))
|
57
|
+
else
|
58
|
+
error_context_log(context_name, "Unknown command type #{command_type}")
|
59
|
+
end
|
60
|
+
debug_context_log 'Execute Command', "\n\nexecuted command #{command.join(' ')}"
|
61
|
+
command_state
|
62
|
+
end
|
63
|
+
|
64
|
+
def sudo_command(command)
|
65
|
+
if ! Gem.win_platform? && Process::Sys.getuid != 0
|
66
|
+
['sudo'] + command
|
67
|
+
else
|
68
|
+
command
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def write_in_system_file(file, content)
|
73
|
+
debug_context_log "Write in file system", [file, content]
|
74
|
+
system("touch #{file}")
|
75
|
+
::File.write(file, content)
|
76
|
+
system("chmod 644 #{file}") unless Gem.win_platform?
|
77
|
+
end
|
78
|
+
|
79
|
+
def delete_file_only_if_exist(file)
|
80
|
+
FileUtils.rm file if File.exist? file
|
81
|
+
end
|
82
|
+
|
83
|
+
def delete_folder_only_if_exist(folder)
|
84
|
+
FileUtils.rm_dir folder if File.exist? folder
|
85
|
+
end
|
86
|
+
|
87
|
+
def is_binary_available?(binary_name)
|
88
|
+
execute_command(['which', binary_name])
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module GemHelpers
|
4
|
+
def deploycontext_gem_specification(s, deploycontext_rootfolder, libraries_folder, steps_folder = '')
|
5
|
+
s.name = 'deploy-context'
|
6
|
+
s.license = 'MIT'
|
7
|
+
s.authors = ['Jimmy Provencher']
|
8
|
+
s.email = ['jimbo_dragon@hotmail.com']
|
9
|
+
s.homepage = 'https://github.com/JimboDragonGit/deploy-context'
|
10
|
+
s.summary = 'A auto chef bootstrapper and wrapper cookbook to deploy code and context'
|
11
|
+
s.description = 'Using Chef cookbook style and force any script using it to switch to chef even if it is not install. It will install it tho ;)'
|
12
|
+
|
13
|
+
s.version = File.read(File.join(deploycontext_rootfolder, 'VERSION'))
|
14
|
+
s.date = File.read(File.join(deploycontext_rootfolder, 'DATE'))
|
15
|
+
|
16
|
+
# all_files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
# s.files = all_files.grep(%r!^(exe|libraries|rubocop)/|^.rubocop.yml$!)
|
18
|
+
# code_folder = 'libraries/'
|
19
|
+
# s.files = %w(README.md LICENSE bin/selfbootstrap libraries/selfbootstrap.rb ) + Dir.glob('libraries/**/*') # + Dir.glob('{bin,lib,certs,test}/**/*')
|
20
|
+
# s.require_paths = [code_folder]
|
21
|
+
# s.executables = %w(selfbootstrap)
|
22
|
+
# s.bindir = 'exe'
|
23
|
+
|
24
|
+
|
25
|
+
# s.extra_rdoc_files = ["README.md", 'VERSION', 'DATE']
|
26
|
+
# s.files = `git ls-files`.split("\n")
|
27
|
+
libraries_glob = Dir.glob(File.join(libraries_folder, '**/*'))
|
28
|
+
puts "libraries_glob first = #{libraries_glob}"
|
29
|
+
libraries_glob = libraries_glob + Dir.glob(File.join(steps_folder, '*')) unless steps_folder.empty?
|
30
|
+
puts "libraries_glob second = #{libraries_glob}"
|
31
|
+
s.files = libraries_glob
|
32
|
+
s.executables = [
|
33
|
+
'deploy-context'
|
34
|
+
]
|
35
|
+
|
36
|
+
s.cert_chain = [File.join(ENV['HOME'], '.gem/gem-public_cert.pem')]
|
37
|
+
s.signing_key = File.join(ENV['HOME'], '.gem/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
|
38
|
+
|
39
|
+
s.metadata = {
|
40
|
+
# 'source_code_uri' => '/home/git/selfbootstrap.git/',
|
41
|
+
'bug_tracker_uri' => 'https://github.com/JimboDragonGit/deploy-context/issues',
|
42
|
+
'changelog_uri' => 'https://github.com/JimboDragonGit/deploy-context/releases',
|
43
|
+
'homepage_uri' => s.homepage,
|
44
|
+
}
|
45
|
+
|
46
|
+
s.rdoc_options = ['--charset=UTF-8']
|
47
|
+
# s.extra_rdoc_files = %w(README.md LICENSE)
|
48
|
+
|
49
|
+
# s.required_ruby_version = '>= 2.5.0'
|
50
|
+
# s.required_rubygems_version = '>= 2.7.0'
|
51
|
+
|
52
|
+
# s.add_development_dependency('chef')
|
53
|
+
# s.add_development_dependency('test-kitchen')
|
54
|
+
|
55
|
+
# s.add_runtime_dependency('git')
|
56
|
+
# s.add_runtime_dependency('git_cli')
|
57
|
+
# s.add_runtime_dependency('chef')
|
58
|
+
# s.add_runtime_dependency('test-kitchen')
|
59
|
+
# s.add_runtime_dependency('chef-bin')
|
60
|
+
# s.add_runtime_dependency('chef-cli')
|
61
|
+
# s.add_runtime_dependency('cheffish')
|
62
|
+
# s.add_runtime_dependency('knife')
|
63
|
+
# s.add_runtime_dependency('knife-ec2')
|
64
|
+
|
65
|
+
s.add_runtime_dependency('inspec')
|
66
|
+
s.add_runtime_dependency('kitchen-vagrant')
|
67
|
+
s.add_runtime_dependency('kitchen-dokken')
|
68
|
+
s.add_runtime_dependency('kitchen-ec2')
|
69
|
+
s.add_runtime_dependency('simplecov')
|
70
|
+
s.add_runtime_dependency('cucumber')
|
71
|
+
s.add_runtime_dependency('down')
|
72
|
+
s.add_runtime_dependency('unix-crypt')
|
73
|
+
# s.add_runtime_dependency('ruby-shadow')
|
74
|
+
s.add_runtime_dependency('securerandom')
|
75
|
+
s.add_runtime_dependency('git-version-bump')
|
76
|
+
|
77
|
+
# s.add_runtime_dependency('colorator', '~> 1.0')
|
78
|
+
# s.add_runtime_dependency('em-websocket', '~> 0.5')
|
79
|
+
# s.add_runtime_dependency('i18n', '~> 1.0')
|
80
|
+
# s.add_runtime_dependency('jekyll-sass-converter', '>= 2.0', '< 4.0')
|
81
|
+
# s.add_runtime_dependency('jekyll-watch', '~> 2.0')
|
82
|
+
# s.add_runtime_dependency('kramdown', '~> 2.3', '>= 2.3.1')
|
83
|
+
# s.add_runtime_dependency('kramdown-parser-gfm', '~> 1.0')
|
84
|
+
# s.add_runtime_dependency('liquid', '~> 4.0')
|
85
|
+
# s.add_runtime_dependency('mercenary', '>= 0.3.6', '< 0.5')
|
86
|
+
# s.add_runtime_dependency('pathutil', '~> 0.9')
|
87
|
+
# s.add_runtime_dependency('rouge', '>= 3.0', '< 5.0')
|
88
|
+
# s.add_runtime_dependency('safe_yaml', '~> 1.0')
|
89
|
+
# s.add_runtime_dependency('terminal-table', '>= 1.8', '< 4.0')
|
90
|
+
# s.add_runtime_dependency('webrick', '~> 1.7')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
module Context
|
2
|
+
module RakeTasks
|
3
|
+
def define_deploy_context_tasks(deployer)
|
4
|
+
deployer.load_public_dependencies
|
5
|
+
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.md"
|
9
|
+
rd.title = 'deploy-context'
|
10
|
+
rd.rdoc_files.include("README.md", "lib/**/*.rb")
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :deploycontext do
|
14
|
+
task :mix_cookbook => "deploycontext:push_cookbook" do
|
15
|
+
deployer.do_mix_cookbook
|
16
|
+
end
|
17
|
+
|
18
|
+
task :push_cookbook => "deploycontext:install" do
|
19
|
+
deployer.do_end
|
20
|
+
end
|
21
|
+
|
22
|
+
task :install do
|
23
|
+
deployer.do_install
|
24
|
+
end
|
25
|
+
|
26
|
+
# task :bump => "deploycontext:commit" do
|
27
|
+
# deployer.bump
|
28
|
+
# end
|
29
|
+
|
30
|
+
# task :test => "deploycontext:help" do
|
31
|
+
# deployer.test
|
32
|
+
# end
|
33
|
+
|
34
|
+
# task :release => "deploycontext:commit" do
|
35
|
+
# deployer.release
|
36
|
+
# end
|
37
|
+
|
38
|
+
# task :commit => "deploycontext:default" do
|
39
|
+
# deployer.commit
|
40
|
+
# end
|
41
|
+
|
42
|
+
# task :push => "deploycontext:commit" do
|
43
|
+
# deployer.push
|
44
|
+
# end
|
45
|
+
|
46
|
+
task :help do
|
47
|
+
deployer.help
|
48
|
+
end
|
49
|
+
|
50
|
+
namespace :studio do
|
51
|
+
task :promote => "deploycontext:studio:release" do
|
52
|
+
deployer.do_end
|
53
|
+
end
|
54
|
+
|
55
|
+
task :build => "deploycontext:studio:habitat" do
|
56
|
+
deployer.do_build
|
57
|
+
end
|
58
|
+
|
59
|
+
task :install => "deploycontext:studio:build" do
|
60
|
+
deployer.do_install
|
61
|
+
end
|
62
|
+
|
63
|
+
task :release => "deploycontext:studio:install" do
|
64
|
+
deployer.do_release
|
65
|
+
end
|
66
|
+
|
67
|
+
task :habitat do
|
68
|
+
deployer.do_build_in_habitat
|
69
|
+
end
|
70
|
+
|
71
|
+
task :kitchen do
|
72
|
+
deployer.test_with_kitchen
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
namespace :plan do
|
77
|
+
task :do_mix_cookbook do
|
78
|
+
deployer.do_mix_cookbook
|
79
|
+
end
|
80
|
+
|
81
|
+
task :do_begin do
|
82
|
+
deployer.do_begin
|
83
|
+
end
|
84
|
+
|
85
|
+
task :do_download do
|
86
|
+
deployer.do_download
|
87
|
+
end
|
88
|
+
|
89
|
+
task :do_verify do
|
90
|
+
deployer.do_verify
|
91
|
+
end
|
92
|
+
|
93
|
+
task :do_clean do
|
94
|
+
deployer.do_clean
|
95
|
+
end
|
96
|
+
|
97
|
+
task :do_unpack do
|
98
|
+
deployer.do_unpack
|
99
|
+
end
|
100
|
+
|
101
|
+
task :do_prepare do
|
102
|
+
deployer.do_prepare
|
103
|
+
end
|
104
|
+
|
105
|
+
task :do_build do
|
106
|
+
deployer.do_build
|
107
|
+
end
|
108
|
+
|
109
|
+
task :do_check do
|
110
|
+
deployer.do_check
|
111
|
+
end
|
112
|
+
|
113
|
+
task :do_install do
|
114
|
+
deployer.do_install
|
115
|
+
end
|
116
|
+
|
117
|
+
task :do_strip do
|
118
|
+
deployer.do_strip
|
119
|
+
end
|
120
|
+
|
121
|
+
task :do_end do
|
122
|
+
deployer.do_end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
namespace :deployer do
|
127
|
+
task :cookbook do
|
128
|
+
deployer.cookbook_test(deployer)
|
129
|
+
end
|
130
|
+
|
131
|
+
task :cucumber do
|
132
|
+
deployer.cucumber_test(deployer)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
namespace :features do
|
137
|
+
Cucumber::Rake::Task.new(:strict) do |t|
|
138
|
+
t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
|
139
|
+
t.profile = "strict"
|
140
|
+
end
|
141
|
+
|
142
|
+
Cucumber::Rake::Task.new(:html_report) do |t|
|
143
|
+
t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
|
144
|
+
t.profile = "html_report"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'dummy_knife.rb'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
module Knife
|
5
|
+
class DefaultKnifeContext < Chef::Knife
|
6
|
+
include Context::CommandHelper
|
7
|
+
|
8
|
+
banner "knife default knife context"
|
9
|
+
|
10
|
+
deps do
|
11
|
+
end
|
12
|
+
|
13
|
+
option :context_name,
|
14
|
+
:long => '--context-name VALUE',
|
15
|
+
:boolean => false,
|
16
|
+
:description => "The name of the context we running on"
|
17
|
+
|
18
|
+
option :context_folder,
|
19
|
+
:long => '--context-path VALUE',
|
20
|
+
:description => "Path of the context"
|
21
|
+
|
22
|
+
option :organisation_name,
|
23
|
+
:long => '--organisation-name VALUE',
|
24
|
+
:description => "Organisation name of the context"
|
25
|
+
|
26
|
+
def run
|
27
|
+
if config[:context_name]
|
28
|
+
context_log "Running on context #{config[:context_name]}, config = #{config.inspect}\n#{name_args}"
|
29
|
+
else
|
30
|
+
warning_context_log self, "Running on context without name"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
begin
|
2
|
+
require 'chef/knife'
|
3
|
+
rescue Exception => e
|
4
|
+
puts "Failed to load chef/knife module, loading a dummy module instead"
|
5
|
+
|
6
|
+
class Chef
|
7
|
+
class Knife
|
8
|
+
def self.banner(banner_flags)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.deps
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.option(name,*argv)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Context
|
21
|
+
module Knife
|
22
|
+
class MannequinKnifeContext < Chef::Knife
|
23
|
+
banner "knife mannequin knife context"
|
24
|
+
|
25
|
+
deps do
|
26
|
+
end
|
27
|
+
|
28
|
+
option :mannequin,
|
29
|
+
:description => "Just a dummy example"
|
30
|
+
|
31
|
+
def run
|
32
|
+
# deployer.send(config[:omg])
|
33
|
+
if config[:mannequin]
|
34
|
+
# Oh yeah, we are pumped.
|
35
|
+
puts "Dummy Mannequin ;)"
|
36
|
+
else
|
37
|
+
# meh
|
38
|
+
puts "Where is my Dummy Mannequin!!!!"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/ruby-studio.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative 'default-studio'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
class ContextRubyStudio < DefaultStudio
|
5
|
+
banner "knife context ruby studio"
|
6
|
+
|
7
|
+
deps do
|
8
|
+
Knife::DefaultKnifeContext.load_deps
|
9
|
+
end
|
10
|
+
|
11
|
+
option :omg,
|
12
|
+
:short => '-O',
|
13
|
+
:long => '--omg',
|
14
|
+
:description => "I'm so excited! 9"
|
15
|
+
|
16
|
+
def run
|
17
|
+
if config[:omg]
|
18
|
+
puts "OMG HELLO WORLD!!!9!!99"
|
19
|
+
else
|
20
|
+
puts "I am just a fucking example. 9"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# 2
|
25
|
+
def do_download
|
26
|
+
super
|
27
|
+
system('bundle install')
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
# 2
|
32
|
+
# def do_verify
|
33
|
+
# super
|
34
|
+
# cucumber(self)
|
35
|
+
# true
|
36
|
+
# end
|
37
|
+
|
38
|
+
# 4
|
39
|
+
def do_clean
|
40
|
+
super
|
41
|
+
delete_file_only_if_exist(get_context_file(self, 'Gemfile.lock'))
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
# 9
|
46
|
+
def do_end
|
47
|
+
super
|
48
|
+
ruby_release(self)
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
def studio_present?
|
53
|
+
execute_command('which ruby') || super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module CucumberSteps
|
5
|
+
def given_test_suite(context_suite)
|
6
|
+
stop_test("Cucumber #{context_suite.test_suite} is unavailable", :no_cucumber) unless system("cucumber -d")
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_successfull?(context_suite)
|
10
|
+
stop_test("Cucumber test #{context_suite.test_suite} failed on execution", :cucumber_test_issue) unless system("knife context deploy --context-name #{context_suite.test_suite}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def given_profile_name(context_suite)
|
14
|
+
stop_test("Cucumber #{context_suite.profile_name} is unavailable", :no_profile) unless system("cucumber --profile #{context_suite.profile_name}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def report_the_report(context_suite)
|
18
|
+
stop_test("Cucumber test report #{context_suite.test_suite} failed to sent", :cucumber_test_issue) unless system("cucumber --profile #{context_suite.profile_name}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/deploy.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module Deploy
|
5
|
+
def define_steps(deployer)
|
6
|
+
deployer.load_public_dependencies
|
7
|
+
# Étantdonnéque('le projet {word} à une dernière version de disponible dans git') do |project_name|
|
8
|
+
# context_exec [project_name, 'cycle']
|
9
|
+
|
10
|
+
# if project_name == deployer.context_name
|
11
|
+
# Dir.chdir deployer.context_folder
|
12
|
+
# else
|
13
|
+
# Dir.chdir File.join(deployer.contexts_container(deployer), project_name)
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
|
17
|
+
Alors('démarrer un simple cycle de {word}') do |project_name|
|
18
|
+
pending
|
19
|
+
# context_exec [project_name, 'cycle'] || abort("#{project_name} ERROR: Issue with life cycle")
|
20
|
+
end
|
21
|
+
|
22
|
+
Alors('déployer le projet {word}') do |project_name|
|
23
|
+
abort("Deployer failed to update") unless deployer.do_begin
|
24
|
+
pending
|
25
|
+
# context_exec [project_name, 'release'] || abort("#{project_name} ERROR: Issue with deploy steps")
|
26
|
+
end
|
27
|
+
|
28
|
+
Alors('tester le projet {word}') do |project_name|
|
29
|
+
pending
|
30
|
+
# context_exec [project_name, 'test'] || abort("#{project_name} ERROR: Issue with testing steps")
|
31
|
+
end
|
32
|
+
|
33
|
+
Étantdonnéque('le projet {word} à du code à updater') do |project_name|
|
34
|
+
abort("Not on a dirty studio") unless deployer.on_a_dirty_studio?
|
35
|
+
# context_exec [project_name, 'check_code_to_update'] || abort("#{project_name} ERROR: Issue to check updated code")
|
36
|
+
end
|
37
|
+
|
38
|
+
Alors('bumper la version du patch de {word}') do |project_name|
|
39
|
+
pending
|
40
|
+
# context_exec [project_name, 'bump'] || abort("#{project_name} ERROR: Issue with bumping version")
|
41
|
+
end
|
42
|
+
|
43
|
+
Étantdonnéque('le projet {word} à la bonne version d\'installer') do |project_name|
|
44
|
+
abort("Not the latest version installed") unless deployer.current_version_installed?
|
45
|
+
end
|
46
|
+
|
47
|
+
Étantdonnéque('le projet {word} à une nouvelle version de disponible') do |project_name|
|
48
|
+
abort("Latest version installed") if deployer.current_version_installed?
|
49
|
+
end
|
50
|
+
|
51
|
+
Étantdonnéque('le projet {word} est chargé') do |project_name|
|
52
|
+
abort("Latest version installed") if deployer.current_version_installed?
|
53
|
+
end
|
54
|
+
|
55
|
+
Quand('le studio est disponible') do
|
56
|
+
abort("Studio not available") unless deployer.studio_available?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/git.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module GitSteps
|
5
|
+
def given_branch(context_suite)
|
6
|
+
stop_test("Git branch #{context_suite.branch_name} unavailable", :no_branch) unless branch_exist?
|
7
|
+
end
|
8
|
+
|
9
|
+
def when_dirty_branch(context_suite)
|
10
|
+
stop_test("Git branch #{context_suite.branch_name} is not dirty", :not_dirty) unless dirty_branch?
|
11
|
+
end
|
12
|
+
|
13
|
+
def when_clean_branch(context_suite)
|
14
|
+
stop_test("Git branch #{context_suite.branch_name} is dirty", :is_dirty) if dirty_branch?
|
15
|
+
end
|
16
|
+
|
17
|
+
def then_add_modification(context_suite)
|
18
|
+
stop_test("Git branch #{context_suite.branch_name} modifications cannot be added", :git_add_issue) unless system('git add .')
|
19
|
+
end
|
20
|
+
|
21
|
+
def then_commit_internal(context_suite)
|
22
|
+
stop_test("Git branch #{context_suite.branch_name} commit issue", :commit_issue) unless git_commit_successfully?(context_suite)
|
23
|
+
end
|
24
|
+
|
25
|
+
def then_merge_branch(context_suite)
|
26
|
+
stop_test("Git branch #{context_suite.branch_name} could't merge with master branch", :merge_issue) unless merge_with_branch_successfull?(context_suite.branch_name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def given_master_branch(context_suite)
|
30
|
+
stop_test("Issue switching to master", :master_switch_issue) unless system('git checkout master')
|
31
|
+
end
|
32
|
+
|
33
|
+
def then_push_git(context_suite)
|
34
|
+
stop_test("Le déploiment vers son origine lointaine à échouer", :git_push_issue) unless system('git push')
|
35
|
+
end
|
36
|
+
|
37
|
+
def then_push_branch(context_suite)
|
38
|
+
stop_test("Le déploiment de la branch #{context_suite.branch_name} vers son origine lointaine à échouer", :git_push_branch_issue) unless system("git push --set-upstream origin #{context_suite.branch_name}")
|
39
|
+
end
|
40
|
+
|
41
|
+
def then_checkout_branch(context_suite)
|
42
|
+
stop_test("Le déploiment vers son origine lointaine à échouer", :git_checkout_issue) unless switch_branch_successful?
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete_status_file(context_suite)
|
46
|
+
File.delete('deploy-status.json') if File.exist? 'deploy-status.json'
|
47
|
+
end
|
48
|
+
|
49
|
+
def then_pull_origin
|
50
|
+
stop_test("Le récupération avec son origine lointaine à échouer", :git_pull_issue) unless system('git pull')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|