deploy-context 2.13.23 → 2.13.25
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
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/habitat.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module HabitatSteps
|
5
|
+
def given_plan(context_suite)
|
6
|
+
stop_test("Habitat plan #{context_suite.plan_path} unavailable", :no_plan) unless Dir.exist?(context_suite.plan_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def when_initialize_habitat(context_suite)
|
10
|
+
stop_test("Habitat plan #{context_suite.plan_path} unavailable", :no_studio) unless verify_habitat?
|
11
|
+
end
|
12
|
+
|
13
|
+
def when_secret_available(context_suite)
|
14
|
+
stop_test("Habitat secrets #{context_suite.plan_path} not set", :no_secret) unless verify_secret?(context_suite.secret_key)
|
15
|
+
end
|
16
|
+
|
17
|
+
def then_build_plan(context_suite)
|
18
|
+
stop_test("Habitat plan #{context_suite.plan_path} unavailable", :build_fail) unless plan_build_successfully?
|
19
|
+
end
|
20
|
+
|
21
|
+
def then_start_job(context_suite)
|
22
|
+
stop_test("Habitat plan builder #{context_suite.plan_path} failed", :builder_fail) unless system("hab bldr job start #{context_suite.organisation_name}/#{context_suite.application_name} x86_64-linux")
|
23
|
+
end
|
24
|
+
|
25
|
+
def when_project_end(context_suite)
|
26
|
+
stop_test("Le projet n'est pas compléter", :not_accepted) unless context_suite.status == :accepted
|
27
|
+
end
|
28
|
+
|
29
|
+
def when_studio_success(context_suite)
|
30
|
+
stop_test("Le studio est un échec", context_suite.status) unless context_suite.status != :ok
|
31
|
+
end
|
32
|
+
|
33
|
+
def when_dispatch_job(context_suite)
|
34
|
+
stop_test("Aucun tâche de disponible sur l'origin #{context_suite.organisation_name}", :no_habitat_task_dispatched) unless habitat_new_task?
|
35
|
+
end
|
36
|
+
|
37
|
+
def then_wait_completion(context_suite)
|
38
|
+
second_pass = 0
|
39
|
+
while true do
|
40
|
+
if habitat_new_task?
|
41
|
+
puts "Waiting for task... #{second_pass} seconds"
|
42
|
+
sleep 1
|
43
|
+
second_pass += 1
|
44
|
+
else
|
45
|
+
break
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def then_promote_job(context_suite)
|
51
|
+
stop_test("Promouvoir la tâche sur l'origin #{context_suite.organisation_name}", :habitat_promotion_fail) unless habitat_task_completed?
|
52
|
+
end
|
53
|
+
|
54
|
+
def when_update_job(context_suite)
|
55
|
+
stop_test("Même tâche que son origin #{context_suite.organisation_name}", :same_last_build) unless habitat_task_different?
|
56
|
+
end
|
57
|
+
|
58
|
+
def when_job_completed(context_suite)
|
59
|
+
stop_test("Même tâche que son origin #{context_suite.organisation_name}", :build_completed) unless habitat_task_completed?
|
60
|
+
end
|
61
|
+
|
62
|
+
def then_clean_project(context_suite)
|
63
|
+
delete_file_only_if_exist(get_context_file(self, 'habitat/plan.sh/Gemfile.lock'))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/inspec.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module InspecSteps
|
5
|
+
def install_inspector(context_suite)
|
6
|
+
system("inspec habitat profile setup #{context_suite.habitat_name}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_inspector(context_suite)
|
10
|
+
system("inspec habitat profile create #{context_suite.habitat_name}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def upload_inspector(context_suite)
|
14
|
+
system("inspec habitat profile upload #{context_suite.habitat_name}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def inspec_habitat(context_suite)
|
18
|
+
system("inspec check #{context_suite.habitat_name}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def exec_inspec_habitat(context_suite)
|
22
|
+
system("inspec exec #{context_suite.habitat_name}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/kitchen.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module KitchenSteps
|
5
|
+
def given_kitchen(context_suite)
|
6
|
+
stop_test("Kitchen suite #{context_suite.kitchen_name} unavailable", :no_kitchen) unless kitchen_suite_exist?
|
7
|
+
end
|
8
|
+
|
9
|
+
def when_intializing(context_suite)
|
10
|
+
stop_test('Le projet est déjà initialisé', :already_initialized) if context_suite.status == :no_kitchen
|
11
|
+
end
|
12
|
+
|
13
|
+
def then_converge(context_suite)
|
14
|
+
stop_test("la suite kitchen #{context_suite.suite_kitchen} est en échec", :converge_fail) unless kitchen_converged_successfully?
|
15
|
+
end
|
16
|
+
|
17
|
+
def then_check_ok(context_suite)
|
18
|
+
context_suite.status = if verify_kitchen? && verify_habitat?
|
19
|
+
:ok
|
20
|
+
else
|
21
|
+
:not_all_ok
|
22
|
+
end
|
23
|
+
stop_test("la suite kitchen #{context_suite.suite_kitchen} est en échec", context_suite.status) if context_suite.status == :no_kitchen
|
24
|
+
end
|
25
|
+
|
26
|
+
def when_destroy_kitchen(context_suite)
|
27
|
+
verify_kitchen_status
|
28
|
+
stop_test("La suite #{context_suite.suite_kitchen} n'est pas détruit", context_suite.status) unless context_suite.status == :destroyed
|
29
|
+
end
|
30
|
+
|
31
|
+
def when_converge_kitchen(context_suite)
|
32
|
+
verify_kitchen_status
|
33
|
+
stop_test("La suite #{context_suite.suite_kitchen} n'est pas convergée", context_suite.status) unless context_suite.status == :converged
|
34
|
+
end
|
35
|
+
|
36
|
+
def when_validate_kitchen(context_suite)
|
37
|
+
verify_kitchen_status
|
38
|
+
stop_test("La suite #{context_suite.suite_kitchen} n'est pas vérifiée", context_suite.status) unless context_suite.status == :verified
|
39
|
+
end
|
40
|
+
|
41
|
+
def when_kitchen_fail(context_suite)
|
42
|
+
verify_kitchen_status
|
43
|
+
stop_test("La suite #{context_suite.suite_kitchen} est vérifié", context_suite.status) unless context_suite.status != :verified
|
44
|
+
end
|
45
|
+
|
46
|
+
def then_destroy_kitchen(context_suite)
|
47
|
+
stop_test("Kitchen suite #{context_suite.kitchen_suite} destruction failed", :no_kitchen) unless kitchen_destroyed_correctly?
|
48
|
+
end
|
49
|
+
|
50
|
+
def then_verify_kitchen(context_suite)
|
51
|
+
stop_test("Kitchen suite #{context_suite.kitchen_suite} verification failed", :verify_kitchen_failed) unless verify_kitchen?
|
52
|
+
end
|
53
|
+
|
54
|
+
def then_test_kitchen(context_suite)
|
55
|
+
stop_test("Kitchen suite #{context_suite.kitchen_suite} test failed", :test_kitchen_failed) unless kitchen_tested_successfully?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/knife.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module KnifeSteps
|
5
|
+
def when_list_cookbooks
|
6
|
+
stop_test('knife n\'est pas disponible, veuillez installer Chef Workstation', :no_knife) unless system('knife cookbook list')
|
7
|
+
end
|
8
|
+
|
9
|
+
def when_knife_available(sub_knife)
|
10
|
+
stop_test("le couteau #{sub_knife} n\'est pas disponible", :no_sub_knife) unless command_available?(sub_knife, 'knife context')
|
11
|
+
end
|
12
|
+
|
13
|
+
def given_knife(context_suite)
|
14
|
+
stop_test("Le couteau #{context_suite.knife_name} n\'est pas disponible", :no_context_knife) unless command_available?(context_suite.knife_context, 'knife context')
|
15
|
+
end
|
16
|
+
|
17
|
+
def then_show_help(context_suite)
|
18
|
+
# stop_test("le couteau #{context_suite.knife_context} ne peux afficher son aide", :no_sub_help) unless
|
19
|
+
system("knife #{context_suite.knife_context} #{context_suite.knife_command} --help")
|
20
|
+
end
|
21
|
+
|
22
|
+
def then_publish_cookbook(cookbook_name)
|
23
|
+
stop_test("le couteau ne peux publier le cookbook #{cookbook_name}", :cookbook_publish_fail) unless system("knife cookbook upload #{cookbook_name}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def then_deploy_cookbook(cookbook_name)
|
27
|
+
stop_test("chef ne peut déployer le cookbook #{cookbook_name}", :cookbook_deploy_fail) unless cookbook_push(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
def then_autopublish_cookbook(cookbook_name)
|
31
|
+
stop_test("le couteau ne peux publier le cookbook #{cookbook_name}", :cookbook_autopublish_fail) unless system("knife cookbook upload #{cookbook_name} --cookbook-path #{::File.dirname(Dir.pwd)}")
|
32
|
+
end
|
33
|
+
|
34
|
+
def then_execute_knife_command(context_suite)
|
35
|
+
stop_test("le couteau #{context_suite.knife_context} ne peux executer la commande #{context_suite.knife_command}", :sub_knife_issue) unless system("knife #{context_suite.knife_context} #{context_suite.knife_command}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def then_execute_sub_knife_command(context_suite)
|
39
|
+
stop_test("le couteau #{context_suite.knife_context} ne peux executer la commande #{context_suite.knife_command} #{context_suite.sub_knife_command}", :sub_knife_issue) unless system("knife #{context_suite.knife_context} #{context_suite.knife_command} #{context_suite.sub_knife_command}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/rake.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module RakeSteps
|
5
|
+
def then_do_rake(rake_action)
|
6
|
+
stop_test("L'action #{rake_action} à échouer", :rake_fail) unless system("cd habitat/plan.sh/; rake #{rake_action}") || true
|
7
|
+
end
|
8
|
+
|
9
|
+
def then_bump_version
|
10
|
+
stop_test("Bumper la version a échoué", :rake_bump_fail) unless GVB.internal_revision.nil? || system("git version-bump patch")
|
11
|
+
end
|
12
|
+
|
13
|
+
def then_save_version
|
14
|
+
stop_test("Bumper la version a échoué", :rake_bump_fail) unless write_cookbook_version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/ruby.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module RubySteps
|
5
|
+
def given_gem(context_suite)
|
6
|
+
context_log "Installing #{context_suite.gem_to_install}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def then_install_gem(context_suite)
|
10
|
+
stop_test("Gem #{context_suite.gem_to_install} fail to install", :install_fail) unless system("gem install #{context_suite.gem_to_install}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module SupermarketSteps
|
5
|
+
def given_cookbook(context_suite)
|
6
|
+
context_log "Installing cookbook #{context_suite.cookbook_to_install}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def then_install_cookbook(context_suite)
|
10
|
+
stop_test("Cookbook supermarket #{context_suite.cookbook_to_install} fail to share", :share_fail) unless system("knife supermarket share #{context_suite.cookbook_to_install} --cookbook-path ..")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/base.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
module Context
|
2
|
+
module Studio
|
3
|
+
module Base
|
4
|
+
def help
|
5
|
+
show_help(self)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test
|
9
|
+
context_log "\nExecute tests\n"
|
10
|
+
context_log "\n\nTest result: #{test_context_successful?}\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
def version
|
14
|
+
# do_prepare unless defined?(GitVersionBump)
|
15
|
+
# context_log "Getting version info for #{context_folder} and version should be #{GitVersionBump.version(true)}"
|
16
|
+
if defined?(GitVersionBump)
|
17
|
+
Gem::Version.new(GitVersionBump.version(true))
|
18
|
+
else
|
19
|
+
Gem::Version.new(cookbook_version(self))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_version_installed?
|
24
|
+
gem_installed?(self, context_name, version)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_context_successful?
|
28
|
+
context_log "Check if #{context_name} is install #{version}"
|
29
|
+
|
30
|
+
if cookbook_test_successful?(self) && cucumber_test_successful?(self) && current_version_installed?
|
31
|
+
context_log "Test context #{context_name} was successfully perform on version #{version}"
|
32
|
+
true
|
33
|
+
else
|
34
|
+
context_log "Test context #{context_name} has failed to perform #{version}"
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def on_a_dirty_studio?
|
40
|
+
git_dirty_state?(self)
|
41
|
+
end
|
42
|
+
|
43
|
+
def loaded_in_ruby?
|
44
|
+
gem_available?(self, context_name, version)
|
45
|
+
end
|
46
|
+
|
47
|
+
# def cycle
|
48
|
+
# ruby_cycle(self)
|
49
|
+
# end
|
50
|
+
|
51
|
+
# def build
|
52
|
+
# ruby_build(self)
|
53
|
+
# cookbook_build(self)
|
54
|
+
# build_habitat(self)
|
55
|
+
# end
|
56
|
+
|
57
|
+
# def commit
|
58
|
+
# cookbook_install(self)
|
59
|
+
# git_commit(self)
|
60
|
+
# end
|
61
|
+
|
62
|
+
# def push
|
63
|
+
# commit
|
64
|
+
# git_release(self)
|
65
|
+
# end
|
66
|
+
|
67
|
+
# def release
|
68
|
+
# context_log "\n\nRelease #{context_name} at version #{version}"
|
69
|
+
# cookbook_push(self)
|
70
|
+
# ruby_release(self)
|
71
|
+
# git_release(self)
|
72
|
+
# start_habitat_job(self)
|
73
|
+
# end
|
74
|
+
|
75
|
+
# def install
|
76
|
+
# ruby_install(self)
|
77
|
+
# end
|
78
|
+
|
79
|
+
# def clean
|
80
|
+
# clean_folder(self, 'contexts')
|
81
|
+
# ruby_clean(self)
|
82
|
+
# cookbook_clean(self)
|
83
|
+
# end
|
84
|
+
|
85
|
+
# def patch_bump
|
86
|
+
# GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true)}.#{GitVersionBump.patch_version(true) + 1}")
|
87
|
+
# show_new_version('Patch')
|
88
|
+
# end
|
89
|
+
|
90
|
+
# def minor_bump
|
91
|
+
# GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true) + 1}.0")
|
92
|
+
# show_new_version('Minor')
|
93
|
+
# end
|
94
|
+
|
95
|
+
# def major_bump
|
96
|
+
# GitVersionBump.tag_version("#{GitVersionBump.major_version(true) + 1}.0.0")
|
97
|
+
# show_new_version('Major')
|
98
|
+
# end
|
99
|
+
|
100
|
+
# def wait_until_release_available
|
101
|
+
# wait_until_release_available unless is_present_publicly?
|
102
|
+
# end
|
103
|
+
|
104
|
+
def load_dependencies
|
105
|
+
require 'simplecov_setup'
|
106
|
+
require 'git-version-bump'
|
107
|
+
require 'cucumber'
|
108
|
+
require 'cucumber/cli/main'
|
109
|
+
require 'cucumber/rspec/disable_option_parser'
|
110
|
+
end
|
111
|
+
|
112
|
+
# def test
|
113
|
+
# context_log "\nExecute tests\n"
|
114
|
+
# context_log "\n\nTest result: #{test_context_successful?}\n"
|
115
|
+
# end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
# case action
|
122
|
+
# when 'cycle'
|
123
|
+
# context.log "\nExecute only the cycle once\n"
|
124
|
+
# context.cycle
|
125
|
+
# true
|
126
|
+
# when 'agent'
|
127
|
+
# context.log "\nAlways in execution\n"
|
128
|
+
# while true do
|
129
|
+
# context.cycle
|
130
|
+
# end
|
131
|
+
# true
|
132
|
+
# when 'commit'
|
133
|
+
# context.log "\nBump minor version\n"
|
134
|
+
# context.commit
|
135
|
+
# true
|
136
|
+
# when 'push'
|
137
|
+
# context.log "\nBump minor version\n"
|
138
|
+
# context.push
|
139
|
+
# true
|
140
|
+
# when 'bump'
|
141
|
+
# context.log "\nBump minor version\n"
|
142
|
+
# context.patch_bump
|
143
|
+
# true
|
144
|
+
# when 'release'
|
145
|
+
# context.log "\nBump major version\n"
|
146
|
+
# context.minor_bump
|
147
|
+
# true
|
148
|
+
# when 'upgrade'
|
149
|
+
# context.log "\nBump major version\n"
|
150
|
+
# context.major_bump
|
151
|
+
# true
|
152
|
+
# when 'test'
|
153
|
+
# context.log "\nExecute tests\n"
|
154
|
+
# context.test_context_successful?
|
155
|
+
# when 'reset'
|
156
|
+
# context.log "\nReset versionning\n"
|
157
|
+
# system('rake')
|
158
|
+
# # context.cucumber_test(deployer)
|
159
|
+
# true
|
160
|
+
# when 'help'
|
161
|
+
# context.show_help(context)
|
162
|
+
# true
|
163
|
+
# else
|
164
|
+
# context.error_context_log context.context_name, "Unknown setting #{action}"
|
165
|
+
# show_help(context)
|
166
|
+
# false
|
167
|
+
# end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
module Studio
|
5
|
+
module Default
|
6
|
+
def actions_permitted
|
7
|
+
%w(
|
8
|
+
do_begin
|
9
|
+
do_download
|
10
|
+
do_verify
|
11
|
+
do_clean
|
12
|
+
do_unpack
|
13
|
+
do_prepare
|
14
|
+
do_build
|
15
|
+
do_check
|
16
|
+
do_install
|
17
|
+
do_strip
|
18
|
+
do_end
|
19
|
+
help
|
20
|
+
do_mix_cookbook
|
21
|
+
do_agent
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def do_mix_cookbook
|
26
|
+
cookbook_result = mix_run_list(self, context_name)
|
27
|
+
context_log "Mix the cookbook #{context_name}: #{cookbook_result.class}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def do_agent
|
31
|
+
git_build(self)
|
32
|
+
while true do
|
33
|
+
do_mix_cookbook
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Context
|
2
|
+
module Studio
|
3
|
+
module Deployer
|
4
|
+
def self.set(deployer_class)
|
5
|
+
@deployer = deployer_class if @deployer.nil?
|
6
|
+
@deployer
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.execute(action)
|
10
|
+
@deployer.send(action)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.method_missing(method_name, *argv, &block)
|
14
|
+
@deployer.debug_context_log "Searching method #{method_name} in context #{@deployer}"
|
15
|
+
is_deploy_context_respond_to_action = @deployer.respond_to?(method_name) && @deployer.actions_permitted?(method_name.to_s)
|
16
|
+
if is_deploy_context_respond_to_action
|
17
|
+
@deployer.execute_action(@deployer, method_name)
|
18
|
+
else
|
19
|
+
@deployer.debug_context_log "\n\nUnavailable action '#{method_name}' for context #{@deployer.context_name} as #{@deployer.respond_to?(method_name)} and #{@deployer.actions_permitted?(method_name)} for #{@deployer.class}\n"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
require_relative 'context-knife-context'
|
3
|
+
|
4
|
+
module Context
|
5
|
+
module DeployKnifeConstant
|
6
|
+
def organisation_name
|
7
|
+
'deploy-context'
|
8
|
+
end
|
9
|
+
|
10
|
+
def context_name
|
11
|
+
'deploy-context'
|
12
|
+
end
|
13
|
+
|
14
|
+
def context_folder
|
15
|
+
File.join(ENV['HOME'], 'deploy-context')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class DeployKnifeContext < Manager
|
20
|
+
banner "knife deploy knife context"
|
21
|
+
|
22
|
+
deps do
|
23
|
+
Knife::DefaultKnifeContext.load_deps
|
24
|
+
end
|
25
|
+
|
26
|
+
option :omg,
|
27
|
+
:short => '-O',
|
28
|
+
:long => '--omg',
|
29
|
+
:description => "I'm so excited! 9"
|
30
|
+
|
31
|
+
def run
|
32
|
+
if config[:omg]
|
33
|
+
puts "OMG HELLO WORLD!!!9!!99"
|
34
|
+
else
|
35
|
+
puts "I am just a fucking example. 9"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class DeployContext < Manager
|
41
|
+
include DeployKnifeConstant
|
42
|
+
banner "knife deploy context"
|
43
|
+
|
44
|
+
deps do
|
45
|
+
Knife::DefaultKnifeContext.load_deps
|
46
|
+
end
|
47
|
+
|
48
|
+
def run
|
49
|
+
run_cmd = if name_args.empty?
|
50
|
+
warning_context_log 'Deploy Context', 'No argumet passed'
|
51
|
+
show_help(self)
|
52
|
+
[]
|
53
|
+
else
|
54
|
+
warning_context_log 'Deploy Context', name_args
|
55
|
+
tmp_cmd = %w(knife context) + [name_args[0], 'studio']
|
56
|
+
if name_args[1].nil?
|
57
|
+
tmp_cmd
|
58
|
+
else
|
59
|
+
tmp_cmd + name_args[1...]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
execute_command(run_cmd)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
Étantdonné('la suite de test {word}') do |test_suite|
|
3
|
+
context_suite.test_suite = test_suite
|
4
|
+
given_test_suite(context_suite)
|
5
|
+
end
|
6
|
+
|
7
|
+
Quand('les tests sont réussi') do
|
8
|
+
test_successfull?(context_suite)
|
9
|
+
end
|
10
|
+
|
11
|
+
Étantdonné('le profile {word}') do |profile_name|
|
12
|
+
context_suite.profile_name = profile_name
|
13
|
+
given_profile_name(context_suite)
|
14
|
+
end
|
15
|
+
|
16
|
+
Alors('émettre le rapport') do
|
17
|
+
report_the_report(context_suite)
|
18
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
Étantdonné('la branche non maîtresse {word}') do |branch_name|
|
3
|
+
context_suite.branch_name = branch_name
|
4
|
+
given_branch(context_suite)
|
5
|
+
end
|
6
|
+
|
7
|
+
Quand('le dépot est brouillonné') do
|
8
|
+
when_dirty_branch(context_suite)
|
9
|
+
end
|
10
|
+
|
11
|
+
Quand('le dépot est propre') do
|
12
|
+
when_clean_branch(context_suite)
|
13
|
+
end
|
14
|
+
|
15
|
+
Alors('note les modifications au dépot') do
|
16
|
+
then_add_modification(context_suite)
|
17
|
+
end
|
18
|
+
|
19
|
+
Alors('interne les changements sur le dépot') do
|
20
|
+
then_commit_internal(context_suite)
|
21
|
+
end
|
22
|
+
|
23
|
+
Alors('fusionne le dépot avec la branche {word}') do |branch_name|
|
24
|
+
context_suite.branch_name = branch_name
|
25
|
+
then_merge_branch(context_suite)
|
26
|
+
end
|
27
|
+
|
28
|
+
Étantdonné('la branche maîtresse') do
|
29
|
+
context_suite.branch_name = 'master'
|
30
|
+
given_master_branch(context_suite)
|
31
|
+
end
|
32
|
+
|
33
|
+
Alors('déploi les courantes modifications') do
|
34
|
+
then_push_git(context_suite)
|
35
|
+
end
|
36
|
+
|
37
|
+
Alors('déploi les modifications de la branche {word}') do |branch_name|
|
38
|
+
context_suite.branch_name = branch_name
|
39
|
+
then_push_branch(context_suite)
|
40
|
+
end
|
41
|
+
|
42
|
+
Alors('va sur la branche non maîtresse {word}') do |branch_name|
|
43
|
+
context_suite.branch_name = branch_name
|
44
|
+
then_checkout_branch(context_suite)
|
45
|
+
end
|
46
|
+
|
47
|
+
Alors('récupère les dernières modifications') do
|
48
|
+
then_pull_origin
|
49
|
+
end
|
50
|
+
|
51
|
+
Alors('supprime le fichier de status') do
|
52
|
+
delete_status_file(context_suite)
|
53
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
Étantdonné('le plan {word}') do |habitat_plan|
|
3
|
+
context_suite.plan_path = habitat_plan
|
4
|
+
given_plan(context_suite)
|
5
|
+
end
|
6
|
+
|
7
|
+
Étantdonné('l\'organisation {word}') do |organisation_name|
|
8
|
+
context_suite.organisation_name = organisation_name
|
9
|
+
end
|
10
|
+
|
11
|
+
Étantdonné('l\'application {word}') do |application_name|
|
12
|
+
context_suite.application_name = application_name
|
13
|
+
end
|
14
|
+
|
15
|
+
Quand('le studio habitat est initialisé') do
|
16
|
+
when_initialize_habitat(context_suite)
|
17
|
+
end
|
18
|
+
|
19
|
+
Quand('le secret {word} est disponible') do |secret_key|
|
20
|
+
context_suite.secret_key = secret_key
|
21
|
+
when_secret_available(context_suite)
|
22
|
+
end
|
23
|
+
|
24
|
+
Alors('construit selon le plan') do
|
25
|
+
then_build_plan(context_suite)
|
26
|
+
end
|
27
|
+
|
28
|
+
Alors('démarre une tâche pour construire') do
|
29
|
+
then_start_job(context_suite)
|
30
|
+
end
|
31
|
+
|
32
|
+
Quand('le projet est terminé') do
|
33
|
+
when_project_end(context_suite)
|
34
|
+
end
|
35
|
+
|
36
|
+
Quand('le studio habitat réussi') do
|
37
|
+
when_studio_success(context_suite)
|
38
|
+
end
|
39
|
+
|
40
|
+
Quand('une tâche est dispatché') do
|
41
|
+
when_dispatch_job(context_suite)
|
42
|
+
end
|
43
|
+
|
44
|
+
Alors('attendre qu\'elle soit complété') do
|
45
|
+
then_wait_completion(context_suite)
|
46
|
+
end
|
47
|
+
|
48
|
+
Alors('promouvoir la dite tâche') do
|
49
|
+
then_promote_job(context_suite)
|
50
|
+
end
|
51
|
+
|
52
|
+
Quand('la dernière tâche diffère') do
|
53
|
+
when_update_job(context_suite)
|
54
|
+
end
|
55
|
+
|
56
|
+
Quand('son status est Complete') do
|
57
|
+
when_job_completed(context_suite)
|
58
|
+
end
|
59
|
+
|
60
|
+
Alors('enregistre le numéro de build') do
|
61
|
+
write_build_id
|
62
|
+
end
|
63
|
+
|
64
|
+
Alors('nettoie le plan de travail') do
|
65
|
+
then_clean_project(context_suite)
|
66
|
+
end
|
67
|
+
|
68
|
+
Alors('prépare le plan de travail') do
|
69
|
+
# prepare_workplan
|
70
|
+
end
|
71
|
+
|
72
|
+
Alors('afficher les variables usagers') do
|
73
|
+
generate_user_json
|
74
|
+
end
|