brpm_content 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +38 -0
  3. data/.travis.yml +14 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +21 -0
  6. data/README.md +308 -0
  7. data/Rakefile +24 -0
  8. data/TO_BE_MIGRATED.txt +8 -0
  9. data/architecture.png +0 -0
  10. data/brpm_content.gemspec +31 -0
  11. data/customers/demo/integrations/brpm/process_event_handler_event.rb +183 -0
  12. data/customers/demo/integrations/jenkins/spec/api/applications_spec.rb +89 -0
  13. data/customers/demo/integrations/jenkins/spec/api/plans_spec.rb +69 -0
  14. data/customers/demo/integrations/jenkins/spec/api/requests_spec.rb +57 -0
  15. data/customers/demo/integrations/jenkins/spec/spec_helper.rb +33 -0
  16. data/customers/demo/integrations/jira/process_webhook_event.rb +33 -0
  17. data/customers/demo/jira_mappings.rb +29 -0
  18. data/infrastructure/integrations/event_handler.rb +62 -0
  19. data/infrastructure/integrations/webhook_receiver.rb +49 -0
  20. data/infrastructure/shell_scripts/backup_database.sh +19 -0
  21. data/infrastructure/shell_scripts/create_bl_package.sh +34 -0
  22. data/infrastructure/shell_scripts/create_release_request.sh +34 -0
  23. data/infrastructure/shell_scripts/ddns.sh +10 -0
  24. data/infrastructure/shell_scripts/install_brpm.sh +63 -0
  25. data/infrastructure/shell_scripts/install_content_module.sh +66 -0
  26. data/infrastructure/shell_scripts/install_content_repo.sh +60 -0
  27. data/infrastructure/shell_scripts/install_module_from_gem.sh +80 -0
  28. data/infrastructure/shell_scripts/maintenance.sh +4 -0
  29. data/infrastructure/shell_scripts/patch_brpm.sh +90 -0
  30. data/infrastructure/shell_scripts/restore_database.sh +33 -0
  31. data/infrastructure/shell_scripts/run_event_handler.cmd +16 -0
  32. data/infrastructure/shell_scripts/run_event_handler.sh +20 -0
  33. data/infrastructure/shell_scripts/run_webhook_receiver.cmd +14 -0
  34. data/infrastructure/shell_scripts/run_webhook_receiver.sh +15 -0
  35. data/infrastructure/shell_scripts/update_content_repo.sh +21 -0
  36. data/infrastructure/silent_install_options_4.6.txt +93 -0
  37. data/infrastructure/silent_install_options_upgrade_4.6.txt +92 -0
  38. data/infrastructure/smtp_settings.rb +42 -0
  39. data/infrastructure/ssh_script_header_additions.rb +21 -0
  40. data/modules/ansible/automations/execute_role.rb +3 -0
  41. data/modules/ansible/automations/execute_role.txt +12 -0
  42. data/modules/ansible/config.yml +5 -0
  43. data/modules/ansible/lib/ansible.rb +41 -0
  44. data/modules/atrium_orchestrator/automations/execute_workflow.rb +12 -0
  45. data/modules/atrium_orchestrator/automations/execute_workflow.txt +25 -0
  46. data/modules/atrium_orchestrator/automations/reserve_ip_address.rb +22 -0
  47. data/modules/atrium_orchestrator/automations/reserve_ip_address.txt +21 -0
  48. data/modules/atrium_orchestrator/config.yml +7 -0
  49. data/modules/atrium_orchestrator/lib/ao_soap_client.rb +94 -0
  50. data/modules/bladelogic/automations/create_package.rb +29 -0
  51. data/modules/bladelogic/automations/create_package.txt +26 -0
  52. data/modules/bladelogic/automations/deploy_package.rb +137 -0
  53. data/modules/bladelogic/automations/deploy_package.txt +53 -0
  54. data/modules/bladelogic/config.yml +7 -0
  55. data/modules/bladelogic/lib/bl_rest/bsa_rest_client.rb +65 -0
  56. data/modules/bladelogic/lib/bl_soap/blpackage.rb +43 -0
  57. data/modules/bladelogic/lib/bl_soap/bsa_soap_base.rb +118 -0
  58. data/modules/bladelogic/lib/bl_soap/bsa_soap_client.rb +34 -0
  59. data/modules/bladelogic/lib/bl_soap/compliance_job.rb +155 -0
  60. data/modules/bladelogic/lib/bl_soap/deploy_job.rb +48 -0
  61. data/modules/bladelogic/lib/bl_soap/depot_group.rb +47 -0
  62. data/modules/bladelogic/lib/bl_soap/job.rb +376 -0
  63. data/modules/bladelogic/lib/bl_soap/job_group.rb +72 -0
  64. data/modules/bladelogic/lib/bl_soap/job_management.rb +22 -0
  65. data/modules/bladelogic/lib/bl_soap/job_result.rb +12 -0
  66. data/modules/bladelogic/lib/bl_soap/job_run.rb +271 -0
  67. data/modules/bladelogic/lib/bl_soap/login.rb +47 -0
  68. data/modules/bladelogic/lib/bl_soap/nsh_script_job.rb +14 -0
  69. data/modules/bladelogic/lib/bl_soap/patch_catalog.rb +178 -0
  70. data/modules/bladelogic/lib/bl_soap/patch_remediation_job.rb +137 -0
  71. data/modules/bladelogic/lib/bl_soap/patching_job.rb +250 -0
  72. data/modules/bladelogic/lib/bl_soap/server.rb +12 -0
  73. data/modules/bladelogic/lib/bl_soap/template.rb +13 -0
  74. data/modules/bladelogic/lib/bl_soap/utility.rb +99 -0
  75. data/modules/bladelogic/resource_automations/select_job.rb +33 -0
  76. data/modules/bladelogic/resource_automations/select_job.txt +15 -0
  77. data/modules/bladelogic/tests/create_package_spec.rb +28 -0
  78. data/modules/bladelogic/tests/deploy_package_spec.rb +23 -0
  79. data/modules/bladelogic/tests/spec_helper.rb +82 -0
  80. data/modules/brpm/automations/create_release_from_excel.rb +34 -0
  81. data/modules/brpm/automations/create_release_from_excel.txt +5 -0
  82. data/modules/brpm/automations/create_release_request.rb +100 -0
  83. data/modules/brpm/automations/create_release_request.txt +5 -0
  84. data/modules/brpm/automations/create_request.rb +73 -0
  85. data/modules/brpm/automations/create_request.txt +23 -0
  86. data/modules/brpm/automations/promote_request.rb +197 -0
  87. data/modules/brpm/automations/promote_request.txt +24 -0
  88. data/modules/brpm/automations/select_application_version.rb +22 -0
  89. data/modules/brpm/automations/select_application_version.txt +17 -0
  90. data/modules/brpm/automations/select_component_version.rb +12 -0
  91. data/modules/brpm/automations/select_component_version.txt +5 -0
  92. data/modules/brpm/automations/select_request_template.rb +6 -0
  93. data/modules/brpm/automations/select_request_template.txt +13 -0
  94. data/modules/brpm/automations/wait_for_step_in_other_request.rb +11 -0
  95. data/modules/brpm/automations/wait_for_step_in_other_request.txt +13 -0
  96. data/modules/brpm/automations/wait_till_promoted_request_is_completed.rb +9 -0
  97. data/modules/brpm/automations/wait_till_promoted_request_is_completed.txt +5 -0
  98. data/modules/brpm/config.yml +6 -0
  99. data/modules/brpm/lib/brpm_request.rb +207 -0
  100. data/modules/brpm/lib/brpm_rest.rb +312 -0
  101. data/modules/brpm/lib/brpm_rest_client.rb +1501 -0
  102. data/modules/brpm/resource_automations/select_application.rb +16 -0
  103. data/modules/brpm/resource_automations/select_application.txt +5 -0
  104. data/modules/brpm/resource_automations/select_environment.rb +14 -0
  105. data/modules/brpm/resource_automations/select_environment.txt +5 -0
  106. data/modules/brpm/resource_automations/select_request_template.rb +16 -0
  107. data/modules/brpm/resource_automations/select_request_template.txt +5 -0
  108. data/modules/brpm/resource_automations/select_step_in_request.rb +33 -0
  109. data/modules/brpm/resource_automations/select_step_in_request.txt +5 -0
  110. data/modules/brpm/sample_applications/e-finance.json +0 -0
  111. data/modules/brpm/tests/create_release_request_spec.rb +66 -0
  112. data/modules/brpm/tests/create_request_spec.rb +84 -0
  113. data/modules/brpm/tests/select_application_version_spec.rb +47 -0
  114. data/modules/brpm/tests/spec_helper.rb +63 -0
  115. data/modules/docker_brpm/automations/create_brpm_instance_input_params.rb +10 -0
  116. data/modules/docker_brpm/automations/create_brpm_instance_input_params.txt +17 -0
  117. data/modules/docker_brpm/automations/create_brpm_instance_one_shot.rb +60 -0
  118. data/modules/docker_brpm/automations/create_brpm_instance_one_shot.txt +14 -0
  119. data/modules/docker_brpm/automations/create_brpm_instance_show_results.rb +23 -0
  120. data/modules/docker_brpm/automations/create_brpm_instance_show_results.txt +13 -0
  121. data/modules/docker_brpm/automations/create_database.rb +24 -0
  122. data/modules/docker_brpm/automations/create_database.txt +3 -0
  123. data/modules/docker_brpm/automations/create_environment.rb +14 -0
  124. data/modules/docker_brpm/automations/create_environment.txt +3 -0
  125. data/modules/docker_brpm/automations/create_image_for_application.rb +23 -0
  126. data/modules/docker_brpm/automations/create_image_for_application.txt +6 -0
  127. data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.rb +7 -0
  128. data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.txt +8 -0
  129. data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.rb +7 -0
  130. data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.txt +8 -0
  131. data/modules/docker_brpm/automations/create_image_for_database_creator.rb +21 -0
  132. data/modules/docker_brpm/automations/create_image_for_database_creator.txt +6 -0
  133. data/modules/docker_brpm/automations/create_installed_component_for_application.rb +11 -0
  134. data/modules/docker_brpm/automations/create_installed_component_for_application.txt +3 -0
  135. data/modules/docker_brpm/automations/create_installed_component_for_database.rb +7 -0
  136. data/modules/docker_brpm/automations/create_installed_component_for_database.txt +3 -0
  137. data/modules/docker_brpm/automations/create_installed_component_for_database_creator.rb +8 -0
  138. data/modules/docker_brpm/automations/create_installed_component_for_database_creator.txt +3 -0
  139. data/modules/docker_brpm/automations/create_installed_component_for_utilities.rb +7 -0
  140. data/modules/docker_brpm/automations/create_installed_component_for_utilities.txt +3 -0
  141. data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.rb +13 -0
  142. data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.txt +6 -0
  143. data/modules/docker_brpm/automations/delete_brpm_instance.rb +38 -0
  144. data/modules/docker_brpm/automations/delete_brpm_instance.txt +8 -0
  145. data/modules/docker_brpm/automations/execute_test_run_in_jenkins.rb +43 -0
  146. data/modules/docker_brpm/automations/execute_test_run_in_jenkins.txt +13 -0
  147. data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.rb +5 -0
  148. data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.txt +9 -0
  149. data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.rb +27 -0
  150. data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.txt +3 -0
  151. data/modules/docker_brpm/automations/launch_test_run_request.rb +30 -0
  152. data/modules/docker_brpm/automations/launch_test_run_request.txt +14 -0
  153. data/modules/docker_brpm/automations/release_brpm_input_params.rb +7 -0
  154. data/modules/docker_brpm/automations/release_brpm_input_params.txt +8 -0
  155. data/modules/docker_brpm/automations/run_application_container.rb +27 -0
  156. data/modules/docker_brpm/automations/run_application_container.txt +3 -0
  157. data/modules/docker_brpm/automations/run_database_container.rb +14 -0
  158. data/modules/docker_brpm/automations/run_database_container.txt +3 -0
  159. data/modules/docker_brpm/automations/stop_application_container.rb +11 -0
  160. data/modules/docker_brpm/automations/stop_application_container.txt +3 -0
  161. data/modules/docker_brpm/automations/stop_database_container.rb +11 -0
  162. data/modules/docker_brpm/automations/stop_database_container.txt +3 -0
  163. data/modules/docker_brpm/automations/test_rest_api.rb +18 -0
  164. data/modules/docker_brpm/automations/test_rest_api.txt +3 -0
  165. data/modules/docker_brpm/automations/upgrade_database.rb +19 -0
  166. data/modules/docker_brpm/automations/upgrade_database.txt +8 -0
  167. data/modules/docker_brpm/config.yml +8 -0
  168. data/modules/docker_brpm/lib/docker.rb +39 -0
  169. data/modules/docker_brpm/lib/git.rb +16 -0
  170. data/modules/docker_brpm/sample_applications/dockerizedbrpm.json +0 -0
  171. data/modules/email/automations/send_notification.rb +48 -0
  172. data/modules/email/automations/send_notification.txt +27 -0
  173. data/modules/email/config.yml +6 -0
  174. data/modules/framework/automations/direct_execute.rb +10 -0
  175. data/modules/framework/automations/direct_execute.txt +16 -0
  176. data/modules/framework/automations/install_module.rb +13 -0
  177. data/modules/framework/automations/install_module.txt +16 -0
  178. data/modules/framework/bin/brpm_install +106 -0
  179. data/modules/framework/bin/event_handler +63 -0
  180. data/modules/framework/bin/webhook_receiver +49 -0
  181. data/modules/framework/brpm_auto.rb +307 -0
  182. data/modules/framework/brpm_framework.rb +88 -0
  183. data/modules/framework/brpm_script_executor.rb +146 -0
  184. data/modules/framework/config.yml +7 -0
  185. data/modules/framework/config/customer_include.rb +26 -0
  186. data/modules/framework/config/server.yml +3 -0
  187. data/modules/framework/customer_include_default.rb +25 -0
  188. data/modules/framework/lib/logging/brpm_logger.rb +39 -0
  189. data/modules/framework/lib/logging/logger_base.rb +36 -0
  190. data/modules/framework/lib/logging/simple_logger.rb +27 -0
  191. data/modules/framework/lib/params/all_params.rb +80 -0
  192. data/modules/framework/lib/params/integration_settings.rb +27 -0
  193. data/modules/framework/lib/params/params.rb +172 -0
  194. data/modules/framework/lib/params/params_base.rb +81 -0
  195. data/modules/framework/lib/params/request_params.rb +38 -0
  196. data/modules/framework/lib/resource_framework.rb +211 -0
  197. data/modules/framework/lib/rest_api.rb +155 -0
  198. data/modules/framework/lib/semaphore.rb +79 -0
  199. data/modules/framework/lib/utilities.rb +317 -0
  200. data/modules/framework/lib/version_control/git.rb +192 -0
  201. data/modules/framework/lib/version_control/svn.rb +221 -0
  202. data/modules/framework/log.html +39 -0
  203. data/modules/framework/tests/all_params_spec.rb +116 -0
  204. data/modules/framework/tests/brpm_auto_spec.rb +84 -0
  205. data/modules/framework/tests/customer_include/config/customer_include.rb +10 -0
  206. data/modules/framework/tests/customer_include/config/server.yml +3 -0
  207. data/modules/framework/tests/customer_include_spec.rb +29 -0
  208. data/modules/framework/tests/local_jirb.rb +15 -0
  209. data/modules/framework/tests/params_spec.rb +172 -0
  210. data/modules/framework/tests/request_params_spec.rb +86 -0
  211. data/modules/framework/tests/server_yaml_spec.rb +19 -0
  212. data/modules/framework/tests/spec_helper.rb +42 -0
  213. data/modules/framework/transport/dispatch_baa.rb +355 -0
  214. data/modules/framework/transport/dispatch_base.rb +345 -0
  215. data/modules/framework/transport/dispatch_nsh.rb +248 -0
  216. data/modules/framework/transport/dispatch_ssh.rb +154 -0
  217. data/modules/framework/transport/transport_baa.rb +1095 -0
  218. data/modules/framework/transport/transport_nsh.rb +359 -0
  219. data/modules/framework/transport/transport_ssh.rb +220 -0
  220. data/modules/framework/write_to.rb +1 -0
  221. data/modules/jenkins/automations/create_release.rb +4 -0
  222. data/modules/jenkins/automations/create_release.txt +23 -0
  223. data/modules/jenkins/automations/f2_downloadJenkinsArtifact.rb +126 -0
  224. data/modules/jenkins/config.yml +7 -0
  225. data/modules/jenkins/lib/jenkins.rb +300 -0
  226. data/modules/jenkins/resource_automations/f2_rsc_jenkinsJobs.rb +58 -0
  227. data/modules/jira/automations/add_comment.rb +4 -0
  228. data/modules/jira/automations/add_comment.txt +23 -0
  229. data/modules/jira/automations/create_release.rb +4 -0
  230. data/modules/jira/automations/create_release.txt +23 -0
  231. data/modules/jira/automations/delete_release.rb +4 -0
  232. data/modules/jira/automations/delete_release.txt +23 -0
  233. data/modules/jira/automations/transition_issue.rb +4 -0
  234. data/modules/jira/automations/transition_issue.txt +23 -0
  235. data/modules/jira/automations/transition_issues_for_request.rb +29 -0
  236. data/modules/jira/automations/transition_issues_for_request.txt +20 -0
  237. data/modules/jira/automations/transition_issues_for_run.rb +26 -0
  238. data/modules/jira/automations/transition_issues_for_run.txt +20 -0
  239. data/modules/jira/automations/update_release.rb +4 -0
  240. data/modules/jira/automations/update_release.txt +26 -0
  241. data/modules/jira/config.yml +7 -0
  242. data/modules/jira/lib/jira_rest_client.rb +185 -0
  243. data/modules/jira/tests/create_read_update_delete_release_spec.rb +39 -0
  244. data/modules/jira/tests/spec_helper.rb +39 -0
  245. data/modules/jira/tests/transition_issue_spec.rb +32 -0
  246. data/modules/patch_process_management/automations/execute_job/script.rb +105 -0
  247. data/modules/patch_process_management/automations/execute_job/wrapper.txt +39 -0
  248. data/modules/patch_process_management/automations/patch_analysis/script.rb +107 -0
  249. data/modules/patch_process_management/automations/patch_analysis/wrapper.txt +33 -0
  250. data/modules/patch_process_management/automations/patch_readiness/script.rb +89 -0
  251. data/modules/patch_process_management/automations/patch_readiness/wrapper.txt +33 -0
  252. data/modules/patch_process_management/automations/patch_remediation/script.rb +217 -0
  253. data/modules/patch_process_management/automations/patch_remediation/wrapper.txt +40 -0
  254. data/modules/patch_process_management/config.yml +10 -0
  255. data/modules/teamcity/automations/trigger_build.rb +4 -0
  256. data/modules/teamcity/automations/trigger_build.txt +14 -0
  257. data/modules/teamcity/config.yml +7 -0
  258. data/modules/teamcity/lib/teamcity_rest_client.rb +17 -0
  259. data/modules/teamcity/tests/spec_helper.rb +34 -0
  260. data/modules/teamcity/tests/trigger_build_spec.rb +27 -0
  261. data/modules/windows/automations/deploy_directory_over_windows_shares/script.rb +87 -0
  262. data/modules/windows/automations/deploy_directory_over_windows_shares/wrapper.txt +29 -0
  263. data/modules/windows/automations/deploy_file_over_windows_shares/script.rb +31 -0
  264. data/modules/windows/automations/deploy_file_over_windows_shares/wrapper.txt +24 -0
  265. data/modules/windows/config.yml +6 -0
  266. data/modules/windows/lib/samba.rb +29 -0
  267. metadata +397 -0
