hybrid_platforms_conductor 33.0.0 → 33.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bin/check-node +0 -1
  4. data/bin/deploy +0 -1
  5. data/bin/get_impacted_nodes +0 -1
  6. data/bin/last_deploys +8 -7
  7. data/bin/nodes_to_deploy +2 -2
  8. data/bin/setup +6 -6
  9. data/bin/topograph +1 -1
  10. data/lib/hybrid_platforms_conductor/action.rb +4 -4
  11. data/lib/hybrid_platforms_conductor/actions_executor.rb +37 -42
  12. data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
  13. data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
  14. data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
  15. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
  16. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
  17. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
  18. data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +4 -3
  19. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
  20. data/lib/hybrid_platforms_conductor/config.rb +7 -4
  21. data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
  22. data/lib/hybrid_platforms_conductor/connector.rb +5 -2
  23. data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
  24. data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
  25. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
  26. data/lib/hybrid_platforms_conductor/deployer.rb +95 -96
  27. data/lib/hybrid_platforms_conductor/executable.rb +20 -15
  28. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
  29. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
  30. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
  31. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +6 -5
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +118 -117
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +8 -6
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +7 -4
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +0 -1
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +19 -21
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +2 -3
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -2
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +2 -2
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +10 -9
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +2 -2
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +4 -6
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +25 -24
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
  74. data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
  75. data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
  76. data/lib/hybrid_platforms_conductor/log.rb +2 -2
  77. data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
  78. data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
  79. data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
  80. data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
  81. data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
  82. data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
  83. data/lib/hybrid_platforms_conductor/plugins.rb +13 -8
  84. data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
  85. data/lib/hybrid_platforms_conductor/report.rb +2 -2
  86. data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
  87. data/lib/hybrid_platforms_conductor/secrets_reader.rb +2 -2
  88. data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
  89. data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +1 -1
  90. data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
  91. data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
  92. data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
  93. data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
  94. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
  95. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
  96. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  97. data/spec/hybrid_platforms_conductor_test.rb +6 -6
  98. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +16 -11
  99. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
  100. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +23 -18
  101. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +67 -49
  102. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
  103. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +63 -50
  104. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +35 -35
  105. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
  106. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
  107. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
  108. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
  109. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
  110. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +73 -54
  111. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
  112. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
  113. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
  114. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +106 -91
  115. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
  116. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +10 -12
  117. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
  118. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
  119. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
  120. data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +7 -11
  121. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +34 -26
  122. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +21 -21
  123. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
  124. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
  125. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
  126. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
  127. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
  128. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
  129. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
  130. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
  131. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
  132. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
  133. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
  134. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
  135. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
  136. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
  137. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
  138. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
  139. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
  140. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +21 -20
  141. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +70 -55
  142. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
  143. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
  144. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
  145. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
  146. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
  147. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
  148. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
  149. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
  150. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
  151. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
  152. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
  153. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
  154. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
  155. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
  156. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
  157. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
  158. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
  159. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
  160. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
  161. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
  162. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
  163. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
  164. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
  165. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
  166. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
  167. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
  168. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
  169. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
  170. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +4 -3
  171. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
  172. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
  173. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
  174. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
  175. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
  176. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
  177. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +5 -5
  178. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
  179. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
  180. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
  181. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
  182. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
  183. data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
  184. data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
  185. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
  186. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
  187. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +13 -15
  188. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +289 -307
  189. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
  190. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
  191. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -9
  192. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -14
  193. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
  194. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
  195. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
  196. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
  197. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
  198. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
  199. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
  200. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
  201. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
  202. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
  203. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
  204. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
  205. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
  206. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +216 -14
  207. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
  208. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
  209. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
  210. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
  211. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
  212. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
  213. data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
  214. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
  215. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
  216. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id1.rb → test_plugin_id_1.rb} +0 -0
  217. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id2.rb → test_plugin_id_2.rb} +0 -0
  218. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/{test_plugin_id3.rb → test_plugin_id_3.rb} +0 -0
  219. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/{test_plugin_type2/test_plugin_id4.rb → test_plugin_type_2/test_plugin_id_4.rb} +0 -0
  220. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
  221. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
  222. data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
  223. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
  224. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
  225. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  226. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  227. data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
  228. data/spec/hybrid_platforms_conductor_test/test_connector.rb +3 -3
  229. data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +3 -1
  230. data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +3 -1
  231. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
  232. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
  233. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
  234. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
  235. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
  236. data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +4 -4
  237. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
  238. data/spec/spec_helper.rb +17 -18
  239. data/tools/check_md +16 -20
  240. data/tools/generate_mermaid +1 -1
  241. metadata +43 -13
  242. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -1152
