brpm_content 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +38 -0
- data/.travis.yml +14 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +308 -0
- data/Rakefile +24 -0
- data/TO_BE_MIGRATED.txt +8 -0
- data/architecture.png +0 -0
- data/brpm_content.gemspec +31 -0
- data/customers/demo/integrations/brpm/process_event_handler_event.rb +183 -0
- data/customers/demo/integrations/jenkins/spec/api/applications_spec.rb +89 -0
- data/customers/demo/integrations/jenkins/spec/api/plans_spec.rb +69 -0
- data/customers/demo/integrations/jenkins/spec/api/requests_spec.rb +57 -0
- data/customers/demo/integrations/jenkins/spec/spec_helper.rb +33 -0
- data/customers/demo/integrations/jira/process_webhook_event.rb +33 -0
- data/customers/demo/jira_mappings.rb +29 -0
- data/infrastructure/integrations/event_handler.rb +62 -0
- data/infrastructure/integrations/webhook_receiver.rb +49 -0
- data/infrastructure/shell_scripts/backup_database.sh +19 -0
- data/infrastructure/shell_scripts/create_bl_package.sh +34 -0
- data/infrastructure/shell_scripts/create_release_request.sh +34 -0
- data/infrastructure/shell_scripts/ddns.sh +10 -0
- data/infrastructure/shell_scripts/install_brpm.sh +63 -0
- data/infrastructure/shell_scripts/install_content_module.sh +66 -0
- data/infrastructure/shell_scripts/install_content_repo.sh +60 -0
- data/infrastructure/shell_scripts/install_module_from_gem.sh +80 -0
- data/infrastructure/shell_scripts/maintenance.sh +4 -0
- data/infrastructure/shell_scripts/patch_brpm.sh +90 -0
- data/infrastructure/shell_scripts/restore_database.sh +33 -0
- data/infrastructure/shell_scripts/run_event_handler.cmd +16 -0
- data/infrastructure/shell_scripts/run_event_handler.sh +20 -0
- data/infrastructure/shell_scripts/run_webhook_receiver.cmd +14 -0
- data/infrastructure/shell_scripts/run_webhook_receiver.sh +15 -0
- data/infrastructure/shell_scripts/update_content_repo.sh +21 -0
- data/infrastructure/silent_install_options_4.6.txt +93 -0
- data/infrastructure/silent_install_options_upgrade_4.6.txt +92 -0
- data/infrastructure/smtp_settings.rb +42 -0
- data/infrastructure/ssh_script_header_additions.rb +21 -0
- data/modules/ansible/automations/execute_role.rb +3 -0
- data/modules/ansible/automations/execute_role.txt +12 -0
- data/modules/ansible/config.yml +5 -0
- data/modules/ansible/lib/ansible.rb +41 -0
- data/modules/atrium_orchestrator/automations/execute_workflow.rb +12 -0
- data/modules/atrium_orchestrator/automations/execute_workflow.txt +25 -0
- data/modules/atrium_orchestrator/automations/reserve_ip_address.rb +22 -0
- data/modules/atrium_orchestrator/automations/reserve_ip_address.txt +21 -0
- data/modules/atrium_orchestrator/config.yml +7 -0
- data/modules/atrium_orchestrator/lib/ao_soap_client.rb +94 -0
- data/modules/bladelogic/automations/create_package.rb +29 -0
- data/modules/bladelogic/automations/create_package.txt +26 -0
- data/modules/bladelogic/automations/deploy_package.rb +137 -0
- data/modules/bladelogic/automations/deploy_package.txt +53 -0
- data/modules/bladelogic/config.yml +7 -0
- data/modules/bladelogic/lib/bl_rest/bsa_rest_client.rb +65 -0
- data/modules/bladelogic/lib/bl_soap/blpackage.rb +43 -0
- data/modules/bladelogic/lib/bl_soap/bsa_soap_base.rb +118 -0
- data/modules/bladelogic/lib/bl_soap/bsa_soap_client.rb +34 -0
- data/modules/bladelogic/lib/bl_soap/compliance_job.rb +155 -0
- data/modules/bladelogic/lib/bl_soap/deploy_job.rb +48 -0
- data/modules/bladelogic/lib/bl_soap/depot_group.rb +47 -0
- data/modules/bladelogic/lib/bl_soap/job.rb +376 -0
- data/modules/bladelogic/lib/bl_soap/job_group.rb +72 -0
- data/modules/bladelogic/lib/bl_soap/job_management.rb +22 -0
- data/modules/bladelogic/lib/bl_soap/job_result.rb +12 -0
- data/modules/bladelogic/lib/bl_soap/job_run.rb +271 -0
- data/modules/bladelogic/lib/bl_soap/login.rb +47 -0
- data/modules/bladelogic/lib/bl_soap/nsh_script_job.rb +14 -0
- data/modules/bladelogic/lib/bl_soap/patch_catalog.rb +178 -0
- data/modules/bladelogic/lib/bl_soap/patch_remediation_job.rb +137 -0
- data/modules/bladelogic/lib/bl_soap/patching_job.rb +250 -0
- data/modules/bladelogic/lib/bl_soap/server.rb +12 -0
- data/modules/bladelogic/lib/bl_soap/template.rb +13 -0
- data/modules/bladelogic/lib/bl_soap/utility.rb +99 -0
- data/modules/bladelogic/resource_automations/select_job.rb +33 -0
- data/modules/bladelogic/resource_automations/select_job.txt +15 -0
- data/modules/bladelogic/tests/create_package_spec.rb +28 -0
- data/modules/bladelogic/tests/deploy_package_spec.rb +23 -0
- data/modules/bladelogic/tests/spec_helper.rb +82 -0
- data/modules/brpm/automations/create_release_from_excel.rb +34 -0
- data/modules/brpm/automations/create_release_from_excel.txt +5 -0
- data/modules/brpm/automations/create_release_request.rb +100 -0
- data/modules/brpm/automations/create_release_request.txt +5 -0
- data/modules/brpm/automations/create_request.rb +73 -0
- data/modules/brpm/automations/create_request.txt +23 -0
- data/modules/brpm/automations/promote_request.rb +197 -0
- data/modules/brpm/automations/promote_request.txt +24 -0
- data/modules/brpm/automations/select_application_version.rb +22 -0
- data/modules/brpm/automations/select_application_version.txt +17 -0
- data/modules/brpm/automations/select_component_version.rb +12 -0
- data/modules/brpm/automations/select_component_version.txt +5 -0
- data/modules/brpm/automations/select_request_template.rb +6 -0
- data/modules/brpm/automations/select_request_template.txt +13 -0
- data/modules/brpm/automations/wait_for_step_in_other_request.rb +11 -0
- data/modules/brpm/automations/wait_for_step_in_other_request.txt +13 -0
- data/modules/brpm/automations/wait_till_promoted_request_is_completed.rb +9 -0
- data/modules/brpm/automations/wait_till_promoted_request_is_completed.txt +5 -0
- data/modules/brpm/config.yml +6 -0
- data/modules/brpm/lib/brpm_request.rb +207 -0
- data/modules/brpm/lib/brpm_rest.rb +312 -0
- data/modules/brpm/lib/brpm_rest_client.rb +1501 -0
- data/modules/brpm/resource_automations/select_application.rb +16 -0
- data/modules/brpm/resource_automations/select_application.txt +5 -0
- data/modules/brpm/resource_automations/select_environment.rb +14 -0
- data/modules/brpm/resource_automations/select_environment.txt +5 -0
- data/modules/brpm/resource_automations/select_request_template.rb +16 -0
- data/modules/brpm/resource_automations/select_request_template.txt +5 -0
- data/modules/brpm/resource_automations/select_step_in_request.rb +33 -0
- data/modules/brpm/resource_automations/select_step_in_request.txt +5 -0
- data/modules/brpm/sample_applications/e-finance.json +0 -0
- data/modules/brpm/tests/create_release_request_spec.rb +66 -0
- data/modules/brpm/tests/create_request_spec.rb +84 -0
- data/modules/brpm/tests/select_application_version_spec.rb +47 -0
- data/modules/brpm/tests/spec_helper.rb +63 -0
- data/modules/docker_brpm/automations/create_brpm_instance_input_params.rb +10 -0
- data/modules/docker_brpm/automations/create_brpm_instance_input_params.txt +17 -0
- data/modules/docker_brpm/automations/create_brpm_instance_one_shot.rb +60 -0
- data/modules/docker_brpm/automations/create_brpm_instance_one_shot.txt +14 -0
- data/modules/docker_brpm/automations/create_brpm_instance_show_results.rb +23 -0
- data/modules/docker_brpm/automations/create_brpm_instance_show_results.txt +13 -0
- data/modules/docker_brpm/automations/create_database.rb +24 -0
- data/modules/docker_brpm/automations/create_database.txt +3 -0
- data/modules/docker_brpm/automations/create_environment.rb +14 -0
- data/modules/docker_brpm/automations/create_environment.txt +3 -0
- data/modules/docker_brpm/automations/create_image_for_application.rb +23 -0
- data/modules/docker_brpm/automations/create_image_for_application.txt +6 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.rb +7 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.txt +8 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.rb +7 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.txt +8 -0
- data/modules/docker_brpm/automations/create_image_for_database_creator.rb +21 -0
- data/modules/docker_brpm/automations/create_image_for_database_creator.txt +6 -0
- data/modules/docker_brpm/automations/create_installed_component_for_application.rb +11 -0
- data/modules/docker_brpm/automations/create_installed_component_for_application.txt +3 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database.rb +7 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database.txt +3 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database_creator.rb +8 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database_creator.txt +3 -0
- data/modules/docker_brpm/automations/create_installed_component_for_utilities.rb +7 -0
- data/modules/docker_brpm/automations/create_installed_component_for_utilities.txt +3 -0
- data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.rb +13 -0
- data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.txt +6 -0
- data/modules/docker_brpm/automations/delete_brpm_instance.rb +38 -0
- data/modules/docker_brpm/automations/delete_brpm_instance.txt +8 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins.rb +43 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins.txt +13 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.rb +5 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.txt +9 -0
- data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.rb +27 -0
- data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.txt +3 -0
- data/modules/docker_brpm/automations/launch_test_run_request.rb +30 -0
- data/modules/docker_brpm/automations/launch_test_run_request.txt +14 -0
- data/modules/docker_brpm/automations/release_brpm_input_params.rb +7 -0
- data/modules/docker_brpm/automations/release_brpm_input_params.txt +8 -0
- data/modules/docker_brpm/automations/run_application_container.rb +27 -0
- data/modules/docker_brpm/automations/run_application_container.txt +3 -0
- data/modules/docker_brpm/automations/run_database_container.rb +14 -0
- data/modules/docker_brpm/automations/run_database_container.txt +3 -0
- data/modules/docker_brpm/automations/stop_application_container.rb +11 -0
- data/modules/docker_brpm/automations/stop_application_container.txt +3 -0
- data/modules/docker_brpm/automations/stop_database_container.rb +11 -0
- data/modules/docker_brpm/automations/stop_database_container.txt +3 -0
- data/modules/docker_brpm/automations/test_rest_api.rb +18 -0
- data/modules/docker_brpm/automations/test_rest_api.txt +3 -0
- data/modules/docker_brpm/automations/upgrade_database.rb +19 -0
- data/modules/docker_brpm/automations/upgrade_database.txt +8 -0
- data/modules/docker_brpm/config.yml +8 -0
- data/modules/docker_brpm/lib/docker.rb +39 -0
- data/modules/docker_brpm/lib/git.rb +16 -0
- data/modules/docker_brpm/sample_applications/dockerizedbrpm.json +0 -0
- data/modules/email/automations/send_notification.rb +48 -0
- data/modules/email/automations/send_notification.txt +27 -0
- data/modules/email/config.yml +6 -0
- data/modules/framework/automations/direct_execute.rb +10 -0
- data/modules/framework/automations/direct_execute.txt +16 -0
- data/modules/framework/automations/install_module.rb +13 -0
- data/modules/framework/automations/install_module.txt +16 -0
- data/modules/framework/bin/brpm_install +106 -0
- data/modules/framework/bin/event_handler +63 -0
- data/modules/framework/bin/webhook_receiver +49 -0
- data/modules/framework/brpm_auto.rb +307 -0
- data/modules/framework/brpm_framework.rb +88 -0
- data/modules/framework/brpm_script_executor.rb +146 -0
- data/modules/framework/config.yml +7 -0
- data/modules/framework/config/customer_include.rb +26 -0
- data/modules/framework/config/server.yml +3 -0
- data/modules/framework/customer_include_default.rb +25 -0
- data/modules/framework/lib/logging/brpm_logger.rb +39 -0
- data/modules/framework/lib/logging/logger_base.rb +36 -0
- data/modules/framework/lib/logging/simple_logger.rb +27 -0
- data/modules/framework/lib/params/all_params.rb +80 -0
- data/modules/framework/lib/params/integration_settings.rb +27 -0
- data/modules/framework/lib/params/params.rb +172 -0
- data/modules/framework/lib/params/params_base.rb +81 -0
- data/modules/framework/lib/params/request_params.rb +38 -0
- data/modules/framework/lib/resource_framework.rb +211 -0
- data/modules/framework/lib/rest_api.rb +155 -0
- data/modules/framework/lib/semaphore.rb +79 -0
- data/modules/framework/lib/utilities.rb +317 -0
- data/modules/framework/lib/version_control/git.rb +192 -0
- data/modules/framework/lib/version_control/svn.rb +221 -0
- data/modules/framework/log.html +39 -0
- data/modules/framework/tests/all_params_spec.rb +116 -0
- data/modules/framework/tests/brpm_auto_spec.rb +84 -0
- data/modules/framework/tests/customer_include/config/customer_include.rb +10 -0
- data/modules/framework/tests/customer_include/config/server.yml +3 -0
- data/modules/framework/tests/customer_include_spec.rb +29 -0
- data/modules/framework/tests/local_jirb.rb +15 -0
- data/modules/framework/tests/params_spec.rb +172 -0
- data/modules/framework/tests/request_params_spec.rb +86 -0
- data/modules/framework/tests/server_yaml_spec.rb +19 -0
- data/modules/framework/tests/spec_helper.rb +42 -0
- data/modules/framework/transport/dispatch_baa.rb +355 -0
- data/modules/framework/transport/dispatch_base.rb +345 -0
- data/modules/framework/transport/dispatch_nsh.rb +248 -0
- data/modules/framework/transport/dispatch_ssh.rb +154 -0
- data/modules/framework/transport/transport_baa.rb +1095 -0
- data/modules/framework/transport/transport_nsh.rb +359 -0
- data/modules/framework/transport/transport_ssh.rb +220 -0
- data/modules/framework/write_to.rb +1 -0
- data/modules/jenkins/automations/create_release.rb +4 -0
- data/modules/jenkins/automations/create_release.txt +23 -0
- data/modules/jenkins/automations/f2_downloadJenkinsArtifact.rb +126 -0
- data/modules/jenkins/config.yml +7 -0
- data/modules/jenkins/lib/jenkins.rb +300 -0
- data/modules/jenkins/resource_automations/f2_rsc_jenkinsJobs.rb +58 -0
- data/modules/jira/automations/add_comment.rb +4 -0
- data/modules/jira/automations/add_comment.txt +23 -0
- data/modules/jira/automations/create_release.rb +4 -0
- data/modules/jira/automations/create_release.txt +23 -0
- data/modules/jira/automations/delete_release.rb +4 -0
- data/modules/jira/automations/delete_release.txt +23 -0
- data/modules/jira/automations/transition_issue.rb +4 -0
- data/modules/jira/automations/transition_issue.txt +23 -0
- data/modules/jira/automations/transition_issues_for_request.rb +29 -0
- data/modules/jira/automations/transition_issues_for_request.txt +20 -0
- data/modules/jira/automations/transition_issues_for_run.rb +26 -0
- data/modules/jira/automations/transition_issues_for_run.txt +20 -0
- data/modules/jira/automations/update_release.rb +4 -0
- data/modules/jira/automations/update_release.txt +26 -0
- data/modules/jira/config.yml +7 -0
- data/modules/jira/lib/jira_rest_client.rb +185 -0
- data/modules/jira/tests/create_read_update_delete_release_spec.rb +39 -0
- data/modules/jira/tests/spec_helper.rb +39 -0
- data/modules/jira/tests/transition_issue_spec.rb +32 -0
- data/modules/patch_process_management/automations/execute_job/script.rb +105 -0
- data/modules/patch_process_management/automations/execute_job/wrapper.txt +39 -0
- data/modules/patch_process_management/automations/patch_analysis/script.rb +107 -0
- data/modules/patch_process_management/automations/patch_analysis/wrapper.txt +33 -0
- data/modules/patch_process_management/automations/patch_readiness/script.rb +89 -0
- data/modules/patch_process_management/automations/patch_readiness/wrapper.txt +33 -0
- data/modules/patch_process_management/automations/patch_remediation/script.rb +217 -0
- data/modules/patch_process_management/automations/patch_remediation/wrapper.txt +40 -0
- data/modules/patch_process_management/config.yml +10 -0
- data/modules/teamcity/automations/trigger_build.rb +4 -0
- data/modules/teamcity/automations/trigger_build.txt +14 -0
- data/modules/teamcity/config.yml +7 -0
- data/modules/teamcity/lib/teamcity_rest_client.rb +17 -0
- data/modules/teamcity/tests/spec_helper.rb +34 -0
- data/modules/teamcity/tests/trigger_build_spec.rb +27 -0
- data/modules/windows/automations/deploy_directory_over_windows_shares/script.rb +87 -0
- data/modules/windows/automations/deploy_directory_over_windows_shares/wrapper.txt +29 -0
- data/modules/windows/automations/deploy_file_over_windows_shares/script.rb +31 -0
- data/modules/windows/automations/deploy_file_over_windows_shares/wrapper.txt +24 -0
- data/modules/windows/config.yml +6 -0
- data/modules/windows/lib/samba.rb +29 -0
- metadata +397 -0
@@ -0,0 +1,14 @@
|
|
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
|
+
###
|
12
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
13
|
+
|
14
|
+
BrpmScriptExecutor.execute_automation_script("docker_brpm", "create_brpm_instance_one_shot", params)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
request_params = BrpmAuto.request_params
|
2
|
+
|
3
|
+
pack_response "url", "http://#{get_docker_host_name}:#{request_params["port"]}/brpm"
|
4
|
+
|
5
|
+
table_data = []
|
6
|
+
|
7
|
+
output = run_docker_command("ps -q")
|
8
|
+
|
9
|
+
BrpmAuto.log output
|
10
|
+
|
11
|
+
containers = output.split("\n")
|
12
|
+
|
13
|
+
table_data << ["?", "ID", "Name", "Created"]
|
14
|
+
containers.each do |container_id|
|
15
|
+
container_id = run_docker_command("inspect --format='{{.Id}}' #{container_id}").strip
|
16
|
+
container_name = run_docker_command("inspect --format='{{.Name}}' #{container_id}").strip
|
17
|
+
container_creation_date = run_docker_command("inspect --format='{{.Created}}' #{container_id}").strip
|
18
|
+
table_data << ["?", container_id[0,10], container_name, container_creation_date]
|
19
|
+
end
|
20
|
+
|
21
|
+
pack_response "docker_containers", {:totalItems => containers.length, :perPage => '10', :data => table_data}
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
###
|
2
|
+
# docker_containers:
|
3
|
+
# name: docker_containers
|
4
|
+
# type: out-table
|
5
|
+
# position: A1:C1
|
6
|
+
# url:
|
7
|
+
# name: url
|
8
|
+
# type: out-text
|
9
|
+
# position: A2:C2
|
10
|
+
###
|
11
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
12
|
+
|
13
|
+
BrpmScriptExecutor.execute_automation_script("docker_brpm", "create_brpm_instance_show_results", params)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
params = BrpmAuto.params
|
2
|
+
request_params = BrpmAuto.request_params
|
3
|
+
|
4
|
+
if request_params.has_key?("instance_name")
|
5
|
+
environment = request_params["instance_name"]
|
6
|
+
else
|
7
|
+
environment = params["SS_environment"]
|
8
|
+
end
|
9
|
+
|
10
|
+
if params.has_key?("overwrite_existing_data") && !params["overwrite_existing_data"].nil?
|
11
|
+
overwrite_existing_data = params["overwrite_existing_data"]
|
12
|
+
elsif request_params.has_key?("overwrite_existing_data")
|
13
|
+
overwrite_existing_data = request_params["overwrite_existing_data"]
|
14
|
+
else
|
15
|
+
overwrite_existing_data = "0"
|
16
|
+
end
|
17
|
+
|
18
|
+
BrpmAuto.log "Stopping dependent docker containers if necessary ..."
|
19
|
+
stop_running_containers_if_necessary(["/brpm_#{environment}", "/brpm_db_#{environment}"])
|
20
|
+
|
21
|
+
BrpmAuto.log "Creating the database ..."
|
22
|
+
run_docker_command("run --rm -e OVERWRITE_EXISTING_DATA=#{overwrite_existing_data} -v /home/ubuntu/docker_data/brpm_db_#{environment}:/data --name brpm_db_init_#{environment} bmc_devops/brpm_db_init:v4.3.01.06")
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
request_params = BrpmAuto.request_params
|
4
|
+
|
5
|
+
BrpmAuto.log "Creating the environment ..."
|
6
|
+
environment = brpm_rest_client.create_environment(request_params["instance_name"])
|
7
|
+
|
8
|
+
BrpmAuto.log "Linking the environment to the docker host ..."
|
9
|
+
brpm_rest_client.link_environment_to_server(environment["id"], get_docker_server_name())
|
10
|
+
|
11
|
+
BrpmAuto.log "Linking the environment to the app ..."
|
12
|
+
brpm_rest_client.link_environment_to_app(environment["id"], params["application"])
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
params = BrpmAuto.params
|
4
|
+
request_params = BrpmAuto.request_params
|
5
|
+
|
6
|
+
application_version = request_params["application_version"]
|
7
|
+
|
8
|
+
docker_workspace = clone_git_repo("docker_brpm", params["SS_output_dir"])
|
9
|
+
|
10
|
+
FileUtils.copy("/software-repo/DockerizedBRPM/Application/#{application_version}/brpm.war", "#{docker_workspace}/source-files/")
|
11
|
+
|
12
|
+
BrpmAuto.log "Setting the version number to #{application_version} in the Dockerfile ..."
|
13
|
+
|
14
|
+
dockerfile_location = "#{docker_workspace}/Dockerfile"
|
15
|
+
dockerfile_content = File.read(dockerfile_location)
|
16
|
+
dockerfile_content.sub!(/ENV BRPM_VERSION .*/, "ENV BRPM_VERSION #{application_version}")
|
17
|
+
|
18
|
+
File.open(dockerfile_location, "w") do |file|
|
19
|
+
file << dockerfile_content
|
20
|
+
end
|
21
|
+
|
22
|
+
BrpmAuto.log "Creating the image ..."
|
23
|
+
run_docker_command("build --rm -t bmc_devops/brpm:v#{application_version} #{docker_workspace}")
|
@@ -0,0 +1,8 @@
|
|
1
|
+
###
|
2
|
+
# brpm_version:
|
3
|
+
# name: brpm_version
|
4
|
+
# required: no
|
5
|
+
###
|
6
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
7
|
+
|
8
|
+
BrpmScriptExecutor.execute_automation_script("docker_brpm", "create_image_for_brpm_application_input_params", params)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
###
|
2
|
+
# brpm_version:
|
3
|
+
# name: brpm_version
|
4
|
+
# required: no
|
5
|
+
###
|
6
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
7
|
+
|
8
|
+
BrpmScriptExecutor.execute_automation_script("docker_brpm", "create_image_for_brpm_database_creator_input_params", params)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
params = BrpmAuto.params
|
4
|
+
request_params = BrpmAuto.request_params
|
5
|
+
|
6
|
+
application_version = request_params["application_version"]
|
7
|
+
|
8
|
+
docker_workspace = clone_git_repo("docker_brpm_db_init", params["SS_output_dir"])
|
9
|
+
|
10
|
+
BrpmAuto.log "Setting the the base image to bmc_devops/brpm:v#{application_version} in the Dockerfile ..."
|
11
|
+
|
12
|
+
dockerfile_location = "#{docker_workspace}/Dockerfile"
|
13
|
+
dockerfile_content = File.read(dockerfile_location)
|
14
|
+
dockerfile_content.sub!(/FROM .*/, "FROM bmc_devops/brpm:v#{application_version}")
|
15
|
+
|
16
|
+
File.open(dockerfile_location, "w") do |file|
|
17
|
+
file << dockerfile_content
|
18
|
+
end
|
19
|
+
|
20
|
+
BrpmAuto.log "Creating the image ..."
|
21
|
+
run_docker_command("build --rm -t bmc_devops/brpm_db_init:v#{application_version} #{docker_workspace}")
|
@@ -0,0 +1,11 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
request_params = BrpmAuto.request_params
|
4
|
+
|
5
|
+
BrpmAuto.log "Creating the installed component for Application ..."
|
6
|
+
installed_component=brpm_rest_client.create_installed_component("Application", request_params["application_version"], request_params["instance_name"], params["application"], get_docker_server_name())
|
7
|
+
|
8
|
+
BrpmAuto.log "Setting the port for Application ..."
|
9
|
+
brpm_rest_client.set_property_of_installed_component(installed_component["id"], "port", request_params["port"])
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
request_params = BrpmAuto.request_params
|
4
|
+
|
5
|
+
BrpmAuto.log "Creating the installed component for DatabaseCreator ..."
|
6
|
+
installed_component=brpm_rest_client.create_installed_component("DatabaseCreator", "4.3.01.06", request_params["instance_name"], params["application"], get_docker_server_name())
|
7
|
+
|
8
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
request_params = BrpmAuto.request_params
|
4
|
+
|
5
|
+
installed_component=brpm_rest_client.create_installed_component("Application", "", request_params["instance_name"], params["application"], get_docker_server_name())
|
6
|
+
|
7
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
request_params = BrpmAuto.request_params
|
4
|
+
|
5
|
+
BrpmAuto.log "Getting all environments of application #{params["application"]} ..."
|
6
|
+
environments = brpm_rest_client.get_environments_of_application(params["application"])
|
7
|
+
|
8
|
+
environments.each do |environment|
|
9
|
+
BrpmAuto.log "Creating the version tag for version #{request_params["application_version"]} of application #{params["application"]} and component #{params["component"]} in environment #{environment["name"]} ..."
|
10
|
+
environment = brpm_rest_client.create_version_tag(params["application"], params["component"], environment["name"], request_params["application_version"])
|
11
|
+
end
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
|
4
|
+
BrpmAuto.log "Deleting BRPM instance named '#{params["instance_name"]}' (docker host = #{get_docker_host_name()})..."
|
5
|
+
BrpmAuto.log ""
|
6
|
+
BrpmAuto.log ""
|
7
|
+
|
8
|
+
BrpmAuto.log "Unlinking the environment from the app ..."
|
9
|
+
brpm_rest_client.unlink_environment_from_app(params["instance_name"], params["application"])
|
10
|
+
|
11
|
+
BrpmAuto.log "Unlinking the environment from the server ..."
|
12
|
+
brpm_rest_client.unlink_environment_from_server(params["instance_name"], get_docker_server_name())
|
13
|
+
|
14
|
+
BrpmAuto.log "Deleting the environment ..."
|
15
|
+
brpm_rest_client.delete_environment(params["instance_name"])
|
16
|
+
|
17
|
+
BrpmAuto.log "Stopping the application container ..."
|
18
|
+
run_docker_command_and_ignore_error("stop brpm_#{params["instance_name"]}")
|
19
|
+
|
20
|
+
BrpmAuto.log "Deleting the application container ..."
|
21
|
+
run_docker_command_and_ignore_error("rm brpm_#{params["instance_name"]}")
|
22
|
+
|
23
|
+
BrpmAuto.log "Stopping the database container ..."
|
24
|
+
run_docker_command_and_ignore_error("stop brpm_db_#{params["instance_name"]}")
|
25
|
+
|
26
|
+
BrpmAuto.log "Deleting the database container ..."
|
27
|
+
run_docker_command_and_ignore_error("rm brpm_db_#{params["instance_name"]}")
|
28
|
+
|
29
|
+
BrpmAuto.log "The data directory located at /home/ubuntu/docker_data/brpm_db_#{params["instance_name"]} must be deleted manually."
|
30
|
+
|
31
|
+
BrpmAuto.log "Finished"
|
32
|
+
BrpmAuto.log ""
|
33
|
+
BrpmAuto.log ""
|
34
|
+
|
35
|
+
BrpmAuto.log "Currently running containers:"
|
36
|
+
run_docker_command("ps")
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
###
|
2
|
+
# instance_name:
|
3
|
+
# name: instance_name
|
4
|
+
# required: yes
|
5
|
+
###
|
6
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
7
|
+
|
8
|
+
BrpmScriptExecutor.execute_automation_script("docker/delete_brpm_instance", params)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
params = BrpmAuto.params
|
2
|
+
request_params = BrpmAuto.request_params
|
3
|
+
|
4
|
+
jenkins_username = params["SS_integration_username"]
|
5
|
+
jenkins_password = decrypt_string_with_prefix(params["SS_integration_password_enc"])
|
6
|
+
|
7
|
+
jenkins_host = params["SS_integration_dns"].sub("://", "://#{jenkins_username}:#{jenkins_password}@")
|
8
|
+
jenkins_job = "DockerizedBRPM_#{request_params["jenkins_job"]}"
|
9
|
+
|
10
|
+
result = Rest.get "#{jenkins_host}/job/#{jenkins_job}/api/json"
|
11
|
+
build_number = result["response"]["nextBuildNumber"]
|
12
|
+
|
13
|
+
# TODO: find out why passing the parameters as a json structure in the body doesn't work
|
14
|
+
job_params = []
|
15
|
+
job_params << { :name => "BRPM_HOST", :value => get_docker_host_name }
|
16
|
+
job_params << { :name => "BRPM_PORT", :value => params["port"] }
|
17
|
+
job_params << { :name => "BRPM_API_TOKEN", :value => params["api_token"] }
|
18
|
+
|
19
|
+
# TODO: make the rest client work with the username/password as specified in the options (right now the username/password are taken from the jenkins url)
|
20
|
+
options = {}
|
21
|
+
options["username"] = jenkins_username
|
22
|
+
options["password"] = jenkins_password
|
23
|
+
|
24
|
+
jenkins_test_rest_api_url = "#{jenkins_host}/job/#{jenkins_job}/buildWithParameters?BRPM_HOST=#{get_docker_host_name}&BRPM_PORT=#{params["port"]}&BRPM_API_TOKEN=#{params["api_token"]}"
|
25
|
+
|
26
|
+
BrpmAuto.log "Triggering jenkins to execute the tests ..."
|
27
|
+
Rest.post jenkins_test_rest_api_url, { :parameter => job_params }, options
|
28
|
+
|
29
|
+
raise("build_number not received") if build_number.nil?
|
30
|
+
|
31
|
+
jenkins_build_status_url = "#{jenkins_host}/job/#{jenkins_job}/#{build_number}/api/json"
|
32
|
+
|
33
|
+
build_result = nil
|
34
|
+
while build_result.nil?
|
35
|
+
sleep(15)
|
36
|
+
|
37
|
+
result = Rest.get jenkins_build_status_url
|
38
|
+
build_result = result["response"]["result"]
|
39
|
+
end
|
40
|
+
|
41
|
+
raise("Error monitoring jenkins build #{jenkins_build_status_url}: #{build_result}") unless build_result == "SUCCESS"
|
42
|
+
|
43
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
#=== Hudson/Jenkins Integration Server: Jenkins ===#
|
3
|
+
# [integration_id=5]
|
4
|
+
#=== End ===#
|
5
|
+
|
6
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
7
|
+
|
8
|
+
params["SS_integration_dns"] = SS_hudson_dns
|
9
|
+
params["SS_integration_username"] = SS_hudson_username
|
10
|
+
params["SS_integration_password_enc"] = SS_hudson_password_enc
|
11
|
+
params["SS_integration_details"] = YAML.load(SS_hudson_details)
|
12
|
+
|
13
|
+
BrpmScriptExecutor.execute_automation_script("docker_brpm", "execute_test_run_in_jenkins", params)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
###
|
2
|
+
# test_results_url:
|
3
|
+
# name: test_results_url
|
4
|
+
# type: out-text
|
5
|
+
# position: A1:F1
|
6
|
+
###
|
7
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
8
|
+
|
9
|
+
BrpmScriptExecutor.execute_automation_script("docker_brpm", "test_rest_api_show_results", params)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
brpm_rest_client = BrpmRestClient.new
|
2
|
+
params = BrpmAuto.params
|
3
|
+
request_params = BrpmAuto.request_params
|
4
|
+
|
5
|
+
new_request_params = {}
|
6
|
+
new_request_params["calling_request"] = params["SS_request_number"]
|
7
|
+
new_request_params["application_version"] = request_params["application_version"]
|
8
|
+
|
9
|
+
BrpmAuto.log "Creating a new request from template 'Create image for BRPM' for BRPM v#{request_params["application_version"]} ..."
|
10
|
+
new_request = brpm_rest_client.create_request_for_plan_from_template(
|
11
|
+
params["request_plan_id"].to_i,
|
12
|
+
"Packaging",
|
13
|
+
"Create image for BRPM",
|
14
|
+
"Create image for BRPM v#{request_params["application_version"]}",
|
15
|
+
"[default]",
|
16
|
+
false, #execute_now
|
17
|
+
new_request_params
|
18
|
+
)
|
19
|
+
|
20
|
+
BrpmAuto.log "Planning the request ... "
|
21
|
+
brpm_rest_client.plan_request(new_request["id"])
|
22
|
+
|
23
|
+
BrpmAuto.log "Starting the request ... "
|
24
|
+
brpm_rest_client.start_request(new_request["id"])
|
25
|
+
|
26
|
+
BrpmAuto.log "Waiting until the request has finished ..."
|
27
|
+
brpm_rest_client.monitor_request(new_request["id"], { :max_time => params["max_time"], :checking_interval => params["checking_interval"] })
|