hybrid_platforms_conductor 32.12.0 → 32.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1103 -0
- data/LICENSE.md +31 -0
- data/README.md +395 -0
- data/bin/setup +1 -1
- data/docs/api.md +349 -0
- data/docs/config_dsl.md +315 -0
- data/docs/executables.md +226 -0
- data/docs/executables/check-node.md +155 -0
- data/docs/executables/deploy.md +198 -0
- data/docs/executables/dump_nodes_json.md +110 -0
- data/docs/executables/free_ips.md +93 -0
- data/docs/executables/free_veids.md +73 -0
- data/docs/executables/get_impacted_nodes.md +94 -0
- data/docs/executables/last_deploys.md +114 -0
- data/docs/executables/nodes_to_deploy.md +139 -0
- data/docs/executables/report.md +159 -0
- data/docs/executables/run.md +126 -0
- data/docs/executables/setup.md +92 -0
- data/docs/executables/ssh_config.md +151 -0
- data/docs/executables/test.md +213 -0
- data/docs/executables/topograph.md +139 -0
- 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/docs/install.md +161 -0
- data/docs/plugins.md +215 -0
- data/docs/plugins/action/bash.md +37 -0
- data/docs/plugins/action/interactive.md +37 -0
- data/docs/plugins/action/remote_bash.md +67 -0
- data/docs/plugins/action/ruby.md +69 -0
- data/docs/plugins/action/scp.md +61 -0
- data/docs/plugins/cmdb/config.md +46 -0
- data/docs/plugins/cmdb/host_ip.md +33 -0
- data/docs/plugins/cmdb/host_keys.md +33 -0
- data/docs/plugins/cmdb/platform_handlers.md +33 -0
- data/docs/plugins/connector/local.md +28 -0
- data/docs/plugins/connector/ssh.md +95 -0
- data/docs/plugins/platform_handler/yaml_inventory.md +105 -0
- data/docs/plugins/provisioner/docker.md +27 -0
- data/docs/plugins/provisioner/podman.md +27 -0
- data/docs/plugins/provisioner/proxmox.md +115 -0
- data/docs/plugins/report/confluence.md +49 -0
- data/docs/plugins/report/mediawiki.md +28 -0
- data/docs/plugins/report/stdout.md +32 -0
- data/docs/plugins/test/bitbucket_conf.md +97 -0
- data/docs/plugins/test/can_be_checked.md +27 -0
- data/docs/plugins/test/check_deploy_and_idempotence.md +61 -0
- data/docs/plugins/test/check_from_scratch.md +28 -0
- data/docs/plugins/test/connection.md +27 -0
- data/docs/plugins/test/deploy_freshness.md +27 -0
- data/docs/plugins/test/deploy_from_scratch.md +28 -0
- data/docs/plugins/test/deploy_removes_root_access.md +29 -0
- data/docs/plugins/test/divergence.md +41 -0
- data/docs/plugins/test/executables.md +26 -0
- data/docs/plugins/test/file_system.md +49 -0
- data/docs/plugins/test/file_system_hdfs.md +65 -0
- data/docs/plugins/test/hostname.md +27 -0
- data/docs/plugins/test/idempotence.md +56 -0
- data/docs/plugins/test/ip.md +28 -0
- data/docs/plugins/test/jenkins_ci_conf.md +54 -0
- data/docs/plugins/test/jenkins_ci_masters_ok.md +54 -0
- data/docs/plugins/test/linear_strategy.md +26 -0
- data/docs/plugins/test/local_users.md +48 -0
- data/docs/plugins/test/mounts.md +55 -0
- data/docs/plugins/test/orphan_files.md +38 -0
- data/docs/plugins/test/ports.md +50 -0
- data/docs/plugins/test/private_ips.md +27 -0
- data/docs/plugins/test/public_ips.md +27 -0
- data/docs/plugins/test/spectre.md +26 -0
- data/docs/plugins/test/veids.md +27 -0
- data/docs/plugins/test/vulnerabilities.md +65 -0
- data/docs/plugins/test_report/confluence.md +43 -0
- data/docs/plugins/test_report/stdout.md +26 -0
- data/docs/plugins_create.md +135 -0
- data/docs/tutorial.md +57 -0
- data/docs/tutorial/01_installation.md +129 -0
- data/docs/tutorial/02_first_node.md +466 -0
- data/docs/tutorial/03_scale.md +876 -0
- data/docs/tutorial/04_test.md +965 -0
- data/docs/tutorial/05_extend_with_plugins.md +1132 -0
- data/examples/bare/Gemfile +4 -0
- data/examples/bare/hpc_config.rb +2 -0
- data/examples/localhost/Gemfile +4 -0
- data/examples/localhost/hpc_config.rb +2 -0
- data/examples/localhost/inventory.yaml +4 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +1 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +3 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +29 -13
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +98 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +7 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +140 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +5 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +19 -17
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +3 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +4 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +8 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +1 -1
- data/lib/hybrid_platforms_conductor/json_dumper.rb +1 -1
- data/lib/hybrid_platforms_conductor/platform_handler.rb +1 -1
- data/lib/hybrid_platforms_conductor/services_handler.rb +18 -16
- data/lib/hybrid_platforms_conductor/tests_runner.rb +0 -1
- data/lib/hybrid_platforms_conductor/topographer.rb +0 -1
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +16 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +113 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +6 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +38 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +10 -0
- data/tools/check_md +89 -0
- data/tools/generate_mermaid +75 -0
- metadata +207 -12
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb
CHANGED
@@ -97,11 +97,15 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
it 'fails if no user name has been given, either through environment
|
100
|
+
it 'fails if no user name has been given, either through environment, command-line or using whoami' do
|
101
101
|
ENV.delete 'hpc_ssh_user'
|
102
102
|
ENV.delete 'USER'
|
103
103
|
with_test_platform_for_cli do
|
104
|
-
|
104
|
+
with_cmd_runner_mocked([
|
105
|
+
['whoami', proc { [0, '', ''] }]
|
106
|
+
]) do
|
107
|
+
expect { run 'run', '--node', 'node', '--command', 'echo Hello' }.to raise_error(RuntimeError, 'No SSH user name specified. Please use --ssh-user option or hpc_ssh_user environment variable to set it.')
|
108
|
+
end
|
105
109
|
end
|
106
110
|
end
|
107
111
|
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb
CHANGED
@@ -47,7 +47,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
47
47
|
end.join("\n") + "\n"
|
48
48
|
end
|
49
49
|
|
50
|
-
it 'generates a global configuration with user from environment' do
|
50
|
+
it 'generates a global configuration with user from hpc_ssh_user environment variable' do
|
51
51
|
with_test_platform do
|
52
52
|
ENV['hpc_ssh_user'] = 'test_user'
|
53
53
|
expect(ssh_config_for(nil)).to eq <<~EOS
|
@@ -59,6 +59,43 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
it 'generates a global configuration with user from USER environment variable' do
|
63
|
+
with_test_platform do
|
64
|
+
ENV['USER'] = 'test_user'
|
65
|
+
expect(ssh_config_for(nil)).to eq <<~EOS
|
66
|
+
Host *
|
67
|
+
User test_user
|
68
|
+
ControlPath #{Dir.tmpdir}/hpc_ssh/hpc_ssh_mux_%h_%p_%r
|
69
|
+
PubkeyAcceptedKeyTypes +ssh-dss
|
70
|
+
EOS
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'generates a global configuration with user taken from whoami when no env variable is set' do
|
75
|
+
with_test_platform do
|
76
|
+
original_user = ENV['USER']
|
77
|
+
begin
|
78
|
+
ENV.delete 'USER'
|
79
|
+
ENV.delete 'hpc_ssh_user'
|
80
|
+
with_cmd_runner_mocked(
|
81
|
+
[
|
82
|
+
['ssh -V 2>&1', proc { [0, "OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u 20 Dec 2019\n", ''] }],
|
83
|
+
['whoami', proc { [0, 'test_whoami_user', ''] }]
|
84
|
+
]
|
85
|
+
) do
|
86
|
+
expect(ssh_config_for(nil)).to eq <<~EOS
|
87
|
+
Host *
|
88
|
+
User test_whoami_user
|
89
|
+
ControlPath #{Dir.tmpdir}/hpc_ssh/hpc_ssh_mux_%h_%p_%r
|
90
|
+
PubkeyAcceptedKeyTypes +ssh-dss
|
91
|
+
EOS
|
92
|
+
end
|
93
|
+
ensure
|
94
|
+
ENV['USER'] = original_user
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
62
99
|
it 'generates a global configuration with user from setting' do
|
63
100
|
with_test_platform do
|
64
101
|
test_connector.ssh_user = 'test_user'
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
6
6
|
|
7
7
|
it 'executes bash commands remotely' do
|
8
8
|
with_test_platform_for_remote_testing(
|
9
|
-
expected_cmds: [[/.+\/ssh hpc\.node \/bin\/bash <<'
|
9
|
+
expected_cmds: [[/.+\/ssh hpc\.node \/bin\/bash <<'HPC_EOF'\nbash_cmd.bash\nHPC_EOF/, proc { [0, 'Bash commands executed on node', ''] }]],
|
10
10
|
expected_stdout: 'Bash commands executed on node'
|
11
11
|
) do
|
12
12
|
test_connector.remote_bash('bash_cmd.bash')
|
@@ -17,7 +17,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
17
17
|
with_test_platform_for_remote_testing(
|
18
18
|
expected_cmds: [
|
19
19
|
[
|
20
|
-
/.+\/ssh hpc\.node \/bin\/bash <<'
|
20
|
+
/.+\/ssh hpc\.node \/bin\/bash <<'HPC_EOF'\nbash_cmd.bash\nHPC_EOF/,
|
21
21
|
proc do |cmd, log_to_file: nil, log_to_stdout: true, log_stdout_to_io: nil, log_stderr_to_io: nil, expected_code: 0, timeout: nil, no_exception: false|
|
22
22
|
expect(timeout).to eq 5
|
23
23
|
[0, '', '']
|
@@ -76,7 +76,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
76
76
|
[
|
77
77
|
/.+\/hpc_temp_cmds_.+\.sh$/,
|
78
78
|
proc do |received_cmd|
|
79
|
-
expect(File.read(received_cmd)).to match /.+\/ssh hpc\.node \/bin\/bash <<'
|
79
|
+
expect(File.read(received_cmd)).to match /.+\/ssh hpc\.node \/bin\/bash <<'HPC_EOF'\n#{Regexp.escape(cmd)}\nHPC_EOF/
|
80
80
|
[0, 'Bash commands executed on node', '']
|
81
81
|
end
|
82
82
|
]
|
@@ -143,7 +143,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
143
143
|
|
144
144
|
it 'executes bash commands remotely without Session Exec capabilities' do
|
145
145
|
with_test_platform_for_remote_testing(
|
146
|
-
expected_cmds: [[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'
|
146
|
+
expected_cmds: [[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'HPC_EOF'\nbash_cmd.bash\nHPC_EOF$/, proc { [0, 'Bash commands executed on node', ''] }]],
|
147
147
|
expected_stdout: 'Bash commands executed on node',
|
148
148
|
session_exec: false
|
149
149
|
) do
|
@@ -168,12 +168,12 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
168
168
|
it 'copies files remotely without Session Exec capabilities and with sudo' do
|
169
169
|
with_test_platform_for_remote_testing(
|
170
170
|
expected_cmds: [
|
171
|
-
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'
|
171
|
+
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'HPC_EOF'\nmkdir -p hpc_tmp_scp\nHPC_EOF$/, proc { [0, '', ''] }],
|
172
172
|
[
|
173
173
|
/^scp -S .+\/ssh \/path\/to\/src.file hpc\.node:\.\/hpc_tmp_scp$/,
|
174
174
|
proc { [0, '', ''] }
|
175
175
|
],
|
176
|
-
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'
|
176
|
+
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'HPC_EOF'\nsudo -u root mv \.\/hpc_tmp_scp\/src\.file \/remote_path\/to\/dst\.dir\nHPC_EOF$/, proc { [0, '', ''] }]
|
177
177
|
],
|
178
178
|
session_exec: false
|
179
179
|
) do
|
@@ -184,12 +184,12 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
184
184
|
it 'copies files remotely without Session Exec capabilities and with a different sudo' do
|
185
185
|
with_test_platform_for_remote_testing(
|
186
186
|
expected_cmds: [
|
187
|
-
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'
|
187
|
+
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'HPC_EOF'\nmkdir -p hpc_tmp_scp\nHPC_EOF$/, proc { [0, '', ''] }],
|
188
188
|
[
|
189
189
|
/^scp -S .+\/ssh \/path\/to\/src.file hpc\.node:\.\/hpc_tmp_scp$/,
|
190
190
|
proc { [0, '', ''] }
|
191
191
|
],
|
192
|
-
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'
|
192
|
+
[/^\{ cat \| .+\/ssh hpc\.node -T; } <<'HPC_EOF'\nother_sudo --user root mv \.\/hpc_tmp_scp\/src\.file \/remote_path\/to\/dst\.dir\nHPC_EOF$/, proc { [0, '', ''] }]
|
193
193
|
],
|
194
194
|
additional_config: 'sudo_for { |user| "other_sudo --user #{user}" }',
|
195
195
|
session_exec: false
|
@@ -0,0 +1,10 @@
|
|
1
|
+
describe 'Documentation' do
|
2
|
+
|
3
|
+
it 'makes sure all Markdown links are valid' do
|
4
|
+
check_stdout = `bundle exec tools/check_md README.md #{Dir.glob('docs/**/*.md').join(' ')}`.split("\n")
|
5
|
+
summary_idx = check_stdout.index { |line| line =~ /^\d+ errors:$/ }
|
6
|
+
expect(summary_idx).not_to eq(nil), "Could not parse check output: #{check_stdout.join("\n")}"
|
7
|
+
expect(check_stdout[summary_idx]).to eq('0 errors:'), "Invalid links found: #{check_stdout[summary_idx..-1].join("\n")}"
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
data/tools/check_md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Parsed information, per file name.
|
4
|
+
# Information is:
|
5
|
+
# * *anchors* (Array<String>): List of anchors
|
6
|
+
# * *links* (Array<String>): List of links
|
7
|
+
@info = {}
|
8
|
+
|
9
|
+
# Get a file name from a link
|
10
|
+
#
|
11
|
+
# Parameters::
|
12
|
+
# * *link* (String): The link to find the file from
|
13
|
+
# * *file* (String): The file from which the link is taken
|
14
|
+
# Result::
|
15
|
+
# * String: Resulting file
|
16
|
+
def link_to_file(link, file)
|
17
|
+
link_file = link.split('#').first
|
18
|
+
if link_file == ''
|
19
|
+
file
|
20
|
+
elsif link_file.start_with?('/')
|
21
|
+
link_file[1..-1]
|
22
|
+
else
|
23
|
+
File.expand_path("#{File.dirname(file)}/#{link_file}").gsub("#{Dir.pwd}/", '')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Parse a Markdown file
|
28
|
+
#
|
29
|
+
# Parameters::
|
30
|
+
# * *file* (String): Markdown file to be parsed
|
31
|
+
def parse_md(file)
|
32
|
+
unless @info.key?(file)
|
33
|
+
puts "Parsing #{file}..."
|
34
|
+
content = File.read(file)
|
35
|
+
@info[file] = {
|
36
|
+
anchors: content.scan(/<a name="([^"]*)"><\/a>/).map { |(anchor)| anchor },
|
37
|
+
links: content.scan(/\[[^\]]*\]\(([^\)]*)\)/).map { |(link)| link }
|
38
|
+
}
|
39
|
+
# Parse linked files
|
40
|
+
@info[file][:links].each do |link|
|
41
|
+
puts "Found #{file} => #{link}"
|
42
|
+
end
|
43
|
+
@info[file][:links].each do |link|
|
44
|
+
unless link.start_with?('http')
|
45
|
+
linked_file = link_to_file(link, file)
|
46
|
+
parse_md(linked_file) if File.exist?(linked_file) && linked_file.end_with?('.md')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
ARGV.each { |file| parse_md(file) }
|
53
|
+
|
54
|
+
# Check links
|
55
|
+
errors = []
|
56
|
+
@info.sort_by { |file, _info| file }.each do |file, info|
|
57
|
+
puts "= Links from #{file}"
|
58
|
+
info[:links].sort.uniq.each do |link|
|
59
|
+
puts "[#{
|
60
|
+
if link.start_with?('http')
|
61
|
+
'*'
|
62
|
+
else
|
63
|
+
anchor = link.split('#')[1]
|
64
|
+
linked_file = link_to_file(link, file)
|
65
|
+
if @info.key?(linked_file)
|
66
|
+
if anchor.nil?
|
67
|
+
'*'
|
68
|
+
elsif @info[linked_file][:anchors].include?(anchor)
|
69
|
+
'*'
|
70
|
+
else
|
71
|
+
errors << "[#{file} -> #{link}] - Destination has no anchor named #{anchor}"
|
72
|
+
' '
|
73
|
+
end
|
74
|
+
elsif File.exist?(linked_file)
|
75
|
+
'*'
|
76
|
+
else
|
77
|
+
errors << "[#{file} -> #{link}] - Destination file does not exist"
|
78
|
+
' '
|
79
|
+
end
|
80
|
+
end
|
81
|
+
}] #{link}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
puts
|
86
|
+
puts "#{errors.size} errors:"
|
87
|
+
errors.each do |error|
|
88
|
+
puts error
|
89
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
MARKER_BEGIN = '<!-- Mermaid generator - Section start -->'
|
7
|
+
MARKER_END = '<!-- Mermaid generator - Section end -->'
|
8
|
+
|
9
|
+
# Generate Mermaid diagrams from a Markdown file.
|
10
|
+
# Modify the Markdown file if the Mermaid diagram is to be referenced for the first time.
|
11
|
+
#
|
12
|
+
# Parameters::
|
13
|
+
# * *file* (String): Markdown file to be parsed
|
14
|
+
def gen_mermaid(file)
|
15
|
+
markdown = []
|
16
|
+
mermaid_content = nil
|
17
|
+
in_markers = false
|
18
|
+
idx_mermaid = 0
|
19
|
+
File.read(file).split("\n").each do |line|
|
20
|
+
# Logic is simple: Mermaid code blocks should be encapsulated between comment markers that will also include the generated diagram and the details setion.
|
21
|
+
# We always regenerate the content between existing comment markers.
|
22
|
+
# If those comment markers are missing, we will find Mermaid code blocks to add them.
|
23
|
+
# We always re-generate all diagrams.
|
24
|
+
if line == MARKER_BEGIN
|
25
|
+
in_markers = true
|
26
|
+
elsif line == MARKER_END
|
27
|
+
in_markers = false
|
28
|
+
elsif line == '```mermaid'
|
29
|
+
mermaid_content = []
|
30
|
+
elsif line == '```'
|
31
|
+
# End any block, including Mermaid block
|
32
|
+
if mermaid_content.nil?
|
33
|
+
markdown << line
|
34
|
+
else
|
35
|
+
# We have a diagram to generate
|
36
|
+
gen_file = "docs/gen/mermaid/#{file}-#{idx_mermaid}.png"
|
37
|
+
puts "Generate #{file} / Diagram ##{idx_mermaid} => #{gen_file}..."
|
38
|
+
FileUtils.mkdir_p File.dirname(gen_file)
|
39
|
+
Tempfile.create('mermaid') do |mermaid_file|
|
40
|
+
mermaid_file.write(mermaid_content.join("\n"))
|
41
|
+
mermaid_file.flush
|
42
|
+
mmdc_cmd = "./node_modules/.bin/mmdc -p #{@puppeteer_conf} -i #{mermaid_file.path} -o #{gen_file} -w 2048"
|
43
|
+
raise "Error while running mmdc: #{mmdc_cmd}" unless system mmdc_cmd
|
44
|
+
end
|
45
|
+
markdown.concat [
|
46
|
+
MARKER_BEGIN,
|
47
|
+
"![Mermaid diagram](/#{gen_file})",
|
48
|
+
'<details>',
|
49
|
+
'<summary>See diagram Mermaid code</summary>',
|
50
|
+
'',
|
51
|
+
'```mermaid'
|
52
|
+
] + mermaid_content + [
|
53
|
+
'```',
|
54
|
+
'</details>',
|
55
|
+
MARKER_END
|
56
|
+
]
|
57
|
+
idx_mermaid += 1
|
58
|
+
mermaid_content = nil
|
59
|
+
end
|
60
|
+
elsif !mermaid_content.nil?
|
61
|
+
# We are in a Mermaid content
|
62
|
+
mermaid_content << line
|
63
|
+
elsif !in_markers
|
64
|
+
markdown << line
|
65
|
+
end
|
66
|
+
end
|
67
|
+
File.write(file, markdown.map { |line| "#{line}\n" }.join) if idx_mermaid > 0
|
68
|
+
end
|
69
|
+
|
70
|
+
Tempfile.create('puppeteer') do |puppeteer_file|
|
71
|
+
puppeteer_file.write({ args: ['--no-sandbox'] }.to_json)
|
72
|
+
puppeteer_file.flush
|
73
|
+
@puppeteer_conf = puppeteer_file.path
|
74
|
+
ARGV.each { |file| gen_mermaid(file) }
|
75
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hybrid_platforms_conductor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 32.
|
4
|
+
version: 32.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muriel Salvan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: range_operators
|
@@ -281,23 +281,120 @@ description: Provides a complete toolset to help DevOps maintain, deploy, monito
|
|
281
281
|
email:
|
282
282
|
- muriel@x-aeon.com
|
283
283
|
executables:
|
284
|
-
- run
|
285
|
-
- get_impacted_nodes
|
286
284
|
- dump_nodes_json
|
287
|
-
-
|
288
|
-
-
|
285
|
+
- get_impacted_nodes
|
286
|
+
- topograph
|
287
|
+
- run
|
289
288
|
- free_veids
|
289
|
+
- nodes_to_deploy
|
290
|
+
- setup
|
290
291
|
- free_ips
|
291
|
-
-
|
292
|
-
- deploy
|
292
|
+
- check-node
|
293
293
|
- report
|
294
|
-
-
|
295
|
-
- setup
|
294
|
+
- test
|
296
295
|
- last_deploys
|
297
296
|
- ssh_config
|
297
|
+
- deploy
|
298
298
|
extensions: []
|
299
|
-
extra_rdoc_files:
|
299
|
+
extra_rdoc_files:
|
300
|
+
- CHANGELOG.md
|
301
|
+
- LICENSE.md
|
302
|
+
- README.md
|
303
|
+
- docs/plugins.md
|
304
|
+
- docs/plugins/provisioner/podman.md
|
305
|
+
- docs/plugins/provisioner/docker.md
|
306
|
+
- docs/plugins/provisioner/proxmox.md
|
307
|
+
- docs/plugins/connector/local.md
|
308
|
+
- docs/plugins/connector/ssh.md
|
309
|
+
- docs/plugins/action/scp.md
|
310
|
+
- docs/plugins/action/interactive.md
|
311
|
+
- docs/plugins/action/bash.md
|
312
|
+
- docs/plugins/action/remote_bash.md
|
313
|
+
- docs/plugins/action/ruby.md
|
314
|
+
- docs/plugins/report/stdout.md
|
315
|
+
- docs/plugins/report/confluence.md
|
316
|
+
- docs/plugins/report/mediawiki.md
|
317
|
+
- docs/plugins/cmdb/host_ip.md
|
318
|
+
- docs/plugins/cmdb/platform_handlers.md
|
319
|
+
- docs/plugins/cmdb/config.md
|
320
|
+
- docs/plugins/cmdb/host_keys.md
|
321
|
+
- docs/plugins/test/veids.md
|
322
|
+
- docs/plugins/test/idempotence.md
|
323
|
+
- docs/plugins/test/jenkins_ci_conf.md
|
324
|
+
- docs/plugins/test/check_deploy_and_idempotence.md
|
325
|
+
- docs/plugins/test/divergence.md
|
326
|
+
- docs/plugins/test/check_from_scratch.md
|
327
|
+
- docs/plugins/test/bitbucket_conf.md
|
328
|
+
- docs/plugins/test/public_ips.md
|
329
|
+
- docs/plugins/test/deploy_freshness.md
|
330
|
+
- docs/plugins/test/private_ips.md
|
331
|
+
- docs/plugins/test/connection.md
|
332
|
+
- docs/plugins/test/orphan_files.md
|
333
|
+
- docs/plugins/test/ports.md
|
334
|
+
- docs/plugins/test/file_system_hdfs.md
|
335
|
+
- docs/plugins/test/jenkins_ci_masters_ok.md
|
336
|
+
- docs/plugins/test/can_be_checked.md
|
337
|
+
- docs/plugins/test/local_users.md
|
338
|
+
- docs/plugins/test/executables.md
|
339
|
+
- docs/plugins/test/spectre.md
|
340
|
+
- docs/plugins/test/deploy_removes_root_access.md
|
341
|
+
- docs/plugins/test/deploy_from_scratch.md
|
342
|
+
- docs/plugins/test/file_system.md
|
343
|
+
- docs/plugins/test/mounts.md
|
344
|
+
- docs/plugins/test/ip.md
|
345
|
+
- docs/plugins/test/vulnerabilities.md
|
346
|
+
- docs/plugins/test/hostname.md
|
347
|
+
- docs/plugins/test/linear_strategy.md
|
348
|
+
- docs/plugins/platform_handler/yaml_inventory.md
|
349
|
+
- docs/plugins/test_report/stdout.md
|
350
|
+
- docs/plugins/test_report/confluence.md
|
351
|
+
- docs/install.md
|
352
|
+
- docs/plugins_create.md
|
353
|
+
- docs/executables/topograph.md
|
354
|
+
- docs/executables/report.md
|
355
|
+
- docs/executables/free_ips.md
|
356
|
+
- docs/executables/free_veids.md
|
357
|
+
- docs/executables/last_deploys.md
|
358
|
+
- docs/executables/check-node.md
|
359
|
+
- docs/executables/nodes_to_deploy.md
|
360
|
+
- docs/executables/run.md
|
361
|
+
- docs/executables/deploy.md
|
362
|
+
- docs/executables/setup.md
|
363
|
+
- docs/executables/dump_nodes_json.md
|
364
|
+
- docs/executables/ssh_config.md
|
365
|
+
- docs/executables/get_impacted_nodes.md
|
366
|
+
- docs/executables/test.md
|
367
|
+
- docs/executables.md
|
368
|
+
- docs/gen/mermaid/README.md-0.png
|
369
|
+
- docs/gen/mermaid/docs/executables/last_deploys.md-0.png
|
370
|
+
- docs/gen/mermaid/docs/executables/check-node.md-0.png
|
371
|
+
- docs/gen/mermaid/docs/executables/deploy.md-0.png
|
372
|
+
- docs/gen/mermaid/docs/executables/free_ips.md-0.png
|
373
|
+
- docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png
|
374
|
+
- docs/gen/mermaid/docs/executables/setup.md-0.png
|
375
|
+
- docs/gen/mermaid/docs/executables/test.md-0.png
|
376
|
+
- docs/gen/mermaid/docs/executables/run.md-0.png
|
377
|
+
- docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png
|
378
|
+
- docs/gen/mermaid/docs/executables/report.md-0.png
|
379
|
+
- docs/gen/mermaid/docs/executables/free_veids.md-0.png
|
380
|
+
- docs/gen/mermaid/docs/executables/ssh_config.md-0.png
|
381
|
+
- docs/api.md
|
382
|
+
- docs/tutorial/05_extend_with_plugins.md
|
383
|
+
- docs/tutorial/01_installation.md
|
384
|
+
- docs/tutorial/04_test.md
|
385
|
+
- docs/tutorial/03_scale.md
|
386
|
+
- docs/tutorial/02_first_node.md
|
387
|
+
- docs/config_dsl.md
|
388
|
+
- docs/tutorial.md
|
389
|
+
- examples/localhost/Gemfile
|
390
|
+
- examples/localhost/hpc_config.rb
|
391
|
+
- examples/localhost/inventory.yaml
|
392
|
+
- examples/bare/Gemfile
|
393
|
+
- examples/bare/hpc_config.rb
|
300
394
|
files:
|
395
|
+
- CHANGELOG.md
|
396
|
+
- LICENSE.md
|
397
|
+
- README.md
|
301
398
|
- bin/check-node
|
302
399
|
- bin/deploy
|
303
400
|
- bin/dump_nodes_json
|
@@ -312,6 +409,97 @@ files:
|
|
312
409
|
- bin/ssh_config
|
313
410
|
- bin/test
|
314
411
|
- bin/topograph
|
412
|
+
- docs/api.md
|
413
|
+
- docs/config_dsl.md
|
414
|
+
- docs/executables.md
|
415
|
+
- docs/executables/check-node.md
|
416
|
+
- docs/executables/deploy.md
|
417
|
+
- docs/executables/dump_nodes_json.md
|
418
|
+
- docs/executables/free_ips.md
|
419
|
+
- docs/executables/free_veids.md
|
420
|
+
- docs/executables/get_impacted_nodes.md
|
421
|
+
- docs/executables/last_deploys.md
|
422
|
+
- docs/executables/nodes_to_deploy.md
|
423
|
+
- docs/executables/report.md
|
424
|
+
- docs/executables/run.md
|
425
|
+
- docs/executables/setup.md
|
426
|
+
- docs/executables/ssh_config.md
|
427
|
+
- docs/executables/test.md
|
428
|
+
- docs/executables/topograph.md
|
429
|
+
- docs/gen/mermaid/README.md-0.png
|
430
|
+
- docs/gen/mermaid/docs/executables/check-node.md-0.png
|
431
|
+
- docs/gen/mermaid/docs/executables/deploy.md-0.png
|
432
|
+
- docs/gen/mermaid/docs/executables/free_ips.md-0.png
|
433
|
+
- docs/gen/mermaid/docs/executables/free_veids.md-0.png
|
434
|
+
- docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png
|
435
|
+
- docs/gen/mermaid/docs/executables/last_deploys.md-0.png
|
436
|
+
- docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png
|
437
|
+
- docs/gen/mermaid/docs/executables/report.md-0.png
|
438
|
+
- docs/gen/mermaid/docs/executables/run.md-0.png
|
439
|
+
- docs/gen/mermaid/docs/executables/setup.md-0.png
|
440
|
+
- docs/gen/mermaid/docs/executables/ssh_config.md-0.png
|
441
|
+
- docs/gen/mermaid/docs/executables/test.md-0.png
|
442
|
+
- docs/install.md
|
443
|
+
- docs/plugins.md
|
444
|
+
- docs/plugins/action/bash.md
|
445
|
+
- docs/plugins/action/interactive.md
|
446
|
+
- docs/plugins/action/remote_bash.md
|
447
|
+
- docs/plugins/action/ruby.md
|
448
|
+
- docs/plugins/action/scp.md
|
449
|
+
- docs/plugins/cmdb/config.md
|
450
|
+
- docs/plugins/cmdb/host_ip.md
|
451
|
+
- docs/plugins/cmdb/host_keys.md
|
452
|
+
- docs/plugins/cmdb/platform_handlers.md
|
453
|
+
- docs/plugins/connector/local.md
|
454
|
+
- docs/plugins/connector/ssh.md
|
455
|
+
- docs/plugins/platform_handler/yaml_inventory.md
|
456
|
+
- docs/plugins/provisioner/docker.md
|
457
|
+
- docs/plugins/provisioner/podman.md
|
458
|
+
- docs/plugins/provisioner/proxmox.md
|
459
|
+
- docs/plugins/report/confluence.md
|
460
|
+
- docs/plugins/report/mediawiki.md
|
461
|
+
- docs/plugins/report/stdout.md
|
462
|
+
- docs/plugins/test/bitbucket_conf.md
|
463
|
+
- docs/plugins/test/can_be_checked.md
|
464
|
+
- docs/plugins/test/check_deploy_and_idempotence.md
|
465
|
+
- docs/plugins/test/check_from_scratch.md
|
466
|
+
- docs/plugins/test/connection.md
|
467
|
+
- docs/plugins/test/deploy_freshness.md
|
468
|
+
- docs/plugins/test/deploy_from_scratch.md
|
469
|
+
- docs/plugins/test/deploy_removes_root_access.md
|
470
|
+
- docs/plugins/test/divergence.md
|
471
|
+
- docs/plugins/test/executables.md
|
472
|
+
- docs/plugins/test/file_system.md
|
473
|
+
- docs/plugins/test/file_system_hdfs.md
|
474
|
+
- docs/plugins/test/hostname.md
|
475
|
+
- docs/plugins/test/idempotence.md
|
476
|
+
- docs/plugins/test/ip.md
|
477
|
+
- docs/plugins/test/jenkins_ci_conf.md
|
478
|
+
- docs/plugins/test/jenkins_ci_masters_ok.md
|
479
|
+
- docs/plugins/test/linear_strategy.md
|
480
|
+
- docs/plugins/test/local_users.md
|
481
|
+
- docs/plugins/test/mounts.md
|
482
|
+
- docs/plugins/test/orphan_files.md
|
483
|
+
- docs/plugins/test/ports.md
|
484
|
+
- docs/plugins/test/private_ips.md
|
485
|
+
- docs/plugins/test/public_ips.md
|
486
|
+
- docs/plugins/test/spectre.md
|
487
|
+
- docs/plugins/test/veids.md
|
488
|
+
- docs/plugins/test/vulnerabilities.md
|
489
|
+
- docs/plugins/test_report/confluence.md
|
490
|
+
- docs/plugins/test_report/stdout.md
|
491
|
+
- docs/plugins_create.md
|
492
|
+
- docs/tutorial.md
|
493
|
+
- docs/tutorial/01_installation.md
|
494
|
+
- docs/tutorial/02_first_node.md
|
495
|
+
- docs/tutorial/03_scale.md
|
496
|
+
- docs/tutorial/04_test.md
|
497
|
+
- docs/tutorial/05_extend_with_plugins.md
|
498
|
+
- examples/bare/Gemfile
|
499
|
+
- examples/bare/hpc_config.rb
|
500
|
+
- examples/localhost/Gemfile
|
501
|
+
- examples/localhost/hpc_config.rb
|
502
|
+
- examples/localhost/inventory.yaml
|
315
503
|
- lib/hybrid_platforms_conductor/action.rb
|
316
504
|
- lib/hybrid_platforms_conductor/actions_executor.rb
|
317
505
|
- lib/hybrid_platforms_conductor/bitbucket.rb
|
@@ -339,9 +527,11 @@ files:
|
|
339
527
|
- lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb
|
340
528
|
- lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample
|
341
529
|
- lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb
|
530
|
+
- lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb
|
342
531
|
- lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample
|
343
532
|
- lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb
|
344
533
|
- lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample
|
534
|
+
- lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb
|
345
535
|
- lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb
|
346
536
|
- lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample
|
347
537
|
- lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb
|
@@ -422,6 +612,8 @@ files:
|
|
422
612
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb
|
423
613
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb
|
424
614
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb
|
615
|
+
- spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb
|
616
|
+
- spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb
|
425
617
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb
|
426
618
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb
|
427
619
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb
|
@@ -491,6 +683,7 @@ files:
|
|
491
683
|
- spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb
|
492
684
|
- spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb
|
493
685
|
- spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb
|
686
|
+
- spec/hybrid_platforms_conductor_test/docs_spec.rb
|
494
687
|
- spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb
|
495
688
|
- spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb
|
496
689
|
- spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb
|
@@ -542,6 +735,8 @@ files:
|
|
542
735
|
- spec/hybrid_platforms_conductor_test/test_provisioner.rb
|
543
736
|
- spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
|
544
737
|
- spec/spec_helper.rb
|
738
|
+
- tools/check_md
|
739
|
+
- tools/generate_mermaid
|
545
740
|
homepage:
|
546
741
|
licenses:
|
547
742
|
- BSD-3-Clause
|
@@ -561,7 +756,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
561
756
|
- !ruby/object:Gem::Version
|
562
757
|
version: '0'
|
563
758
|
requirements: []
|
564
|
-
rubygems_version: 3.1.
|
759
|
+
rubygems_version: 3.1.6
|
565
760
|
signing_key:
|
566
761
|
specification_version: 4
|
567
762
|
summary: Hybrid Platforms Conductor
|