@@ -54,7 +54,7 @@ module HybridPlatformsConductor
54
54
  # * *service* (String): Service to be deployed
55
55
  # Result::
56
56
  # * Hash: The secrets
57
- def secrets_for(node, service)
57
+ def secrets_for(node, _service)
58
58
  secrets = {}
59
59
  # As we are dealing with global secrets, cache the reading for performance between nodes and services.
60
60
  # Keep secrets cache grouped by URL/ID
@@ -65,14 +65,17 @@ module HybridPlatformsConductor
65
65
  HybridPlatformsConductor::Thycotic.with_thycotic(thycotic_secrets_info[:thycotic_url], @logger, @logger_stderr) do |thycotic|
66
66
  secret_file_item_id = thycotic.get_secret(thycotic_secrets_info[:secret_id]).dig(:secret, :items, :secret_item, :id)
67
67
  raise "Unable to fetch secret file ID #{thycotic_secrets_info[:secret_id]} from #{thycotic_secrets_info[:thycotic_url]}" if secret_file_item_id.nil?
68
+
68
69
  secret = thycotic.download_file_attachment_by_item_id(thycotic_secrets_info[:secret_id], secret_file_item_id)
69
70
  raise "Unable to fetch secret file attachment from secret ID #{thycotic_secrets_info[:secret_id]} from #{thycotic_secrets_info[:thycotic_url]}" if secret.nil?
71
+
70
72
  @secrets[server_id] = JSON.parse(secret)
71
73
  end
72
74
  end
73
- secrets.merge!(@secrets[server_id]) do |key, value1, value2|
74
- raise "Thycotic secret #{key} served by #{thycotic_secrets_info[:thycotic_url]} from secret ID #{thycotic_secrets_info[:secret_id]} has conflicting values between different secrets." if value1 != value2
75
- value1
75
+ secrets.merge!(@secrets[server_id]) do |key, value_1, value_2|
76
+ raise "Thycotic secret #{key} served by #{thycotic_secrets_info[:thycotic_url]} from secret ID #{thycotic_secrets_info[:secret_id]} has conflicting values between different secrets." if value_1 != value_2
77
+
78
+ value_1
76
79
  end
77
80
  end
78
81
  secrets
@@ -10,7 +10,7 @@ module HybridPlatformsConductor
10
10
  # Check that all repositories in Bitbucket have a consistent dev workflow.
11
11
  class BitbucketConf < HybridPlatformsConductor::Test
12
12
 
13
- self.extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
13
+ extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
14
14
 
15
15
  # Check my_test_plugin.rb.sample documentation for signature details.
16
16
  def test
@@ -107,12 +107,12 @@ module HybridPlatformsConductor
107
107
  mandatory_default_reviewers = repo_info.dig(*%i[checks pr_settings mandatory_default_reviewers])
108
108
  if mandatory_default_reviewers
109
109
  reviewers_found = default_reviewers.any? do |condition_info|
110
- reviewers = condition_info.dig('reviewers')
110
+ reviewers = condition_info['reviewers']
111
111
  condition_info.dig('sourceRefMatcher', 'id') == 'ANY_REF_MATCHER_ID' &&
112
112
  condition_info.dig('targetRefMatcher', 'id') == 'ANY_REF_MATCHER_ID' &&
113
113
  !reviewers.nil? &&
114
114
  (mandatory_default_reviewers - reviewers.map { |reviewer_info| reviewer_info['name'] }).empty? &&
