hybrid_platforms_conductor 33.9.5 → 34.0.0
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
- data/CHANGELOG.md +10 -0
- data/README.md +3 -1
- data/bin/free_veids +1 -1
- data/bin/last_deploys +1 -1
- data/bin/nodes_to_deploy +3 -3
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/lib/hybrid_platforms_conductor/core_extensions/bundler/without_bundled_env.rb +1 -1
- data/lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb +1 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +1 -1
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +3 -3
- data/lib/hybrid_platforms_conductor/deployer.rb +1 -1
- data/lib/hybrid_platforms_conductor/executable.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +2 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +9 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +1 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +1 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +1 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/keepass.rb +3 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +1 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +1 -1
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +6 -6
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +4 -6
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +1 -1
- data/lib/hybrid_platforms_conductor/platform_handler.rb +1 -1
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +1 -1
- data/lib/hybrid_platforms_conductor/services_handler.rb +6 -6
- data/lib/hybrid_platforms_conductor/test_report.rb +4 -4
- data/lib/hybrid_platforms_conductor/tests_runner.rb +3 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +2 -2
- data/lib/hybrid_platforms_conductor/topographer.rb +2 -2
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +3 -10
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +1 -6
- data/spec/hybrid_platforms_conductor_test/api/credentials_spec.rb +13 -13
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/keepass_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +1 -3
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +9 -9
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_3/recipes/35_unparsable_include.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +3 -2
- metadata +170 -244
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4105038cdad3d70849816004ec2d909053e0e792900fc03e514d7b1ddc95d9c4
|
4
|
+
data.tar.gz: 5bda67856370632895782f6271c4044c50c22b0f340d8fc36ec6e11d8ca8fd8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5a2dee126aecde247f6143f0d047e23280778755cb01cfb8c94d3f74bb128259bdba6044b25213a3e06f91e25fce53d71a31d6afa9dd95b01b797a4906e6745
|
7
|
+
data.tar.gz: f170805ef694bed86c8c673a3947b6c68755a27fba4ba79abebdf210dbf0ee39acb598466960f0eb3b387bb352dcc2b07094cca2e1f0d63b182eaa212d081926
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# [v34.0.0](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.5...v34.0.0) (2025-04-25 22:44:39)
|
2
|
+
|
3
|
+
### Patches
|
4
|
+
|
5
|
+
* [Fix NPM packages installation in Github workflows](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/5d18119b49ad7d0975d2c003139a394b9dd1116b)
|
6
|
+
|
7
|
+
### Breaking changes
|
8
|
+
|
9
|
+
* [Migrate to Ruby 3](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/6e1b93a37b68b01b3144fe03ccc280e1275dd493)
|
10
|
+
|
1
11
|
# [v33.9.5](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.4...v33.9.5) (2022-03-20 17:46:29)
|
2
12
|
|
3
13
|
### Patches
|
data/README.md
CHANGED
@@ -96,7 +96,7 @@ Here are the various plugin categories:
|
|
96
96
|
# Installation
|
97
97
|
|
98
98
|
Installing Hybrid Platforms Conductor requires 2 steps:
|
99
|
-
1. Have **Ruby >=
|
99
|
+
1. Have **Ruby >= 3.0** installed.
|
100
100
|
2. Install the `hybrid_platforms_conductor` Rubygem.
|
101
101
|
|
102
102
|
See [installation details](docs/install.md) for more details on how to install those.
|
@@ -429,6 +429,8 @@ A subset of tests (or even a single test) can be run by using a part of their na
|
|
429
429
|
|
430
430
|
To enable debugging logs during tests run, set the environment variable `TEST_DEBUG` to `1`: `TEST_DEBUG=1 bundle exec rspec -e "HybridPlatformsConductor::Deployer checking the docker images provisioning"`
|
431
431
|
|
432
|
+
Some tests depend on Docker and sshpass which should be installed separately if those tests are required to pass.
|
433
|
+
|
432
434
|
## License
|
433
435
|
|
434
436
|
BSD license (details in the [LICENSE.md file](LICENSE.md)).
|
data/bin/free_veids
CHANGED
@@ -11,7 +11,7 @@ executable.parse_options!
|
|
11
11
|
nodes_handler.prefetch_metadata_of nodes_handler.known_nodes, :veid
|
12
12
|
veids = nodes_handler.
|
13
13
|
known_nodes.
|
14
|
-
map { |node| nodes_handler.get_veid_of(node)
|
14
|
+
map { |node| nodes_handler.get_veid_of(node)&.to_i }.
|
15
15
|
compact
|
16
16
|
|
17
17
|
executable.out "Free VEIDs: #{([10_000] + veids).missing.rangify}"
|
data/bin/last_deploys
CHANGED
@@ -53,7 +53,7 @@ info_displayed = {
|
|
53
53
|
error: 'Error'
|
54
54
|
}
|
55
55
|
executable.out(Terminal::Table.new(headings: info_displayed.values) do |table|
|
56
|
-
sorted_deploy_info.each do |_node, deploy_info|
|
56
|
+
sorted_deploy_info.each do |(_node, deploy_info)|
|
57
57
|
table << info_displayed.keys.map { |key| deploy_info[key] }
|
58
58
|
end
|
59
59
|
end)
|
data/bin/nodes_to_deploy
CHANGED
@@ -68,9 +68,9 @@ unless ignore_deploy_info
|
|
68
68
|
node_impacted = false
|
69
69
|
# Loop over all possible repositories concerned by this deployment
|
70
70
|
repo_idx = 0
|
71
|
-
while node_deploy_info[:deployment_info].key?("repo_name_#{repo_idx}"
|
72
|
-
repo_name = node_deploy_info[:deployment_info]["repo_name_#{repo_idx}"
|
73
|
-
commit_id = node_deploy_info[:deployment_info]["commit_id_#{repo_idx}"
|
71
|
+
while node_deploy_info[:deployment_info].key?(:"repo_name_#{repo_idx}")
|
72
|
+
repo_name = node_deploy_info[:deployment_info][:"repo_name_#{repo_idx}"]
|
73
|
+
commit_id = node_deploy_info[:deployment_info][:"commit_id_#{repo_idx}"]
|
74
74
|
impacted_nodes = cache_impacted_nodes.dig(repo_name, commit_id)
|
75
75
|
if impacted_nodes.nil?
|
76
76
|
if platforms_handler.platform(repo_name)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -82,7 +82,7 @@ module HybridPlatformsConductor
|
|
82
82
|
|
83
83
|
provider ||= proc do |requested_resource, requester|
|
84
84
|
# Check environment variables
|
85
|
-
user = ENV
|
85
|
+
user = ENV.fetch("hpc_user_for_#{id}", nil)
|
86
86
|
# Clone the password as we are going to treat it as a secret string that will be wiped out
|
87
87
|
password = ENV["hpc_password_for_#{id}"].dup
|
88
88
|
if user.nil? || user.empty? || password.nil? || password.empty?
|
@@ -21,13 +21,13 @@ module HybridPlatformsConductor
|
|
21
21
|
# * *module_to_decorate* (Module): The module including the method to decorate
|
22
22
|
# * *method_name* (Symbol): The method name to be decorated
|
23
23
|
def self.decorate_method(module_to_decorate, method_name)
|
24
|
-
original_method_name = "__hpc__#{method_name}__undecorated__"
|
24
|
+
original_method_name = :"__hpc__#{method_name}__undecorated__"
|
25
25
|
module_to_decorate.alias_method original_method_name, method_name
|
26
|
-
module_to_decorate.define_method(method_name) do |*args, &block|
|
26
|
+
module_to_decorate.define_method(method_name) do |*args, **kwargs, &block|
|
27
27
|
result = nil
|
28
28
|
CurrentDirMonitor.monitor.synchronize do
|
29
29
|
# puts "TID #{Thread.current.object_id} from #{caller[2]} - Current dir monitor taken from #{Dir.pwd}"
|
30
|
-
result = send(original_method_name, *args, &block)
|
30
|
+
result = send(original_method_name, *args, **kwargs, &block)
|
31
31
|
# puts "TID #{Thread.current.object_id} from #{caller[2]} - Current dir monitor released back to #{Dir.pwd}"
|
32
32
|
end
|
33
33
|
result
|
@@ -288,7 +288,7 @@ module HybridPlatformsConductor
|
|
288
288
|
|
289
289
|
# Check that we are allowed to deploy
|
290
290
|
unless @use_why_run
|
291
|
-
reason_for_interdiction = @services_handler.
|
291
|
+
reason_for_interdiction = @services_handler.barrier_to_deploy(
|
292
292
|
services: services_to_deploy,
|
293
293
|
local_environment: @local_environment
|
294
294
|
)
|
@@ -86,7 +86,7 @@ module HybridPlatformsConductor
|
|
86
86
|
#
|
87
87
|
# Result::
|
88
88
|
# * Boolean: Has a singleton been instantiated for this component?
|
89
|
-
define_method("#{component}_instantiated?"
|
89
|
+
define_method(:"#{component}_instantiated?") do
|
90
90
|
@instantiated_components.key?(component)
|
91
91
|
end
|
92
92
|
|
@@ -69,6 +69,8 @@ module HybridPlatformsConductor
|
|
69
69
|
# Number of threads max to use for ssh-keyscan calls
|
70
70
|
MAX_THREADS_SSH_KEY_SCAN = 32
|
71
71
|
|
72
|
+
private_constant :TIMEOUT_SSH_KEYSCAN, :MAX_THREADS_SSH_KEY_SCAN
|
73
|
+
|
72
74
|
# Discover the host keys associated to a list of hosts.
|
73
75
|
#
|
74
76
|
# Parameters::
|
@@ -85,7 +85,7 @@ module HybridPlatformsConductor
|
|
85
85
|
binding
|
86
86
|
end
|
87
87
|
variables.each do |var_name, var_value|
|
88
|
-
erb_context.instance_variable_set("@#{var_name}"
|
88
|
+
erb_context.instance_variable_set(:"@#{var_name}", var_value)
|
89
89
|
end
|
90
90
|
ERB.new(@gateways[gateway_conf]).result(erb_context.private_binding)
|
91
91
|
end
|
@@ -131,8 +131,8 @@ module HybridPlatformsConductor
|
|
131
131
|
# [API] - @nodes_handler can be used
|
132
132
|
def init
|
133
133
|
# Default values
|
134
|
-
@ssh_user = ENV
|
135
|
-
@ssh_user = ENV
|
134
|
+
@ssh_user = ENV.fetch('hpc_ssh_user', nil)
|
135
|
+
@ssh_user = ENV.fetch('USER', nil) if @ssh_user.nil? || @ssh_user.empty?
|
136
136
|
if @ssh_user.nil? || @ssh_user.empty?
|
137
137
|
_exit_status, stdout = @cmd_runner.run_cmd 'whoami', log_to_stdout: log_debug?
|
138
138
|
@ssh_user = stdout.strip
|
@@ -141,7 +141,7 @@ module HybridPlatformsConductor
|
|
141
141
|
@ssh_strict_host_key_checking = true
|
142
142
|
@passwords = {}
|
143
143
|
@auth_password = false
|
144
|
-
@ssh_gateways_conf = ENV['hpc_ssh_gateways_conf']
|
144
|
+
@ssh_gateways_conf = ENV['hpc_ssh_gateways_conf']&.to_sym
|
145
145
|
@ssh_gateway_user = ENV['hpc_ssh_gateway_user'].nil? ? 'ubradm' : ENV['hpc_ssh_gateway_user']
|
146
146
|
# The map of existing ssh directories that have been created, per node that can access them
|
147
147
|
# Array< String, Array<String> >
|
@@ -333,13 +333,13 @@ module HybridPlatformsConductor
|
|
333
333
|
#{File.basename(from)} | \
|
334
334
|
#{ssh_exec} \
|
335
335
|
#{ssh_url} \
|
336
|
-
|
336
|
+
"#{need_sudo ? @actions_executor.sudo_prefix(@node) : ''}tar \
|
337
337
|
--extract \
|
338
338
|
--gunzip \
|
339
339
|
--file - \
|
340
340
|
--directory #{to} \
|
341
341
|
--owner root \
|
342
|
-
|
342
|
+
"
|
343
343
|
EO_BASH
|
344
344
|
end
|
345
345
|
end
|
@@ -415,7 +415,7 @@ module HybridPlatformsConductor
|
|
415
415
|
User #{@ssh_user}
|
416
416
|
# Default control socket path to be used when multiplexing SSH connections
|
417
417
|
ControlPath #{control_master_file('%h', '%p', '%r')}
|
418
|
-
#{open_ssh_major_version >= 7 ? 'PubkeyAcceptedKeyTypes +ssh-dss' : ''}
|
418
|
+
#{open_ssh_major_version >= 7 && open_ssh_major_version < 9 ? 'PubkeyAcceptedKeyTypes +ssh-dss' : ''}
|
419
419
|
#{known_hosts_file.nil? ? '' : "UserKnownHostsFile #{known_hosts_file}"}
|
420
420
|
#{@ssh_strict_host_key_checking ? '' : 'StrictHostKeyChecking no'}
|
421
421
|
|
@@ -492,6 +492,8 @@ module HybridPlatformsConductor
|
|
492
492
|
# Time in seconds to wait between different retries because system is booting up
|
493
493
|
WAIT_TIME_FOR_BOOT = 10
|
494
494
|
|
495
|
+
private_constant :MAX_THREADS_CONTROL_MASTER, :MAX_RETRIES_FOR_BOOT, :WAIT_TIME_FOR_BOOT
|
496
|
+
|
495
497
|
# Open an SSH control master to multiplex connections to a given list of nodes.
|
496
498
|
# This method is re-entrant and reuses the same control masters.
|
497
499
|
# It is multi-processes:
|
@@ -160,7 +160,7 @@ module HybridPlatformsConductor
|
|
160
160
|
flatten(1)
|
161
161
|
# Check for some helpers we know include some recipes
|
162
162
|
@config.known_helpers_including_recipes.each do |helper_name, used_recipes_by_helper|
|
163
|
-
if recipe_content =~
|
163
|
+
if recipe_content =~ /(\W|^)#{Regexp.escape(helper_name)}(\W|$)/
|
164
164
|
used_recipes.concat(used_recipes_by_helper.map { |recipe_def| @platform.decode_recipe(recipe_def) })
|
165
165
|
used_recipes.uniq!
|
166
166
|
end
|
@@ -214,6 +214,7 @@ module HybridPlatformsConductor
|
|
214
214
|
INVALID_LIBRARY_METHODS = [
|
215
215
|
'initialize'
|
216
216
|
]
|
217
|
+
private_constant :INVALID_LIBRARY_METHODS
|
217
218
|
|
218
219
|
# Get the user defined library methods, per cookbook.
|
219
220
|
# Keep a memory cache of it.
|
@@ -16,7 +16,7 @@ module HybridPlatformsConductor
|
|
16
16
|
def init
|
17
17
|
# This method is called when initializing a new instance of this platform handler, for a given repository.
|
18
18
|
inv_file = "#{@repository_path}/inventory.yaml"
|
19
|
-
@inventory = File.exist?(inv_file) ? YAML.
|
19
|
+
@inventory = File.exist?(inv_file) ? YAML.safe_load_file(inv_file) : {}
|
20
20
|
end
|
21
21
|
|
22
22
|
# Get the list of known nodes.
|
data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container
CHANGED
@@ -85,8 +85,8 @@ begin
|
|
85
85
|
|
86
86
|
proxmox_waiter = ProxmoxWaiter.new(
|
87
87
|
config_file,
|
88
|
-
ENV
|
89
|
-
ENV
|
88
|
+
ENV.fetch('hpc_user_for_proxmox', nil),
|
89
|
+
ENV.fetch('hpc_password_for_proxmox', nil),
|
90
90
|
ENV['hpc_realm_for_proxmox'] || 'pam'
|
91
91
|
)
|
92
92
|
|
@@ -518,6 +518,7 @@ module HybridPlatformsConductor
|
|
518
518
|
# Consider that it is to be used on the following patterns: (config|create|destroy)_<ID>.json
|
519
519
|
# So remaining length is 255 - 13 = 242 characters.
|
520
520
|
MAX_FILE_ID_SIZE = 242
|
521
|
+
private_constant :MAX_FILE_ID_SIZE
|
521
522
|
|
522
523
|
# Get an ID unique for this node/environment and that can be used in file names.
|
523
524
|
#
|
@@ -87,8 +87,8 @@ module HybridPlatformsConductor
|
|
87
87
|
|
88
88
|
with_credentials_for(:keepass, resource: keepass_secrets_info[:database]) do |_user, password|
|
89
89
|
Tempfile.create('hpc_keepass') do |xml_file|
|
90
|
-
key_file = ENV
|
91
|
-
password_enc = ENV
|
90
|
+
key_file = ENV.fetch('hpc_key_file_for_keepass', nil)
|
91
|
+
password_enc = ENV.fetch('hpc_password_enc_for_keepass', nil)
|
92
92
|
keepass_credentials = {}
|
93
93
|
keepass_credentials[:password] = password.to_unprotected if password
|
94
94
|
keepass_credentials[:password_enc] = password_enc if password_enc
|
@@ -116,6 +116,7 @@ module HybridPlatformsConductor
|
|
116
116
|
url: 'URL',
|
117
117
|
user_name: 'UserName'
|
118
118
|
}
|
119
|
+
private_constant :FIELDS
|
119
120
|
|
120
121
|
# Parse XML secrets from a Nokogiri XML group node
|
121
122
|
#
|
@@ -26,12 +26,12 @@ module HybridPlatformsConductor
|
|
26
26
|
cmd_runner: @cmd_runner
|
27
27
|
).known_platforms.first
|
28
28
|
unless example_platform.nil?
|
29
|
-
tests.
|
29
|
+
tests.push(
|
30
30
|
"#{CmdRunner.executables_prefix}get_impacted_nodes --platform #{example_platform.name} --show-commands"
|
31
|
-
|
31
|
+
)
|
32
32
|
example_node = example_platform.known_nodes.first
|
33
33
|
unless example_node.nil?
|
34
|
-
tests.
|
34
|
+
tests.push(
|
35
35
|
"#{CmdRunner.executables_prefix}check-node --node #{example_node} --show-commands",
|
36
36
|
"#{CmdRunner.executables_prefix}deploy --node #{example_node} --show-commands --why-run",
|
37
37
|
"#{CmdRunner.executables_prefix}last_deploys --node #{example_node} --show-commands",
|
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
|
|
39
39
|
"#{CmdRunner.executables_prefix}report --node #{example_node} --format stdout",
|
40
40
|
"#{CmdRunner.executables_prefix}run --node #{example_node} --show-commands --interactive",
|
41
41
|
"#{CmdRunner.executables_prefix}topograph --from \"--node #{example_node}\" --to \"--node #{example_node}\" --skip-run --output graphviz:graph.gv"
|
42
|
-
|
42
|
+
)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
tests.sort.each do |cmd|
|
@@ -48,7 +48,7 @@ module HybridPlatformsConductor
|
|
48
48
|
assert_equal(exit_status, 0, "Command #{cmd} returned code #{exit_status}:\n#{stdout}")
|
49
49
|
end
|
50
50
|
# Remove the file created by Topograph if it exists
|
51
|
-
|
51
|
+
FileUtils.rm_f('graph.gv')
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
@@ -20,11 +20,11 @@ module HybridPlatformsConductor
|
|
20
20
|
_exit_status, stdout, _stderr = @cmd_runner.run_cmd(<<~EO_BASH, log_to_stdout: log_debug?, no_exception: true, expected_code: [0, 1])
|
21
21
|
cd #{@platform.repository_path} && \
|
22
22
|
git --no-pager log \
|
23
|
-
--pretty=format
|
23
|
+
--pretty=format:"%H" \
|
24
24
|
--graph \
|
25
25
|
$(git merge-base \
|
26
26
|
--octopus \
|
27
|
-
$(git --no-pager log #{merge_commit_id} --max-count 1 --pretty=format
|
27
|
+
$(git --no-pager log #{merge_commit_id} --max-count 1 --pretty=format:"%P") \
|
28
28
|
)..#{merge_commit_id}
|
29
29
|
| grep '|'
|
30
30
|
EO_BASH
|
@@ -13,7 +13,7 @@ module HybridPlatformsConductor
|
|
13
13
|
@nodes_handler.prefetch_metadata_of @nodes_handler.known_nodes, :veid
|
14
14
|
veids = @nodes_handler.
|
15
15
|
known_nodes.
|
16
|
-
to_h { |node| [node, @nodes_handler.get_veid_of(node)
|
16
|
+
to_h { |node| [node, @nodes_handler.get_veid_of(node)&.to_i] }
|
17
17
|
|
18
18
|
# Check there are no duplicates
|
19
19
|
veids.group_by { |_node, veid| veid }.each do |veid, nodes|
|
@@ -55,7 +55,7 @@ module HybridPlatformsConductor
|
|
55
55
|
def dump_json_for(nodes_selectors)
|
56
56
|
nodes = @nodes_handler.select_nodes(nodes_selectors)
|
57
57
|
unless @skip_run
|
58
|
-
nodes.map { |node| @nodes_handler.platform_for(node) }.uniq.each
|
58
|
+
nodes.map { |node| @nodes_handler.platform_for(node) }.uniq.each do |platform_handler|
|
59
59
|
platform_handler.prepare_why_run_deploy_for_json_dump if platform_handler.respond_to?(:prepare_why_run_deploy_for_json_dump)
|
60
60
|
end
|
61
61
|
@deployer.concurrent_execution = true
|
@@ -221,7 +221,7 @@ module HybridPlatformsConductor
|
|
221
221
|
# * Object: The stdout log device
|
222
222
|
def stdout_device
|
223
223
|
# TODO: Find a more elegant way to access the internal log device
|
224
|
-
@logger.instance_variable_get(:@logdev)
|
224
|
+
@logger.instance_variable_get(:@logdev)&.dev
|
225
225
|
end
|
226
226
|
|
227
227
|
# Set the stdout device
|
@@ -230,7 +230,7 @@ module HybridPlatformsConductor
|
|
230
230
|
# * *log_device* (Object): The stdout log device to set
|
231
231
|
def stdout_device=(log_device)
|
232
232
|
# TODO: Find a more elegant way to access the internal log device
|
233
|
-
@logger.instance_variable_get(:@logdev)
|
233
|
+
@logger.instance_variable_get(:@logdev)&.send(:set_dev, log_device)
|
234
234
|
end
|
235
235
|
|
236
236
|
# Get the stderr device
|
@@ -239,7 +239,7 @@ module HybridPlatformsConductor
|
|
239
239
|
# * IO or String: The stdout IO or file name
|
240
240
|
def stderr_device
|
241
241
|
# TODO: Find a more elegant way to access the internal log device
|
242
|
-
@logger_stderr.instance_variable_get(:@logdev)
|
242
|
+
@logger_stderr.instance_variable_get(:@logdev)&.dev
|
243
243
|
end
|
244
244
|
|
245
245
|
# Set the stderr device
|
@@ -248,7 +248,7 @@ module HybridPlatformsConductor
|
|
248
248
|
# * *log_device* (Object): The stdout log device to set
|
249
249
|
def stderr_device=(log_device)
|
250
250
|
# TODO: Find a more elegant way to access the internal log device
|
251
|
-
@logger_stderr.instance_variable_get(:@logdev)
|
251
|
+
@logger_stderr.instance_variable_get(:@logdev)&.send(:set_dev, log_device)
|
252
252
|
end
|
253
253
|
|
254
254
|
# Is stdout really getting to the terminal display?
|
@@ -307,8 +307,8 @@ module HybridPlatformsConductor
|
|
307
307
|
yield progress_bar
|
308
308
|
ensure
|
309
309
|
LoggerHelpers.progress_bar_semaphore.synchronize do
|
310
|
-
stdout_device
|
311
|
-
stderr_device
|
310
|
+
stdout_device&.flush
|
311
|
+
stderr_device&.flush
|
312
312
|
self.stdout_device = previous_stdout_device unless previous_stdout_device.nil?
|
313
313
|
self.stderr_device = previous_stderr_device unless previous_stderr_device.nil?
|
314
314
|
end
|
@@ -323,7 +323,7 @@ module HybridPlatformsConductor
|
|
323
323
|
# Parameters::
|
324
324
|
# * *property* (Symbol): The property name
|
325
325
|
def define_property_method_for(property)
|
326
|
-
define_singleton_method("get_#{property}_of"
|
326
|
+
define_singleton_method(:"get_#{property}_of") { |node| metadata_of(node, property) }
|
327
327
|
end
|
328
328
|
|
329
329
|
# Accept any method of name get_<property>_of to get the metadata property of a given node.
|
@@ -331,15 +331,13 @@ module HybridPlatformsConductor
|
|
331
331
|
#
|
332
332
|
# Parameters::
|
333
333
|
# * *method* (Symbol): The missing method name
|
334
|
-
|
335
|
-
# * *block* (Proc): Code block given to the call
|
336
|
-
def method_missing(method, *args, &block)
|
334
|
+
def method_missing(method, ...)
|
337
335
|
if method.to_s =~ /^get_(.*)_of$/
|
338
336
|
property = Regexp.last_match(1).to_sym
|
339
337
|
# Define the method so that we don't go trough method_missing next time (more efficient).
|
340
338
|
define_property_method_for(property)
|
341
339
|
# Then call it
|
342
|
-
send("get_#{property}_of"
|
340
|
+
send(:"get_#{property}_of", ...)
|
343
341
|
else
|
344
342
|
# We really don't know this method.
|
345
343
|
# Call original implementation of method_missing that will raise an exception.
|
@@ -391,7 +389,7 @@ module HybridPlatformsConductor
|
|
391
389
|
end
|
392
390
|
# Property values, per node name
|
393
391
|
# Hash< String, Object >
|
394
|
-
metadata_from_cmdb = cmdb.send("get_#{cmdb_property}"
|
392
|
+
metadata_from_cmdb = cmdb.send(:"get_#{cmdb_property}", nodes_to_query, @metadata.slice(*nodes_to_query)).transform_values do |cmdb_result|
|
395
393
|
cmdb_property == :others ? cmdb_result[property] : cmdb_result
|
396
394
|
end.compact
|
397
395
|
cmdb_log_header = "[CMDB #{cmdb.class.name.split('::').last}.#{cmdb_property}] -"
|
@@ -72,7 +72,7 @@ module HybridPlatformsConductor
|
|
72
72
|
nbr_processing = pools[:processing].size
|
73
73
|
nbr_processed = pools[:processed].size
|
74
74
|
end
|
75
|
-
progress_bar.title = "Queue: #{nbr_to_process} - Processing: #{nbr_processing} - Done: #{nbr_processed} - Total: #{nbr_total}"
|
75
|
+
progress_bar.title = "Queue: #{nbr_to_process} - Processing: #{nbr_processing} - Done: #{nbr_processed} - Total: #{nbr_total}" if stdout_displayed?
|
76
76
|
progress_bar.progress = nbr_processed
|
77
77
|
break if nbr_processed == nbr_total
|
78
78
|
|
@@ -17,7 +17,7 @@ module HybridPlatformsConductor
|
|
17
17
|
# Make sure we define automatically a helper for such a platform
|
18
18
|
mixin = Module.new
|
19
19
|
platform_type = subclass.name.split('::').last.gsub(/([a-z\d])([A-Z\d])/, '\1_\2').downcase.to_sym
|
20
|
-
mixin.define_method("#{platform_type}_platform"
|
20
|
+
mixin.define_method(:"#{platform_type}_platform") do |path: nil, git: nil, branch: 'master', name: nil, &platform_config_code|
|
21
21
|
repository_path =
|
22
22
|
if !path.nil?
|
23
23
|
path
|
@@ -82,7 +82,7 @@ module HybridPlatformsConductor
|
|
82
82
|
# Result::
|
83
83
|
# * Array<PlatformHandler>: List of platform handlers
|
84
84
|
def known_platforms(platform_type: nil)
|
85
|
-
(platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |search_platform_type|
|
85
|
+
(platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |search_platform_type| @platform_handlers[search_platform_type] || [] }.flatten
|
86
86
|
end
|
87
87
|
|
88
88
|
# Return the platform handler for a given platform name
|
@@ -52,7 +52,7 @@ module HybridPlatformsConductor
|
|
52
52
|
@platforms_handler.inject_dependencies(nodes_handler: @nodes_handler, actions_executor: @actions_executor)
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
# Get a potential reason that would prevent deployment.
|
56
56
|
# This checks eventual restrictions on deployments, considering environments, options, secrets...
|
57
57
|
#
|
58
58
|
# Parameters::
|
@@ -60,7 +60,7 @@ module HybridPlatformsConductor
|
|
60
60
|
# * *local_environment* (Boolean): Are we deploying to a local environment?
|
61
61
|
# Result::
|
62
62
|
# * String or nil: Reason for which we are not allowed to deploy, or nil if deployment is authorized
|
63
|
-
def
|
63
|
+
def barrier_to_deploy(
|
64
64
|
services:,
|
65
65
|
local_environment:
|
66
66
|
)
|
@@ -198,13 +198,13 @@ module HybridPlatformsConductor
|
|
198
198
|
# Get all platforms involved in the deployment of those services on this node
|
199
199
|
platforms_for(node => services).keys.each.with_index do |platform, platform_idx|
|
200
200
|
log_info.merge!(
|
201
|
-
"repo_name_#{platform_idx}"
|
201
|
+
"repo_name_#{platform_idx}": platform.name
|
202
202
|
)
|
203
203
|
if platform.info.key?(:commit)
|
204
204
|
log_info.merge!(
|
205
|
-
"commit_id_#{platform_idx}"
|
206
|
-
"commit_message_#{platform_idx}"
|
207
|
-
"diff_files_#{platform_idx}"
|
205
|
+
"commit_id_#{platform_idx}": platform.info[:commit][:id],
|
206
|
+
"commit_message_#{platform_idx}": platform.info[:commit][:message].split("\n").first,
|
207
|
+
"diff_files_#{platform_idx}": (platform.info[:status][:changed_files] + platform.info[:status][:added_files] + platform.info[:status][:deleted_files] + platform.info[:status][:untracked_files]).join(', ')
|
208
208
|
)
|
209
209
|
end
|
210
210
|
end
|
@@ -155,11 +155,11 @@ module HybridPlatformsConductor
|
|
155
155
|
first_criteria =
|
156
156
|
case first_criteria
|
157
157
|
when :test_name
|
158
|
-
proc
|
158
|
+
proc(&:name)
|
159
159
|
when :platform
|
160
|
-
proc
|
160
|
+
proc(&:platform)
|
161
161
|
when :node
|
162
|
-
proc
|
162
|
+
proc(&:node)
|
163
163
|
else
|
164
164
|
raise "Unknown group criteria name: #{first_criteria}"
|
165
165
|
end
|
@@ -232,7 +232,7 @@ module HybridPlatformsConductor
|
|
232
232
|
def flatten_hash(hash)
|
233
233
|
hash.each_with_object({}) do |(k, v), h|
|
234
234
|
if v.is_a? Hash
|
235
|
-
flatten_hash(v).map { |h_k, h_v| h["#{k}.#{h_k}"
|
235
|
+
flatten_hash(v).map { |h_k, h_v| h[:"#{k}.#{h_k}"] = h_v }
|
236
236
|
else
|
237
237
|
h[k] = v
|
238
238
|
end
|
@@ -404,6 +404,8 @@ module HybridPlatformsConductor
|
|
404
404
|
# String
|
405
405
|
CMD_SEPARATOR = '===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework ====='
|
406
406
|
|
407
|
+
private_constant :CONNECTION_TIMEOUT, :DEFAULT_CMD_TIMEOUT, :CMD_SEPARATOR
|
408
|
+
|
407
409
|
# Run tests that are node specific and require a connection to the node
|
408
410
|
def run_tests_connection_on_nodes
|
409
411
|
run_tests_on_subjects(
|
@@ -513,6 +515,7 @@ module HybridPlatformsConductor
|
|
513
515
|
# Timeout in seconds given to a check-node run
|
514
516
|
# Integer
|
515
517
|
CHECK_NODE_TIMEOUT = 30 * 60 # 30 minutes
|
518
|
+
private_constant :CHECK_NODE_TIMEOUT
|
516
519
|
|
517
520
|
# Run tests that use check-node results
|
518
521
|
def run_tests_on_check_nodes
|