hybrid_platforms_conductor 32.3.6

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.
Files changed (244) hide show
  1. checksums.yaml +7 -0
  2. data/bin/check-node +24 -0
  3. data/bin/deploy +12 -0
  4. data/bin/dump_nodes_json +12 -0
  5. data/bin/free_ips +23 -0
  6. data/bin/free_veids +17 -0
  7. data/bin/get_impacted_nodes +43 -0
  8. data/bin/last_deploys +56 -0
  9. data/bin/nodes_to_deploy +104 -0
  10. data/bin/report +10 -0
  11. data/bin/run +39 -0
  12. data/bin/setup +11 -0
  13. data/bin/ssh_config +14 -0
  14. data/bin/test +13 -0
  15. data/bin/topograph +54 -0
  16. data/lib/hybrid_platforms_conductor/action.rb +82 -0
  17. data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
  18. data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
  19. data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
  20. data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
  21. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
  22. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
  23. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
  24. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
  25. data/lib/hybrid_platforms_conductor/config.rb +263 -0
  26. data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
  27. data/lib/hybrid_platforms_conductor/connector.rb +84 -0
  28. data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
  29. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
  30. data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
  31. data/lib/hybrid_platforms_conductor/executable.rb +145 -0
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
  74. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
  75. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
  76. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
  77. data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
  78. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
  79. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
  80. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
  81. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
  82. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
  83. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
  84. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
  85. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
  86. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
  87. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
  88. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
  89. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
  90. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
  91. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
  92. data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
  93. data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
  94. data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
  95. data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
  96. data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
  97. data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
  98. data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
  99. data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
  100. data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
  101. data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
  102. data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
  103. data/lib/hybrid_platforms_conductor/report.rb +31 -0
  104. data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
  105. data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
  106. data/lib/hybrid_platforms_conductor/test.rb +141 -0
  107. data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
  108. data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
  109. data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
  110. data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
  111. data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
  112. data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
  113. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
  114. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
  115. data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
  116. data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
  117. data/lib/hybrid_platforms_conductor/version.rb +5 -0
  118. data/spec/hybrid_platforms_conductor_test.rb +159 -0
  119. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
  120. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
  121. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
  122. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
  123. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
  124. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
  125. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
  126. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
  127. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
  128. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
  129. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
  130. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
  131. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
  132. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
  133. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
  134. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
  135. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
  136. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
  137. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
  138. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
  139. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
  140. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
  141. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
  142. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
  143. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
  144. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
  145. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
  146. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
  147. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
  148. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
  149. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
  150. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
  151. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
  152. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
  153. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
  154. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
  155. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
  156. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
  157. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
  158. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
  159. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
  160. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
  161. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
  162. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
  163. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
  164. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
  165. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
  166. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
  167. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
  168. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
  169. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
  170. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
  171. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
  172. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
  173. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
  174. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
  175. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
  176. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
  177. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
  178. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
  179. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
  180. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
  181. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
  182. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
  183. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
  184. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
  185. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
  186. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
  187. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
  188. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
  189. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
  190. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
  191. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
  192. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
  193. data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
  194. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
  195. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
  196. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
  197. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
  198. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
  199. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
  200. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
  201. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
  202. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
  203. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
  204. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
  205. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
  206. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
  207. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
  208. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
  209. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
  210. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
  211. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
  212. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
  213. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
  214. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
  215. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
  216. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
  217. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
  218. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
  219. data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
  220. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
  221. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
  222. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
  223. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
  224. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
  225. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
  226. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
  227. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
  228. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
  229. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
  230. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
  231. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
  232. data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
  233. data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
  234. data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
  235. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
  236. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
  237. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
  238. data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
  239. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
  240. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
  241. data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
  242. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
  243. data/spec/spec_helper.rb +111 -0
  244. metadata +566 -0