115
- (required_approvers.nil? || condition_info.dig('requiredApprovals') == required_approvers)
115
+ (required_approvers.nil? || condition_info['requiredApprovals'] == required_approvers)
116
116
  end
117
117
  assert_equal(
118
118
  reviewers_found,
@@ -18,7 +18,7 @@ module HybridPlatformsConductor
18
18
  # Don't forget to add the testadmin private key in your SSH agent if you run this test locally.
19
19
  class CheckDeployAndIdempotence < TestByService
20
20
 
21
- self.extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
21
+ extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
22
22
 
23
23
  # Check my_test_plugin.rb.sample documentation for signature details.
24
24
  def test_for_node
@@ -30,6 +30,7 @@ module HybridPlatformsConductor
30
30
  ssh_ok = ssh.exec!('echo Works').strip == 'Works'
31
31
  end
32
32
  rescue
33
+ nil
33
34
  end
34
35
  assert_equal ssh_ok, true, 'Root does not have access from the empty image'
35
36
 
@@ -46,7 +47,7 @@ module HybridPlatformsConductor
46
47
  deployer.nbr_retries_on_error = 3
47
48
  exit_status, _stdout, _stderr = deployer.deploy_on(@node)[@node]
48
49
  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
+ if exit_status.zero?
50
51
  # As it's possible sshd has to be restarted because of a change in its conf, restart the container.
51
52
  # Otherwise you'll get the following error upon reconnection:
52
53
  # System is booting up. See pam_nologin(8)
@@ -63,6 +64,7 @@ module HybridPlatformsConductor
63
64
  ssh_ok = ssh.exec!('echo Works').strip == 'Works'
64
65
  end
65
66
  rescue
67
+ nil
66
68
  end
67
69
  assert_equal ssh_ok, false, 'Root can still connect on the image after deployment'
68
70
  # Even if we can connect using root, run the idempotence test
@@ -13,7 +13,6 @@ module HybridPlatformsConductor
13
13
 
14
14
  # Check my_test_plugin.rb.sample documentation for signature details.
15
15
  def test_for_node
16
- now = Time.now
17
16
  deploy_info = @deployer.deployment_info_from(@node)[@node]
18
17
  if deploy_info.key?(:error)
19
18
  error "Error while getting deployment info: #{deploy_info[:error]}"
@@ -12,32 +12,34 @@ module HybridPlatformsConductor
12
12
 
13
13
  # Check my_test_plugin.rb.sample documentation for signature details.
14
14
  def test_for_node
15
- unless @nodes_handler.get_root_access_allowed_of(@node)
16
- @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_removes_root_access', reuse_instance: log_debug?) do |deployer, instance|
17
- # Check that we can connect with root
15
+ return if @nodes_handler.get_root_access_allowed_of(@node)
16
+
17
+ @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_removes_root_access', reuse_instance: log_debug?) do |deployer, instance|
18
+ # Check that we can connect with root
19
+ ssh_ok = false
20
+ begin
21
+ Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
22
+ ssh_ok = ssh.exec!('echo Works').strip == 'Works'
23
+ end
24
+ rescue
25
+ nil
26
+ end
27
+ assert_equal ssh_ok, true, 'Root does not have access from the empty image'
28
+ if ssh_ok
29
+ deployer.nbr_retries_on_error = 3
30
+ deployer.deploy_on @node
31
+ # As sshd is certainly being restarted, start and stop the container to reload it.
32
+ deployer.restart @node
33
+ # Check that we can't connect with root
18
34
  ssh_ok = false
19
35
  begin
20
36
  Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
21
37
  ssh_ok = ssh.exec!('echo Works').strip == 'Works'
22
38
  end
23
39
  rescue
40
+ nil
24
41
  end
25
- assert_equal ssh_ok, true, 'Root does not have access from the empty image'
26
- if ssh_ok
27
- deployer.nbr_retries_on_error = 3
28
- deployer.deploy_on @node
29
- # As sshd is certainly being restarted, start and stop the container to reload it.
30
- deployer.restart @node
31
- # Check that we can't connect with root
32
- ssh_ok = false
33
- begin
34
- Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
35
- ssh_ok = ssh.exec!('echo Works').strip == 'Works'
36
- end
37
- rescue
38
- end
39
- assert_equal ssh_ok, false, 'Root can still connect on the image after deployment'
40
- end
42
+ assert_equal ssh_ok, false, 'Root can still connect on the image after deployment'
41
43
  end
42
44
  end
43
45
  end
@@ -10,10 +10,10 @@ module HybridPlatformsConductor
10
10
  # Test that the node has not diverged since last deployment
11
11
  class Divergence < HybridPlatformsConductor::Test
12
12
 
13
- self.extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
13
+ extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
14
14
 
15
15
  # Check my_test_plugin.rb.sample documentation for signature details.
16
- def test_on_check_node(stdout, stderr, exit_status)
16
+ def test_on_check_node(stdout, stderr, _exit_status)
17
17
  # Check that the output of the check-node returns no changes.
18
18
  ignored_tasks = @nodes_handler.select_confs_for_node(@node, @config.ignored_divergent_tasks).inject({}) do |merged_ignored_tasks, conf|
19
19
  merged_ignored_tasks.merge(conf[:ignored_tasks])
@@ -27,7 +27,7 @@ module HybridPlatformsConductor
27
27
  ).known_platforms.first