@@ -0,0 +1,16 @@
1
+ def execute_script(params, parent_id, offset, max_records)
2
+ brpm_rest_client = BrpmRestClient.new
3
+
4
+ BrpmAuto.log "Finding all applications..."
5
+ apps = brpm_rest_client.get_apps()
6
+
7
+ apps = apps.sort_by { |app| app["name"] }
8
+
9
+ BrpmAuto.log "Adding the #{apps.count} found applications to the list..."
10
+ results = []
11
+ apps.each do |app|
12
+ results << { app["name"] => app["id"].to_i }
13
+ end
14
+
15
+ results
16
+ end
@@ -0,0 +1,5 @@
1
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
2
+
3
+ def execute(script_params, parent_id, offset, max_records)
4
+ BrpmScriptExecutor.execute_resource_automation_script("brpm", "select_application", script_params, parent_id, offset, max_records)
5
+ end
@@ -0,0 +1,14 @@
1
+ def execute_script(params, parent_id, offset, max_records)
2
+ brpm_rest_client = BrpmRestClient.new
3
+
4
+ BrpmAuto.log "Finding all environments for application #{params["application"]}..."
5
+ environments = brpm_rest_client.get_environments_of_application(params["application"])
6
+
7
+ BrpmAuto.log "Adding the #{environments.count} found environments to the list..."
8
+ results = []
9
+ environments.each do |environment|
10
+ results << { environment["name"] => environment["id"].to_i }
11
+ end
12
+
13
+ results
14
+ end
@@ -0,0 +1,5 @@
1
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
2
+
3
+ def execute(script_params, parent_id, offset, max_records)
4
+ BrpmScriptExecutor.execute_resource_automation_script("brpm", "select_environment", script_params, parent_id, offset, max_records)
5
+ end
@@ -0,0 +1,16 @@
1
+ def execute_script(params, parent_id, offset, max_records)
2
+ brpm_rest_client = BrpmRestClient.new
3
+
4
+ BrpmAuto.log "Finding all request templates for application #{params["application"]}..."
5
+ request_templates = brpm_rest_client.get_request_templates_by_app(params["application"])
6
+
7
+ request_templates = request_templates.sort_by { |request_template| request_template["name"] }
8
+
9
+ BrpmAuto.log "Adding the #{request_templates.count} found request templates to the list..."
10
+ results = []
11
+ request_templates.each do |request_template|
12
+ results << { request_template["name"] => request_template["id"].to_i }
13
+ end
14
+
15
+ results
16
+ end
@@ -0,0 +1,5 @@
1
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
2
+
3
+ def execute(script_params, parent_id, offset, max_records)
4
+ BrpmScriptExecutor.execute_resource_automation_script("brpm", "select_request_template", script_params, parent_id, offset, max_records)
5
+ end
@@ -0,0 +1,33 @@
1
+ def execute_script(params, parent_id, offset, max_records)
2
+ brpm_rest_client = BrpmRestClient.new
3
+
4
+ if parent_id.nil?
5
+ BrpmAuto.log "Finding all requests in the same stage as the current request (plan: #{params["request_plan"]} (id: #{params["request_plan_id"]}), stage: #{params["request_plan_stage"]}) ..."
6
+ requests = brpm_rest_client.get_requests_by_plan_id_and_stage_name(params["request_plan_id"], params["request_plan_stage"])
7
+
8
+ requests = requests.sort_by { |request| request["number"] }
9
+
10
+ results = []
11
+ requests.each do |request|
12
+ unless request["number"] == params["request_number"]
13
+ results << { :title => "#{request["number"]} - #{request["name"]}", :key => request["id"], :isFolder => true, :hasChild => true, :hideCheckbox => true}
14
+ end
15
+ end
16
+
17
+ results
18
+ else
19
+ BrpmAuto.log "Finding all steps in the request with id #{parent_id} ..."
20
+ request = brpm_rest_client.get_request_by_id(parent_id)
21
+
22
+ return if request.nil?
23
+
24
+ steps = request["steps"].sort_by { |step| step["number"].to_i }
25
+
26
+ results = []
27
+ steps.each do |step|
28
+ results << { :title => "#{step["position"]} - #{step["name"]}", :key => "#{parent_id}|#{step["id"]}", :isFolder => false, :hasChild => false, :hideCheckbox => false}
29
+ end
30
+
31
+ results
32
+ end
33
+ end
@@ -0,0 +1,5 @@
1
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
2
+
3
+ def execute(script_params, parent_id, offset, max_records)
4
+ BrpmScriptExecutor.execute_resource_automation_script("brpm", "select_step_in_request", script_params, parent_id, offset, max_records)
5
+ end
File without changes
@@ -0,0 +1,66 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe 'create release request' do
4
+ before(:all) do
5
+ setup_brpm_auto
6
+ end
7
+
8
+ before(:each) do
9
+ cleanup_requests_and_plans_for_app("E-Finance")
10
+ end
11
+
12
+ describe '' do
13
+ it 'should create a request from template' do
14
+ params = get_default_params
15
+ params["application_name"] = 'E-Finance'
16
+ params["application_version"] = '1.0.0'
17
+ params["release_request_template_name"] = 'Release E-Finance'
18
+
19
+ BrpmScriptExecutor.execute_automation_script("brpm", "create_release_request", params)
20
+
21
+ request = @brpm_rest_client.get_request_by_id(BrpmAuto.params["result"]["request_id"])
22
+
23
+ expect(request["aasm_state"]).to eq("started")
24
+ expect(request).not_to have_key("plan_member")
25
+ end
26
+ end
27
+
28
+ describe 'in new plan' do
29
+ it 'should create a plan from template and a request from template in that plan' do
30
+ params = get_default_params
31
+ params["application_name"] = 'E-Finance'
32
+ params["application_version"] = '1.0.1'
33
+ params["release_request_template_name"] = 'Release E-Finance'
34
+ params["release_plan_template_name"] = 'E-Finance Release Plan'
35
+
36
+ BrpmScriptExecutor.execute_automation_script("brpm", "create_release_request", params)
37
+
38
+ request = @brpm_rest_client.get_request_by_id(BrpmAuto.params["result"]["request_id"])
39
+
40
+ expect(request["aasm_state"]).to eq("started")
41
+ expect(request).to have_key("plan_member")
42
+ expect(request["plan_member"]["plan"]["id"]).not_to be_nil
43
+ end
44
+ end
45
+
46
+ describe 'in existing plan' do
47
+ it 'should create a request from template in the plan' do
48
+ plan = @brpm_rest_client.create_plan("E-Finance Release Plan", "E-Finance Release Plan v1.0.2")
49
+
50
+ params = get_default_params
51
+ params["application_name"] = 'E-Finance'
52
+ params["application_version"] = '1.0.2'
53
+ params["release_request_template_name"] = 'Release E-Finance'
54
+ params["release_plan_name"] = 'E-Finance Release Plan v1.0.2'
55
+
56
+ BrpmScriptExecutor.execute_automation_script("brpm", "create_release_request", params)
57
+
58
+ request = @brpm_rest_client.get_request_by_id(BrpmAuto.params["result"]["request_id"])
59
+
60
+ expect(request["aasm_state"]).to eq("started")
61
+ expect(request).to have_key("plan_member")
62
+ expect(request["plan_member"]["plan"]["id"]).to eq(plan["id"])
63
+ end
64
+ end
65
+ end
66
+
@@ -0,0 +1,84 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe 'create request' do
4
+ before(:all) do
5
+ setup_brpm_auto
6
+ end
7
+
8
+ before(:each) do
9
+ cleanup_requests_and_plans_for_app("E-Finance")
10
+ end
11
+
12
+ describe 'from request template by name' do
13
+ it 'should create a request from template' do
14
+ request_params = {}
15
+ request_params["application_version"] = '1.0.0'
16
+ request_params["template_name"] = 'Deploy E-Finance'
17
+ set_request_params(request_params)
18
+
19
+ params = get_default_params
20
+ params["application"] = 'E-Finance'
21
+ params["target_environment_id"] = '5' #test
22
+ params["release_request_template_name"] = 'Release E-Finance'
23
+ params["execute_target_request"] = 'No'
24
+
25
+ BrpmScriptExecutor.execute_automation_script("brpm", "create_request", params)
26
+
27
+ request = @brpm_rest_client.get_request_by_id(BrpmAuto.request_params["target_request_id"])
28
+
29
+ expect(request["aasm_state"]).to eq("created")
30
+ expect(request).not_to have_key("plan_member")
31
+ end
32
+ end
33
+
34
+ describe 'from request template by id' do
35
+ it 'should create a request from template' do
36
+ request_params = {}
37
+ request_params["application_version"] = '1.0.0'
38
+ request_params["request_template_id"] = '1' #Deploy E-Finance
39
+ set_request_params(request_params)
40
+
41
+ params = get_default_params
42
+ params["application"] = 'E-Finance'
43
+ params["target_environment_id"] = '5' #test
44
+ params["release_request_template_name"] = 'Release E-Finance'
45
+ params["execute_target_request"] = 'No'
46
+
47
+ BrpmScriptExecutor.execute_automation_script("brpm", "create_request", params)
48
+
49
+ request = @brpm_rest_client.get_request_by_id(BrpmAuto.request_params["target_request_id"])
50
+
51
+ expect(request["aasm_state"]).to eq("created")
52
+ expect(request).not_to have_key("plan_member")
53
+ end
54
+ end
55
+
56
+ describe 'from request template for plan and stage' do
57
+ it 'should create a request from template' do
58
+ plan = @brpm_rest_client.create_plan("E-Finance Release Plan", "E-Finance Release Plan v1.0.0")
59
+
60
+ request_params = {}
61
+ request_params["application_version"] = '1.0.0'
62
+ request_params["template_name"] = 'Deploy E-Finance'
63
+ set_request_params(request_params)
64
+
65
+ params = get_default_params
66
+ params["application"] = 'E-Finance'
67
+ params["target_environment_id"] = '5' #test
68
+ params["release_request_template_name"] = 'Release E-Finance'
69
+ params["request_plan_id"] = plan["id"].to_s
70
+ params["target_stage"] = 'Test'
71
+ params["execute_target_request"] = 'No'
72
+
73
+ BrpmScriptExecutor.execute_automation_script("brpm", "create_request", params)
74
+
75
+ request = @brpm_rest_client.get_request_by_id(BrpmAuto.request_params["target_request_id"])
76
+
77
+ expect(request["aasm_state"]).to eq("created")
78
+ expect(request).to have_key("plan_member")
79
+ expect(request["plan_member"]["plan"]["id"]).to eq(plan["id"])
80
+ expect(request["plan_member"]["stage"]["name"]).to eq("Test")
81
+ end
82
+ end
83
+ end
84
+
@@ -0,0 +1,47 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe 'select application version' do
4
+ before(:all) do
5
+ setup_brpm_auto
6
+ end
7
+
8
+ before(:each) do
9
+ cleanup_request_params
10
+ cleanup_version_tags_for_app("E-Finance")
11
+ end
12
+
13
+ describe '' do
14
+ it 'should store the selected application version in the request_params and create version tags' do
15
+ params = get_default_params
16
+ params["application"] = 'E-Finance'
17
+ params["application_version"] = '1.0.0'
18
+
19
+ BrpmScriptExecutor.execute_automation_script("brpm", "select_application_version", params)
20
+
21
+ expect(BrpmAuto.request_params.has_key?("application_version"))
22
+ expect(BrpmAuto.request_params["application_version"]).to eq("1.0.0")
23
+
24
+ version_tag = @brpm_rest_client.get_version_tag("E-Finance","EF - Java calculation engine", "development", "1.0.0")
25
+ expect(version_tag).not_to be_nil
26
+ end
27
+ end
28
+
29
+ describe 'with auto_created request_param set' do
30
+ it 'should NOT store the selected application version in the request_params but still create version tags' do
31
+ BrpmAuto.request_params["auto_created"] = true
32
+ BrpmAuto.request_params["application_version"] = "2.0.0"
33
+
34
+ params = get_default_params
35
+ params["application"] = 'E-Finance'
36
+ params["application_version"] = '1.0.0'
37
+
38
+ BrpmScriptExecutor.execute_automation_script("brpm", "select_application_version", params)
39
+
40
+ expect(BrpmAuto.request_params.has_key?("application_version"))
41
+ expect(BrpmAuto.request_params["application_version"]).to eq("2.0.0")
42
+
43
+ version_tag = @brpm_rest_client.get_version_tag("E-Finance","EF - Java calculation engine", "development", "2.0.0")
44
+ expect(version_tag).not_to be_nil
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,63 @@
1
+ require 'fileutils'
2
+ require_relative "../../framework/brpm_script_executor"
3
+
4
+ def setup_brpm_auto
5
+ FileUtils.mkdir_p "/tmp/brpm_content"
6
+
7
+ BrpmAuto.setup(get_default_params)
8
+
9
+ BrpmAuto.require_module "brpm"
10
+
11
+ @brpm_rest_client = BrpmRestClient.new('http://brpm-content.pulsar-it.be:8088/brpm', ENV["BRPM_API_TOKEN"])
12
+ end
13
+
14
+ def get_default_params
15
+ params = {}
16
+ params['also_log_to_console'] = 'true'
17
+
18
+ params['brpm_url'] = 'http://brpm-content.pulsar-it.be:8088/brpm'
19
+ params['brpm_api_token'] = ENV["BRPM_API_TOKEN"]
20
+
21
+ params['output_dir'] = "/tmp/brpm_content"
22
+
23
+ params
24
+ end
25
+
26
+ def cleanup_request_params
27
+ request_params_file = "/tmp/brpm_content/request_data.json"
28
+ File.delete(request_params_file) if File.exist?(request_params_file)
29
+ end
30
+
31
+ def set_request_params(request_params)
32
+ request_params_file = File.new("/tmp/brpm_content/request_data.json", "w")
33
+ request_params_file.puts(request_params.to_json)
34
+ request_params_file.close
35
+ end
36
+
37
+ def cleanup_requests_and_plans_for_app(app_name)
38
+ app = @brpm_rest_client.get_app_by_name(app_name)
39
+
40
+ requests = @brpm_rest_client.get_requests_by({ "app_id" => app["id"]})
41
+
42
+ requests.each do |request|
43
+ @brpm_rest_client.delete_request(request["id"]) unless request.has_key?("request_template")
44
+ end
45
+
46
+ plan_template = @brpm_rest_client.get_plan_template_by_name("#{app_name} Release Plan")
47
+
48
+ plans = @brpm_rest_client.get_plans_by({ "plan_template_id" => plan_template["id"]})
49
+ plans.each do |plan|
50
+ @brpm_rest_client.cancel_plan(plan["id"])
51
+ @brpm_rest_client.delete_plan(plan["id"])
52
+ end
53
+ end
54
+
55
+ def cleanup_version_tags_for_app(app_name)
56
+ app = @brpm_rest_client.get_app_by_name(app_name)
57
+
58
+ version_tags = @brpm_rest_client.get_version_tags_by({ "app_id" => app["id"]})
59
+
60
+ version_tags.each do |version_tag|
61
+ @brpm_rest_client.delete_version_tag(version_tag["id"])
62
+ end
63
+ end
@@ -0,0 +1,10 @@
1
+ params = BrpmAuto.params
2
+ request_params = BrpmAuto.request_params
3
+
4
+ BrpmAuto.log "Storing the input parameters ..."
5
+ request_params["application_version"] = params["application_version"]
6
+ request_params["instance_name"] = params["instance_name"]
7
+ request_params["port"] = params["port"]
8
+ request_params["overwrite_existing_data"] = params["overwrite_existing_data"]
9
+
10
+
@@ -0,0 +1,17 @@
1
+ ###
2
+ # brpm_version:
3
+ # name: brpm_version
4
+ # required: yes
5
+ # instance_name:
6
+ # name: instance_name
7
+ # required: yes
8
+ # port:
9
+ # name: port
10
+ # required: yes
11
+ # overwrite_existing_data:
12
+ # name: overwrite_existing_data
13
+ # required: no
14
+ ###
15
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
16
+
17
+ BrpmScriptExecutor.execute_automation_script("docker_brpm", "create_brpm_instance_input_params", params)
@@ -0,0 +1,60 @@
1
+ brpm_rest_client = BrpmRestClient.new
2
+ params = BrpmAuto.params
3
+
4
+ application_version = params["application_version"]
5
+ instance_name = params["instance_name"]
6
+ app_name = params["application"]
7
+ port = params["port"]
8
+ docker_server_name = get_docker_server_name
9
+ docker_host_name = get_docker_host_name
10
+
11
+ BrpmAuto.log "Creating a BRPM instance named '#{instance_name}' on port #{port} (docker host = #{docker_host_name})..."
12
+ BrpmAuto.log ""
13
+ BrpmAuto.log ""
14
+
15
+ BrpmAuto.log "Creating the environment ..."
16
+ environment = brpm_rest_client.create_environment(instance_name)
17
+
18
+ BrpmAuto.log "Linking the environment to the docker host ..."
19
+ brpm_rest_client.link_environment_to_server(environment["id"], docker_server_name)
20
+
21
+ BrpmAuto.log "Linking the environment to the app ..."
22
+ brpm_rest_client.link_environment_to_app(environment["id"], app_name)
23
+
24
+ BrpmAuto.log "Creating the installed component for Utilities ..."
25
+ brpm_rest_client.create_installed_component("Database", "", instance_name, app_name, docker_server_name)
26
+
27
+ BrpmAuto.log "Creating the database ..."
28
+ run_docker_command("run --rm -e OVERWRITE_EXISTING_DATA=0 -v /home/ubuntu/docker_data/brpm_db_#{instance_name}:/data --name brpm_db_init_#{instance_name} bmc_devops/brpm_db_init:v4.3.01.06")
29
+
30
+ BrpmAuto.log "Creating the installed component for DatabaseCreator ..."
31
+ brpm_rest_client.create_installed_component("DatabaseCreator", "4.3.01.06", instance_name, app_name, docker_server_name)
32
+
33
+ BrpmAuto.log "Running the database container ..."
34
+ run_docker_command("run -d --restart=always -v /home/ubuntu/docker_data/brpm_db_#{instance_name}:/var/lib/pgsql/data --name brpm_db_#{instance_name} bmc_devops/brpm_db:v1.0.0")
35
+
36
+ BrpmAuto.log "Creating the installed component for Database ..."
37
+ brpm_rest_client.create_installed_component("Database", "1.0.0", instance_name, app_name, docker_server_name)
38
+
39
+ BrpmAuto.log "Upgrading the database ..."
40
+ run_docker_command("run --rm --link brpm_db_#{instance_name}:db bmc_devops/brpm:v#{application_version} /source-files/upgradedatabase.sh")
41
+
42
+ BrpmAuto.log "Running the application container ..."
43
+ run_docker_command("run -d --restart=always -p #{port}:8080 --link brpm_db_#{instance_name}:db --name brpm_#{instance_name} bmc_devops/brpm:v#{application_version}")
44
+
45
+ BrpmAuto.log "Creating the installed component for Application ..."
46
+ installed_component=brpm_rest_client.create_installed_component("Application", application_version, instance_name, app_name, docker_server_name)
47
+
48
+ BrpmAuto.log "Setting the port for Application ..."
49
+ brpm_rest_client.set_property_of_installed_component(installed_component["id"], "port", port)
50
+
51
+ BrpmAuto.log "Finished"
52
+ BrpmAuto.log ""
53
+ BrpmAuto.log "You can now access the newly created instance on http://#{docker_host_name}:#{port}/brpm"
54
+ BrpmAuto.log ""
55
+ BrpmAuto.log ""
56
+
57
+ BrpmAuto.log "Currently running containers:"
58
+ run_docker_command("ps")
59
+
60
+