@@ -0,0 +1,33 @@
1
+ <ac:structured-macro ac:name="toc" ac:schema-version="1"/>
2
+ <table>
3
+ <tbody>
4
+ <tr>
5
+ <th>Node</th>
6
+ <th>Platform</th>
7
+ <th>Host name</th>
8
+ <th>IP</th>
9
+ <th>Physical?</th>
10
+ <th>OS</th>
11
+ <th>Description</th>
12
+ <th>Services</th>
13
+ </tr>
14
+ <% @nodes_handler.prefetch_metadata_of @nodes, %i[hostname host_ip physical image description services] %>
15
+ <% @nodes.sort.each do |node| %>
16
+ <tr style="vertical-align: middle;">
17
+ <td><strong><%= node %></strong></td>
18
+ <td><%= @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name %></td>
19
+ <td><%= @nodes_handler.get_hostname_of(node) %></td>
20
+ <td><%= @nodes_handler.get_host_ip_of(node) %></td>
21
+ <td><%= @nodes_handler.get_physical_of(node) ? 'Yes' : 'No' %></td>
22
+ <td><%= @nodes_handler.get_image_of node %></td>
23
+ <td><%= @nodes_handler.get_description_of node %></td>
24
+ <td><%= (@nodes_handler.get_services_of(node) || []).sort.join(', ') %></td>
25
+ </tr>
26
+ <% end %>
27
+ </tbody>
28
+ </table>
29
+ <p>
30
+ <br/>
31
+ Generated at <%= Time.now.utc.strftime('%F %T') %> UTC by <a href="https://www.site.my_company.net/git/projects/PROJECTrepos/hybrid_platforms_conductor/browse">Hybrid Platforms Conductor</a>.
32
+ <br/>
33
+ </p>
@@ -0,0 +1,137 @@
1
+ require 'git'
2
+ require 'hybrid_platforms_conductor/common_config_dsl/bitbucket'
3
+
4
+ module HybridPlatformsConductor
5
+
6
+ module HpcPlugins
7
+
8
+ module Test
9
+
10
+ # Check that all repositories in Bitbucket have a consistent dev workflow.
11
+ class BitbucketConf < HybridPlatformsConductor::Test
12
+
13
+ self.extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
14
+
15
+ # Check my_test_plugin.rb.sample documentation for signature details.
16
+ def test
17
+ @config.for_each_bitbucket_repo do |bitbucket, repo_info|
18
+ # Test repo_info
19
+ repo_id = "#{repo_info[:project]}/#{repo_info[:name]}"
20
+ settings_pr = bitbucket.settings_pr(repo_info[:project], repo_info[:name])
21
+ default_reviewers = bitbucket.default_reviewers(repo_info[:project], repo_info[:name])
22
+ # There can be a post Webhook to Jenkins CI
23
+ # TODO: Find a way to query the Post Webhook plugin API
24
+ # Branch permissions
25
+ if repo_info[:checks][:branch_permissions]
26
+ branch_permissions = bitbucket.branch_permissions(repo_info[:project], repo_info[:name])
27
+ repo_info[:checks][:branch_permissions].each do |branch_permissions_to_check|
28
+ exempted_users = branch_permissions_to_check[:exempted_users] || []
29
+ exempted_groups = branch_permissions_to_check[:exempted_groups] || []
30
+ exempted_keys = branch_permissions_to_check[:exempted_keys] || []
31
+ message = "[#{repo_id}] - Branch permissions for #{branch_permissions_to_check[:branch]} should prohibit \"#{
32
+ case branch_permissions_to_check[:type]
33
+ when 'fast-forward-only'
34
+ 'Rewriting history'
35
+ when 'no-deletes'
36
+ 'Deletion'
37
+ when 'pull-request-only'
38
+ 'Changes without a pull request'
39
+ else
40
+ log_warn "Unknown branch permission type #{branch_permissions_to_check[:type]} - Please adapt this test plugin's code."
41
+ branch_permissions_to_check[:type]
42
+ end
43
+ }\""
44
+ exceptions = []
45
+ exceptions << "users #{exempted_users.join(', ')}" unless exempted_users.empty?
46
+ exceptions << "groups #{exempted_groups.join(', ')}" unless exempted_groups.empty?
47
+ exceptions << "keys #{exempted_keys.join(', ')}" unless exempted_keys.empty?
48
+ message << " except for #{exceptions.join(' and ')}" unless exceptions.empty?
49
+ assert_equal(
50
+ branch_permissions['values'].any? do |branch_permission_info|
51
+ branch_permission_info['type'] == branch_permissions_to_check[:type] &&
52
+ branch_permission_info['matcher']['id'] == "refs/heads/#{branch_permissions_to_check[:branch]}" &&
53
+ branch_permission_info['users'].map { |user_info| user_info['name'] }.sort == exempted_users.sort &&
54
+ branch_permission_info['groups'].sort == exempted_groups.sort &&
55
+ branch_permission_info['accessKeys'].sort == exempted_keys.sort
56
+ end,
57
+ true,
58
+ message
59
+ )
60
+ end
61
+ end
62
+ # Merge checks
63
+ required_approvers = repo_info.dig *%i[checks pr_settings required_approvers]
64
+ if required_approvers
65
+ assert_equal(
66
+ settings_pr.dig('com.atlassian.bitbucket.server.bitbucket-bundled-hooks:requiredApprovers', 'enable'),
67
+ true,
68
+ "[#{repo_id}] - Required approvers should be enabled"
69
+ )
70
+ assert_equal(
71
+ settings_pr.dig('com.atlassian.bitbucket.server.bitbucket-bundled-hooks:requiredApprovers', 'count'),
72
+ required_approvers,
73
+ "[#{repo_id}] - Number of required approvers should be #{required_approvers}"
74
+ )
75
+ end
76
+ required_builds = repo_info.dig *%i[checks pr_settings required_builds]
77
+ if required_builds
78
+ assert_equal(
79
+ settings_pr.dig('com.atlassian.bitbucket.server.bitbucket-build:requiredBuilds', 'enable'),
80
+ true,
81
+ "[#{repo_id}] - Required builds should be enabled"
82
+ )
83
+ assert_equal(
84
+ settings_pr.dig('com.atlassian.bitbucket.server.bitbucket-build:requiredBuilds', 'count'),
85
+ required_builds,
86
+ "[#{repo_id}] - Number of required builds should be #{required_builds}"
87
+ )
88
+ end
89
+ # Default merge strategy
90
+ default_merge_strategy = repo_info.dig *%i[checks pr_settings default_merge_strategy]
91
+ if default_merge_strategy
92
+ assert_equal(
93
+ settings_pr.dig('mergeConfig', 'defaultStrategy', 'id'),
94
+ default_merge_strategy,
95
+ "[#{repo_id}] - Default merge strategy should be #{
96
+ case default_merge_strategy
97
+ when 'rebase-no-ff'
98
+ 'Rebase + Merge --no-ff'
99
+ else
100
+ log_warn "Unknown merge strategy #{default_merge_strategy} - Please adapt this test plugin's code."
101
+ default_merge_strategy
102
+ end
103
+ }"
104
+ )
105
+ end
106
+ # Default reviewers should include our team from any branch to any branch
107
+ mandatory_default_reviewers = repo_info.dig *%i[checks pr_settings mandatory_default_reviewers]
108
+ if mandatory_default_reviewers
109
+ reviewers_found = default_reviewers.any? do |condition_info|
110
+ reviewers = condition_info.dig('reviewers')
111
+ condition_info.dig('sourceRefMatcher', 'id') == 'ANY_REF_MATCHER_ID' &&
112
+ condition_info.dig('targetRefMatcher', 'id') == 'ANY_REF_MATCHER_ID' &&
113
+ !reviewers.nil? &&
114
+ (mandatory_default_reviewers - reviewers.map { |reviewer_info| reviewer_info['name'] }).empty? &&
115
+ (required_approvers.nil? || condition_info.dig('requiredApprovals') == required_approvers)
116
+ end
117
+ assert_equal(
118
+ reviewers_found,
119
+ true,
120
+ "[#{repo_id}] - Missing mandatory reviewers among #{mandatory_default_reviewers.join(', ')}#{required_approvers.nil? ? '' : " with a minimum of #{required_approvers} approvals"} from any branch to any branch"
121
+ )
122
+ end
123
+ # Make sure the repository has master being tagged correctly
124
+ log_debug "Check that master branch of #{repo_info[:url]} has a semantic tag"
125
+ refs_info = Git.ls_remote(repo_info[:url])
126
+ master_sha = refs_info['branches']['master'][:sha]
127
+ error "[#{repo_id}] - No semantic tag found on master branch (#{repo_info[:url]} ref #{master_sha})" unless refs_info['tags'].any? { |tag_name, tag_info| tag_info[:sha] == master_sha && tag_name =~ /^v\d+\.\d+\.\d+$/ }
128
+ end
129
+ end
130
+
131
+ end
132
+
133
+ end
134
+
135
+ end
136
+
137
+ end
@@ -0,0 +1,21 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Test that the node can be checked without error
8
+ class CanBeChecked < HybridPlatformsConductor::Test
9
+
10
+ # Check my_test_plugin.rb.sample documentation for signature details.
11
+ def test_on_check_node(stdout, stderr, exit_status)
12
+ assert_equal exit_status, 0, "Check-node run returned error #{exit_status}#{log_debug? ? ":\n===== STDOUT =====\n#{stdout}===== STDERR =====#{stderr}" : ''}"
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,112 @@
1
+ require 'json'
2
+ require 'hybrid_platforms_conductor/common_config_dsl/idempotence_tests'
3
+ require 'hybrid_platforms_conductor/test_by_service'
4
+
5
+ module HybridPlatformsConductor
6
+
7
+ module HpcPlugins
8
+
9
+ module Test
10
+
11
+ # Test that combines the following tests in just 1 test to avoid spawning several Docker containers:
12
+ # * check_from_scratch
13
+ # * deploy_from_scratch
14
+ # * deploy_removes_root_access
15
+ # * idempotence
16
+ # Especially useful if your tests run in an environment having limited Docker resources.
17
+ # This tests uses the testadmin user access once deployed.
18
+ # Don't forget to add the testadmin private key in your SSH agent if you run this test locally.
19
+ class CheckDeployAndIdempotence < TestByService
20
+
21
+ self.extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
22
+
23
+ # Check my_test_plugin.rb.sample documentation for signature details.
24
+ def test_for_node
25
+ @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'check_deploy_and_idempotence', reuse_instance: log_debug?) do |deployer, instance|
26
+ # Check that we can connect with root
27
+ ssh_ok = false
28
+ begin
29
+ Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
30
+ ssh_ok = ssh.exec!('echo Works').strip == 'Works'
31
+ end
32
+ rescue
33
+ end
34
+ assert_equal ssh_ok, true, 'Root does not have access from the empty image'
35
+
36
+ if ssh_ok
37
+
38
+ # ===== Check from scratch
39
+ deployer.use_why_run = true
40
+ exit_status, _stdout, _stderr = deployer.deploy_on(@node)[@node]
41
+ assert_equal exit_status, 0, "Check-node from scratch returned error code #{exit_status}", log_debug? ? nil : deployer.stdouts_to_s
42
+ # Even if the check has failed, we try to deploy it
43
+
44
+ # ===== Deploy from scratch
45
+ deployer.use_why_run = false
46
+ deployer.nbr_retries_on_error = 3
47
+ exit_status, _stdout, _stderr = deployer.deploy_on(@node)[@node]
48
+ assert_equal exit_status, 0, "Deploy from scratch returned error code #{exit_status}", log_debug? ? nil : deployer.stdouts_to_s
49
+ if exit_status == 0
50
+ # As it's possible sshd has to be restarted because of a change in its conf, restart the container.
51
+ # Otherwise you'll get the following error upon reconnection:
52
+ # System is booting up. See pam_nologin(8)
53
+ # Authentication failed.
54
+ instance.stop
55
+ instance.with_running_instance(port: 22) do
56
+
57
+ # ===== Deploy removes root access
58
+ # Check that we can't connect with root
59
+ ssh_ok = false
60
+ begin
61
+ Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
62
+ ssh_ok = ssh.exec!('echo Works').strip == 'Works'
63
+ end
64
+ rescue
65
+ end
66
+ assert_equal ssh_ok, false, 'Root can still connect on the image after deployment'
67
+ # Even if we can connect using root, run the idempotence test
68
+
69
+ # ===== Idempotence
70
+ unless ssh_ok
71
+ # Now that the node has been deployed, use the a_testadmin user for the check-node (as root has no more access)
72
+ deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user = 'a_testadmin'
73
+ deployer.instance_variable_get(:@actions_executor).connector(:ssh).passwords.delete(@node)
74
+ end
75
+ deployer.use_why_run = true
76
+ deployer.nbr_retries_on_error = 0
77
+ # For the idempotence testing activate log debugs, so that in case of failures we have full details
78
+ deployer.log_level = :debug
79
+ exit_status, stdout, stderr = deployer.deploy_on(@node)[@node]
80
+ assert_equal exit_status, 0, "Check-node after deployment returned error code #{exit_status}", log_debug? ? nil : deployer.stdouts_to_s
81
+ # Check that the output of the check-node returns no changes.
82
+ ignored_tasks = @nodes_handler.select_confs_for_node(@node, @config.ignored_idempotence_tasks).inject({}) do |merged_ignored_tasks, conf|
83
+ merged_ignored_tasks.merge(conf[:ignored_tasks])
84
+ end
85
+ @deployer.parse_deploy_output(@node, stdout, stderr).each do |task_info|
86
+ if task_info[:status] == :changed
87
+ if ignored_tasks.key?(task_info[:name])
88
+ # It was expected that this task is not idempotent
89
+ log_debug "Task #{task_info[:name]} was expected to not be idempotent. Reason: #{ignored_tasks[task_info[:name]]}"
90
+ else
91
+ extra_details = task_info.slice(*(task_info.keys - %i[name status diffs]))
92
+ error_details = []
93
+ error_details << "----- Changes:\n#{task_info[:diffs].strip}\n-----" if task_info[:diffs]
94
+ error_details << "----- Additional details:\n#{JSON.pretty_generate(extra_details)}\n-----" unless extra_details.empty?
95
+ error "Task #{task_info[:name]} is not idempotent", error_details.empty? ? nil : error_details.join("\n")
96
+ end
97
+ end
98
+ end
99
+
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ end
107
+
108
+ end
109
+
110
+ end
111
+
112
+ end
@@ -0,0 +1,35 @@
1
+ require 'hybrid_platforms_conductor/test_by_service'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Test that check-node returns no error on an empty image
10
+ class CheckFromScratch < TestByService
11
+
12
+ # Check my_test_plugin.rb.sample documentation for signature details.
13
+ def test_for_node
14
+ @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'check_from_scratch', reuse_instance: log_debug?) do |deployer|
15
+ deployer.use_why_run = true
16
+ result = deployer.deploy_on(@node)
17
+ assert_equal result.size, 1, "Wrong number of nodes being tested: #{result.size}"
18
+ tested_node, (exit_status, _stdout, _stderr) = result.first
19
+ if exit_status.is_a?(Symbol)
20
+ # In debug mode, the logger is the normal one, already outputting the error. No need to get it back from the logs.
21
+ error "Check-node could not run because of error: #{exit_status}.", log_debug? ? nil : deployer.stdouts_to_s
22
+ else
23
+ assert_equal tested_node, @node, "Wrong node being tested: #{tested_node} should be #{@node}"
24
+ assert_equal exit_status, 0, "Check-node returned error code #{exit_status}"
25
+ end
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,28 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Test that the connection works by simply outputing something
8
+ class Connection < HybridPlatformsConductor::Test
9
+
10
+ TEST_CONNECTION_STRING = 'Test connection - ok'
11
+
12
+ # Check my_test_plugin.rb.sample documentation for signature details.
13
+ def test_on_node
14
+ node_connection_string = "#{TEST_CONNECTION_STRING} for #{@node}"
15
+ {
16
+ "echo '#{node_connection_string}'" => proc do |stdout|
17
+ assert_equal stdout.first, node_connection_string, 'Connection failed'
18
+ end
19
+ }
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,44 @@
1
+ require 'time'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Test that the last deployment was done recently
10
+ class DeployFreshness < HybridPlatformsConductor::Test
11
+
12
+ MAX_ACCEPTABLE_REFRESH_PERIOD_SECS = 3 * 31 * 24 * 60 * 60 # 3 months
13
+
14
+ # Check my_test_plugin.rb.sample documentation for signature details.
15
+ def test_on_node
16
+ now = Time.now
17
+ {
18
+ 'sudo ls -t /var/log/deployments' => proc do |stdout|
19
+ if stdout.empty?
20
+ error 'Node has never been deployed using deploy (/var/log/deployments is empty)'
21
+ elsif stdout.first =~ /No such file or directory/
22
+ error 'Node has never been deployed using deploy (/var/log/deployments does not exist)'
23
+ else
24
+ # Expecting following file names
25
+ # 2017-12-01_093418_a_usernme
26
+ file_match = stdout.first.match(/^#{Regexp.escape(@node)}_(\d{4}-\d{2}-\d{2})_.+$/)
27
+ if file_match.nil?
28
+ error "Invalid chef deployment log file found: #{stdout.first}"
29
+ else
30
+ last_deploy_time = Time.parse(file_match[1])
31
+ error "Last deployment has been done on #{last_deploy_time.strftime('%F')}. Should refresh it." if now - last_deploy_time > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS
32
+ end
33
+ end
34
+ end
35
+ }
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,36 @@
1
+ require 'hybrid_platforms_conductor/test_by_service'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Test that deploy returns no error on an empty image
10
+ class DeployFromScratch < TestByService
11
+
12
+ # Check my_test_plugin.rb.sample documentation for signature details.
13
+ def test_for_node
14
+ @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_from_scratch', reuse_instance: log_debug?) do |deployer|
15
+ deployer.nbr_retries_on_error = 3
16
+ deployer.log_level = :debug
17
+ result = deployer.deploy_on(@node)
18
+ assert_equal result.size, 1, "Wrong number of nodes being tested: #{result.size}"
19
+ tested_node, (exit_status, _stdout, _stderr) = result.first
20
+ if exit_status.is_a?(Symbol)
21
+ # In debug mode, the logger is the normal one, already outputting the error. No need to get it back from the logs.
22
+ error "Deploy could not run because of error: #{exit_status}.", log_debug? ? nil : deployer.stdouts_to_s
23
+ else
24
+ assert_equal tested_node, @node, "Wrong node being deployed: #{tested_node} should be #{@node}"
25
+ assert_equal exit_status, 0, "Deploy returned error code #{exit_status}"
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end