28
28
  unless example_platform.nil?
29
29
  tests.concat [
30
- "#{CmdRunner.executables_prefix}get_impacted_nodes --platform #{example_platform.name} --show-commands",
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?
@@ -42,7 +42,7 @@ module HybridPlatformsConductor
42
42
  ]
43
43
  end
44
44
  end
45
- tests.sort.each do |cmd|
45
+ tests.sort.each do |cmd|
46
46
  log_debug "Testing #{cmd}"
47
47
  exit_status, stdout, _stderr = @cmd_runner.run_cmd "#{cmd} 2>&1", no_exception: true, log_to_stdout: log_debug?
48
48
  assert_equal(exit_status, 0, "Command #{cmd} returned code #{exit_status}:\n#{stdout}")
@@ -10,31 +10,29 @@ module HybridPlatformsConductor
10
10
  # Perform various tests on a node's file system
11
11
  class FileSystem < TestOnlyRemoteNode
12
12
 
13
- self.extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
13
+ extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
14
14
 
15
15
  # Check my_test_plugin.rb.sample documentation for signature details.
16
16
  def test_on_node
17
17
  # Flatten the paths rules so that we can spot inconsistencies in configuration
18
- Hash[
19
- @config.aggregate_files_rules(@nodes_handler, @node).map do |path, rule_info|
20
- [
21
- "if #{@nodes_handler.sudo_on(@node)} /bin/bash -c '[[ -d \"#{path}\" ]]' ; then echo 1 ; else echo 0 ; fi",
22
- {
23
- validator: proc do |stdout, stderr|
24
- case stdout.last
25
- when '1'
26
- error "Path found that should be absent: #{path}" if rule_info[:state] == :absent
27
- when '0'
28
- error "Path not found that should be present: #{path}" if rule_info[:state] == :present
29
- else
30
- error "Could not check for existence of path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
31
- end
32
- end,
33
- timeout: 2
34
- }
35
- ]
36
- end
37
- ]
18
+ @config.aggregate_files_rules(@nodes_handler, @node).map do |path, rule_info|
19
+ [
20
+ "if #{@nodes_handler.sudo_on(@node)} /bin/bash -c '[[ -d \"#{path}\" ]]' ; then echo 1 ; else echo 0 ; fi",
21
+ {
22
+ validator: proc do |stdout, stderr|
23
+ case stdout.last
24
+ when '1'
25
+ error "Path found that should be absent: #{path}" if rule_info[:state] == :absent
26
+ when '0'
27
+ error "Path not found that should be present: #{path}" if rule_info[:state] == :present
28
+ else
29
+ error "Could not check for existence of path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
30
+ end
31
+ end,
32
+ timeout: 2
33
+ }
34
+ ]
35
+ end.to_h
38
36
  end
39
37
 
40
38
  end
@@ -9,31 +9,29 @@ module HybridPlatformsConductor
9
9
  # Perform various tests on a HDFS's file system
10
10
  class FileSystemHdfs < HybridPlatformsConductor::Test
11
11
 
12
- self.extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
12
+ extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
13
13
 
14
14
  # Check my_test_plugin.rb.sample documentation for signature details.
15
15
  def test_on_node
16
16
  # Flatten the paths rules so that we can spot inconsistencies in configuration
17
- Hash[
18
- @config.aggregate_files_rules(@nodes_handler, @node, file_system_type: :hdfs).map do |path, rule_info|
19
- [
20
- "if sudo#{rule_info[:context][:sudo_user] ? " -u #{rule_info[:context][:sudo_user]}" : ''} hdfs dfs -ls \"#{path}\" ; then echo 1 ; else echo 0 ; fi",
21
- {
22
- validator: proc do |stdout, stderr|
23
- case stdout.last
24
- when '1'
25
- error "HDFS path found that should be absent: #{path}" if rule_info[:state] == :absent
26
- when '0'
27
- error "HDFS path not found that should be present: #{path}" if rule_info[:state] == :present
28
- else
29
- error "Could not check for existence of HDFS path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
30
- end
31
- end,
32
- timeout: 5
33
- }
34
- ]
35
- end
36
- ]
17
+ @config.aggregate_files_rules(@nodes_handler, @node, file_system_type: :hdfs).map do |path, rule_info|
18
+ [
19
+ "if sudo#{rule_info[:context][:sudo_user] ? " -u #{rule_info[:context][:sudo_user]}" : ''} hdfs dfs -ls \"#{path}\" ; then echo 1 ; else echo 0 ; fi",
20
+ {
21
+ validator: proc do |stdout, stderr|
22
+ case stdout.last
23
+ when '1'
24
+ error "HDFS path found that should be absent: #{path}" if rule_info[:state] == :absent
25
+ when '0'
26
+ error "HDFS path not found that should be present: #{path}" if rule_info[:state] == :present
27
+ else
28
+ error "Could not check for existence of HDFS path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
29
+ end
30
+ end,
31
+ timeout: 5
32
+ }
33
+ ]
34
+ end.to_h
37
35
  end
38
36
 
39
37
  end
@@ -9,7 +9,7 @@ module HybridPlatformsConductor
9
9
  # Check that all repositories have a successful Github CI
10
10
  class GithubCi < HybridPlatformsConductor::Test
11
11
 
12
- self.extend_config_dsl_with CommonConfigDsl::Github, :init_github
12
+ extend_config_dsl_with CommonConfigDsl::Github, :init_github
13
13
 
14
14
  # Check my_test_plugin.rb.sample documentation for signature details.
15
15
  def test
@@ -17,8 +17,7 @@ module HybridPlatformsConductor
17
17
  log_debug "Checking CI for Github repository #{repo_info[:slug]}"
18
18
  last_status = client.repository_workflow_runs(repo_info[:slug])[:workflow_runs].
19
19
  select { |run| run[:head_branch] == 'master' }.
20
- sort_by { |run| run[:created_at] }.
21
- last[:conclusion]
20
+ max_by { |run| run[:created_at] }[:conclusion]
22
21
  error "Last workflow status for repository #{repo_info[:slug]} is #{last_status}" unless last_status == 'success'
23
22
  end
24
23
  end
@@ -13,7 +13,7 @@ module HybridPlatformsConductor
13
13
  # Don't forget to add the testadmin private key in your SSH agent if you run this test locally.
14
14
  class Idempotence < TestByService
15
15
 
16
- self.extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
16
+ extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
17
17
 
18
18
  # Check my_test_plugin.rb.sample documentation for signature details.
19
19
  def test_for_node
@@ -21,7 +21,7 @@ module HybridPlatformsConductor
21
21
  # First deploy as root
22
22
  deployer.nbr_retries_on_error = 3
23
23
  exit_status, _stdout, _stderr = deployer.deploy_on(@node)[@node]
24
- if exit_status == 0
24
+ if exit_status.zero?
25
25
  # As it's possible sshd has to be restarted because of a change in its conf, restart the container.
26
26
  # Otherwise you'll get the following error upon reconnection:
27
27
  # System is booting up. See pam_nologin(8)
@@ -19,7 +19,7 @@ module HybridPlatformsConductor
19
19
  else
20
20
  private_ips = @nodes_handler.get_private_ips_of @node
21
21
  if private_ips
22
- host_ips = stdout.first.split(' ').select { |ip| ip =~ /^172\.16\.\d+\.\d+$/ }.sort
22
+ host_ips = stdout.first.split.select { |ip| ip =~ /^172\.16\.\d+\.\d+$/ }.sort
23
23
  ref_ips = private_ips.sort
24
24
  assert_equal(
25
25
  host_ips,
@@ -1,3 +1,4 @@
1
+ require 'open-uri'
1
2
  require 'nokogiri'
2
3
  require 'hybrid_platforms_conductor/credentials'
3
4
  require 'hybrid_platforms_conductor/common_config_dsl/bitbucket'
@@ -11,7 +12,7 @@ module HybridPlatformsConductor
11
12
  # Check that all repositories have a correct Jenkins CI configuration.
12
13
  class JenkinsCiConf < HybridPlatformsConductor::Test
13
14
 
14
- self.extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
15
+ extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
15
16
 
16
17
  # Check my_test_plugin.rb.sample documentation for signature details.
17
18
  def test
@@ -21,27 +22,25 @@ module HybridPlatformsConductor
21
22
  else
22
23
  Credentials.with_credentials_for(:jenkins_ci, @logger, @logger_stderr, url: repo_info[:jenkins_ci_url]) do |jenkins_user, jenkins_password|
23
24
  # Get its config
24
- begin
25
- doc = Nokogiri::XML(open("#{repo_info[:jenkins_ci_url]}/config.xml", http_basic_authentication: [jenkins_user, jenkins_password]).read)
26
- # Check that this job builds the correct Bitbucket repository
27
- assert_equal(
28
- doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/serverUrl').text,
29
- bitbucket.bitbucket_url,
30
- "Job #{repo_info[:jenkins_ci_url]} does not build repository from Bitbucket"
31
- )
32
- assert_equal(
33
- doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repoOwner').text.downcase,
34
- repo_info[:project].downcase,
35
- "Job #{repo_info[:jenkins_ci_url]} does not build repository from project #{repo_info[:project]}"
36
- )
37
- assert_equal(
38
- doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repository').text,
39
- repo_info[:name],
40
- "Job #{repo_info[:jenkins_ci_url]} does not build repository named #{repo_info[:name]}"
41
- )
42
- rescue
43
- error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{repo_info[:jenkins_ci_url]}: #{$!}"
44
- end
25
+ doc = Nokogiri::XML(URI.parse("#{repo_info[:jenkins_ci_url]}/config.xml").open(http_basic_authentication: [jenkins_user, jenkins_password]).read)
26
+ # Check that this job builds the correct Bitbucket repository
27
+ assert_equal(
28
+ doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/serverUrl').text,
29
+ bitbucket.bitbucket_url,
30
+ "Job #{repo_info[:jenkins_ci_url]} does not build repository from Bitbucket"
31
+ )
32
+ assert_equal(
33
+ doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repoOwner').text.downcase,
34
+ repo_info[:project].downcase,
35
+ "Job #{repo_info[:jenkins_ci_url]} does not build repository from project #{repo_info[:project]}"
36
+ )
37
+ assert_equal(
38
+ doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repository').text,
39
+ repo_info[:name],
40
+ "Job #{repo_info[:jenkins_ci_url]} does not build repository named #{repo_info[:name]}"
41
+ )
42
+ rescue
43
+ error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{repo_info[:jenkins_ci_url]}: #{$ERROR_INFO}"
45
44
  end
46
45
  end
47
46
  end
@@ -11,7 +11,7 @@ module HybridPlatformsConductor
11
11
  # Check that all repositories have a successful master branch on a Jenkins CI
12
12
  class JenkinsCiMastersOk < HybridPlatformsConductor::Test
13
13
 
14
- self.extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
14
+ extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
15
15
 
16
16
  SUCCESS_STATUSES = [
17
17
  # Add nil as the status of a currently running job (which is always the case for hybrid-platforms) is null
@@ -29,17 +29,15 @@ module HybridPlatformsConductor
29
29
  else
30
30
  master_info_url = "#{repo_info[:jenkins_ci_url]}/job/master/api/json"
31
31
  Credentials.with_credentials_for(:jenkins_ci, @logger, @logger_stderr, url: master_info_url) do |jenkins_user, jenkins_password|
32
- begin
33
- # Get the master branch info from the API
34
- master_info = JSON.parse(open(master_info_url, http_basic_authentication: [jenkins_user, jenkins_password]).read)
35
- # Get the last build's URL
36
- last_build_info_url = "#{master_info['lastBuild']['url']}/api/json"
37
- last_build_info = JSON.parse(open(last_build_info_url, http_basic_authentication: [jenkins_user, jenkins_password]).read)
38
- log_debug "Build info for #{master_info_url}:\n#{JSON.pretty_generate(last_build_info)}"
39
- error "Last build for job #{repo_info[:project]}/#{repo_info[:name]} is in status #{last_build_info['result']}: #{master_info['lastBuild']['url']}" unless SUCCESS_STATUSES.include?(last_build_info['result'])
40
- rescue
41
- error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{master_info_url}: #{$!}"
42
- end
32
+ # Get the master branch info from the API
33
+ master_info = JSON.parse(URI.parse(master_info_url).open(http_basic_authentication: [jenkins_user, jenkins_password]).read)
34
+ # Get the last build's URL
35
+ last_build_info_url = "#{master_info['lastBuild']['url']}/api/json"
36
+ last_build_info = JSON.parse(URI.parse(last_build_info_url).open(http_basic_authentication: [jenkins_user, jenkins_password]).read)
37
+ log_debug "Build info for #{master_info_url}:\n#{JSON.pretty_generate(last_build_info)}"
38
+ error "Last build for job #{repo_info[:project]}/#{repo_info[:name]} is in status #{last_build_info['result']}: #{master_info['lastBuild']['url']}" unless SUCCESS_STATUSES.include?(last_build_info['result'])
39
+ rescue
40
+ error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{master_info_url}: #{$ERROR_INFO}"
43
41
  end
44
42
  end
45
43
  end
@@ -17,7 +17,7 @@ module HybridPlatformsConductor
17
17
  log_to_stdout: log_debug?
18
18
  )
19
19
  stdout.split("\n").each do |merge_commit_id|
20
- _exit_status, stdout, _stderr = @cmd_runner.run_cmd(<<~EOS, log_to_stdout: log_debug?, no_exception: true, expected_code: [0, 1])
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
23
  $(git merge-base \
@@ -27,14 +27,14 @@ module HybridPlatformsConductor
27
27
  --pretty=format:\"%H\" \
28
28
  --graph \
29
29
  | grep '|'
30
- EOS
31
- if !stdout.empty?
32
- _exit_status, stdout, _stderr = @cmd_runner.run_cmd(
33
- "cd #{@platform.repository_path} && git --no-pager log #{merge_commit_id} --pretty=format:%aI",
34
- log_to_stdout: log_debug?
35
- )
36
- error "Git history is not linear because of Merge commit #{merge_commit_id}" if Time.now - Time.parse(stdout.strip) < LOOKING_PERIOD
37
- end
30
+ EO_BASH
31
+ next if stdout.empty?
32
+
33
+ _exit_status, stdout, _stderr = @cmd_runner.run_cmd(
34
+ "cd #{@platform.repository_path} && git --no-pager log #{merge_commit_id} --pretty=format:%aI",
35
+ log_to_stdout: log_debug?
36
+ )
37
+ error "Git history is not linear because of Merge commit #{merge_commit_id}" if Time.now - Time.parse(stdout.strip) < LOOKING_PERIOD
38
38
  end
39
39
  end
40
40