brpm_content_framework 0.2.48 → 0.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +34 -3
- data/config.yml +1 -1
- data/infrastructure/config/server.yml +3 -1
- data/infrastructure/scripts/restore_database.sh +1 -1
- data/infrastructure/silent_install_options_upgrade_4.6.txt +12 -5
- data/lib/brpm_script_executor.rb +8 -1
- data/tests/brpm_script_executor_spec.rb +12 -3
- data/tests/customer_include/config/server.yml +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTk5NDdmY2U5MTJhYTk2NjFiMzUxZTI4MDliYzRkYTlhMjE5Y2IyZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjBlMGVmODM4YmFiNThkYmRlNDM4OTc4NDgxN2Q0ZmRlYWY2MGE3OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmNmZjRmZmVhNjYwOTAzZjIxZTc3NmEzYTNkOGFlZDI4ZWVhODhiMjZkYzBk
|
10
|
+
ODMwNWU0NWFkNTUxMDkxMzEzNTU5Y2M3NTViNmEyYTViMGQwN2JmNTc5ODg2
|
11
|
+
YmIyOTIxN2VhNzQ2OWQ4NDcyYzY5YTViNTQ0ZmEzNmE1M2RiYjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2JhNmQ0OWY0NTY1MWZhZTg5NGQ2Yjc3MzM5YmQ2NzM4OWYwYTMwMmEwNWEw
|
14
|
+
ZTA4NjFiMzY3MmNlMzczZDUxNjVhNDdmMGM2NWI5OGM4MmE4MzU4M2U2ZWRm
|
15
|
+
Yjg3MjY2OTM5OTE0OGNiMjZiMzdhMGY1ZmU5ZTFjMTAwZTUwZmQ=
|
data/README.md
CHANGED
@@ -11,9 +11,10 @@ It is designed around a number of core concepts like modularity, re-usability, t
|
|
11
11
|
## Getting started
|
12
12
|
|
13
13
|
### Installation
|
14
|
+
By default the automation scripts will be executed by the jruby interpreter that is included with the BRPM install. See the end of this section if you want to use a custom ruby interpreter instead.
|
14
15
|
|
15
16
|
#### environment variables
|
16
|
-
First of all, make sure that the necessary environment variables are set
|
17
|
+
First of all, make sure that the necessary environment variables are set, e.g. for a default BRPM installation:
|
17
18
|
```shell
|
18
19
|
export BRPM_HOME=/opt/bmc/RLM
|
19
20
|
export JAVA_HOME="$BRPM_HOME/lib/jre"
|
@@ -23,7 +24,7 @@ export GEM_HOME="$BRPM_HOME/modules"
|
|
23
24
|
export PATH="$GEM_HOME/bin:$JRUBY_HOME/bin:$PATH"
|
24
25
|
```
|
25
26
|
|
26
|
-
If BRPM is installed on a custom location you can modify the first line accordingly. The PATH variable is modified to make sure the ruby scripts that come with the modules are in the PATH.
|
27
|
+
If BRPM is installed on a custom location you can modify the first line accordingly. The PATH variable is modified to make sure the ruby scripts that come with the modules are in the PATH.
|
27
28
|
|
28
29
|
#### .brpm
|
29
30
|
Then create a file .brpm with the following contents in the root directory of the user account that runs BRPM:
|
@@ -68,6 +69,22 @@ brpm_install /path/to/module-name-x.x.x.gem
|
|
68
69
|
|
69
70
|
The gem file of the module can be found on rubygems.org.
|
70
71
|
|
72
|
+
#### custom ruby interpreter
|
73
|
+
To improve the performance of the automation scripts you can also decide to have the scripts executed by a ruby interpreter of your choice.
|
74
|
+
|
75
|
+
In that case make sure that the location of the ruby command is added to the PATH environment variable. There is no more need to set the JAVA_HOME or JRUBY_HOME environment variables anymore, the remaining environment variables can be set as following:
|
76
|
+
```shell
|
77
|
+
export BRPM_HOME=/opt/bmc/RLM
|
78
|
+
export GEM_HOME="$BRPM_HOME/modules"
|
79
|
+
|
80
|
+
export PATH="$GEM_HOME/bin:$PATH"
|
81
|
+
```
|
82
|
+
|
83
|
+
Create a file server.yml in $BRPM_HOME/config and add the following key/value pair to it, in YAML format:
|
84
|
+
```
|
85
|
+
automation_scripts_ruby_command: "ruby"
|
86
|
+
```
|
87
|
+
|
71
88
|
### Usage
|
72
89
|
Once the module is installed you can immediately start using its contained automation scripts by linking the requests' steps to them.
|
73
90
|
|
@@ -134,7 +151,8 @@ gem sources -a http://your-private-gem-server:9292/
|
|
134
151
|
|
135
152
|
You can simply execute (or debug if your ruby IDE supports it, e.g. RubyMine) the scripts on your development machine. See further the section on Testability.
|
136
153
|
|
137
|
-
|
154
|
+
See the [recorded demo](https://youtu.be/08NuePJakGE) for a step-by-step explanation on how you can easily create your own module.
|
155
|
+
|
138
156
|
|
139
157
|
## Re-usability
|
140
158
|
|
@@ -327,6 +345,19 @@ For an example of how to synchronize JIRA issues with BRPM tickets see the [web
|
|
327
345
|
|
328
346
|
BRPM comes with a messaging engine that can send a notification for many events like the creation or update or requests, plans etc. The framework contains an [event handler script](https://github.com/BMC-RLM/brpm_content_framework/blob/master/bin/event_handler) with an associated [bash wrapper script](https://github.com/BMC-RLM/brpm_content_framework/blob/master/infrastructure/scripts/run_event_handler.sh) that can be set up to listen to these incoming events. You can pass it a custom script that can take care of processing the received events. Typically this event processing script will then execute the appropriate automation scripts.
|
329
347
|
|
348
|
+
The messaging can be enabled by activating the "Create queue messages for integrations?" checkbox in the Systems - Settings - General section of BRPM and by adding the following sections to the file ```$BRPM_HOME/server/jboss/standalone/configuration/standalone.xml```:
|
349
|
+
In the ```<acceptors>``` section of ```<hornetq-server>```:
|
350
|
+
```
|
351
|
+
<netty-acceptor name="stomp-acceptor" socket-binding="messaging-stomp">
|
352
|
+
<param key="protocol" value="stomp"/>
|
353
|
+
</netty-acceptor>
|
354
|
+
```
|
355
|
+
|
356
|
+
In the ```<socket-binding-group name="standard-sockets">``` section:
|
357
|
+
```
|
358
|
+
<socket-binding name="messaging-stomp" port="61613"/>
|
359
|
+
```
|
360
|
+
|
330
361
|
A messaging solution can be used for extending the out-of-the-box BRPM feature set or for synchronizing BRPM owned data with other systems.
|
331
362
|
|
332
363
|
For an example of how to update the status of the associated JIRA tickets after a deployment request finished successfully see the [event handler script](https://github.com/BMC-RLM/brpm_module_demo/integrations/brpm/process_event_handler_event.rb) (search for update_tickets_in_jira_by_request) that could be used for this purpose. As soon as the script is run in daemon mode it will start receiving events when requests change status.
|
data/config.yml
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# This file should be located in BRPM_HOME/config
|
2
2
|
# See the README for more information on how to use this file
|
3
|
-
execute_automation_scripts_in_docker: "if_docker_image_exists" #possible values: never, if_docker_image_exists, always
|
3
|
+
execute_automation_scripts_in_docker: "if_docker_image_exists" # possible values: never, if_docker_image_exists, always
|
4
|
+
automation_scripts_ruby_command: "ruby" # specify ruby when you want to execute the automation scripts from a non-jruby interpreter, defaults to jruby
|
5
|
+
|
4
6
|
my_parameter: "abc"
|
@@ -24,7 +24,7 @@ $BRPM_HOME/pgsql/bin/dropdb -U $BRPM_DB_USER $BRPM_DB_NAME
|
|
24
24
|
echo "Creating database $BRPM_DB_NAME..."
|
25
25
|
$BRPM_HOME/pgsql/bin/createdb -O $BRPM_DB_USER -E UTF8 -U $BRPM_DB_USER $BRPM_DB_NAME
|
26
26
|
|
27
|
-
echo "Restoring database from
|
27
|
+
echo "Restoring database from $DUMP_FILE to $BRPM_DB_NAME..."
|
28
28
|
$BRPM_HOME/pgsql/bin/psql -U $BRPM_DB_USER -d $BRPM_DB_NAME -f $DUMP_FILE
|
29
29
|
|
30
30
|
echo "Restarting BRPM..."
|
@@ -53,24 +53,31 @@
|
|
53
53
|
# -J BMC_DB_PORT=1433 # SQL_SERVER
|
54
54
|
# -J BMC_DB_PORT=1521 # Oracle
|
55
55
|
-J BMC_DB_NAME=bmc_rpm_db
|
56
|
-
-J BMC_DB_USER_NAME=
|
56
|
+
-J BMC_DB_USER_NAME=rlm_user
|
57
57
|
-J BMC_DB_USER_PASSWORD=DES\:a751b8161238d051e4e986421d24d2dcd1cff043003f0e35
|
58
58
|
|
59
59
|
#------------ BRPM Migration Information ----------#
|
60
60
|
# Options true, false
|
61
61
|
-J BMC_MIGRATE_EXISTING_BRPM_INSTALLATION=true
|
62
|
-
|
62
|
+
|
63
63
|
# Options USE_SAME_DATABASE, USE_SAME_DATABASE_EMPTY_DATABASE_CONTENTS
|
64
64
|
-J BMC_BRPM_DATABASE_MIGRATION=USE_SAME_DATABASE
|
65
|
-
|
66
|
-
-J
|
65
|
+
|
66
|
+
-J BMC_AUTOMATION_RESULTS=COPY_DATA
|
67
|
+
|
67
68
|
# Options COPY_CONFIGURATION, DISCARD
|
68
69
|
-J BMC_OTHER_SETTINGS=COPY_CONFIGURATION
|
70
|
+
|
71
|
+
-J BMC_REFERENCE_BRPM_INSTALLATION_PATH=/opt/bmc/RLM/releases/4.6.00.05/RPM
|
72
|
+
|
73
|
+
# Options 4.4.00, BRLM_4_3_00, BRPM_2_6
|
74
|
+
-J BMC_BRPM_MIGRATION_VERSION=4.6.00
|
75
|
+
|
69
76
|
-J BMC_BRPM_SKIP_DB_MODIFICATION_FOR_CLUSTER=false
|
70
77
|
|
71
78
|
#------------ Email Information ----------#
|
72
|
-
-J BMC_SENDMAIL_FROM=admin@example.com
|
73
79
|
-J MAIL_NOTIFICATIONS=USE_SMTP
|
80
|
+
-J BMC_SENDMAIL_FROM=admin@example.com
|
74
81
|
-J BMC_SMTP_HOST=smtp.mycorp.com
|
75
82
|
-J BMC_SMTP_PORT=25
|
76
83
|
-J BMC_SMTP_DOMAIN_NAME=mycorp.com
|
data/lib/brpm_script_executor.rb
CHANGED
@@ -64,6 +64,13 @@ class BrpmScriptExecutor
|
|
64
64
|
file.puts(params_for_process.to_yaml)
|
65
65
|
end
|
66
66
|
|
67
|
+
destination_utf_file = File.expand_path("file_in_utf.rb", script_support_path)
|
68
|
+
source_utf_file = File.expand_path("../../config/initializers/file_in_utf.rb", script_support_path)
|
69
|
+
if File.exists?(source_utf_file) and File.size(destination_utf_file) != File.size(source_utf_file)
|
70
|
+
BrpmAuto "Copying file_in_utf.rb from RPM/config/initializers to #{script_support_path}..."
|
71
|
+
FileUtils.copy(source_utf_file, destination_utf_file)
|
72
|
+
end
|
73
|
+
|
67
74
|
if use_docker
|
68
75
|
BrpmAuto.log "Executing the script in a docker container..."
|
69
76
|
command = "docker run -v #{working_path}:/workdir -v #{automation_results_path}:/automation_results -v #{script_support_path}:/script_support --rm bmcrlm/#{modul}:#{module_version} /docker_execute_automation \"#{name}\" \"/workdir/#{params_file}\" \"#{automation_type}\""
|
@@ -101,7 +108,7 @@ class BrpmScriptExecutor
|
|
101
108
|
require \\"brpm_script_executor\\"
|
102
109
|
BrpmScriptExecutor.execute_automation_script_from_other_process(\\"#{modul}\\", \\"#{name}\\", \\"#{params_path}\\", \\"#{automation_type}\\", \\"#{parent_id}\\", \\"#{offset}\\", \\"#{max_records}\\")
|
103
110
|
EOR
|
104
|
-
command = "#{env_var_gem_home}#{env_var_bundler}
|
111
|
+
command = "#{env_var_gem_home}#{env_var_bundler}#{BrpmAuto.global_params["automation_scripts_ruby_command"] || "jruby"} -e \"#{ruby_command}\""
|
105
112
|
end
|
106
113
|
|
107
114
|
result = Bundler.with_clean_env do
|
@@ -35,18 +35,24 @@ describe 'BRPM Script Executor' do
|
|
35
35
|
# Note: the following tests will run the automation scripts in a separate process and will therefore use an already installed brpm_content_framework module,
|
36
36
|
# either the version from their Gemfile/Gemfile.lock or the latest, but not the one from source code
|
37
37
|
it "should execute an automation script in a separate process inside a bundler context" do
|
38
|
-
|
38
|
+
params = get_default_params
|
39
|
+
params["home_dir"] = "#{File.dirname(__FILE__)}/customer_include"
|
40
|
+
|
41
|
+
result = BrpmScriptExecutor.execute_automation_script_in_separate_process("brpm_module_test", "test_ruby", params)
|
39
42
|
|
40
43
|
expect(result).to be_truthy
|
41
44
|
end
|
42
45
|
|
43
46
|
it "should execute an automation script in a separate process outside a bundler context" do
|
47
|
+
params = get_default_params
|
48
|
+
params["home_dir"] = "#{File.dirname(__FILE__)}/customer_include"
|
49
|
+
|
44
50
|
module_version = BrpmScriptExecutor.get_latest_installed_version(@module_name)
|
45
51
|
module_gem_path = BrpmScriptExecutor.get_module_gem_path(@module_name, module_version)
|
46
52
|
gemfile_path = "#{module_gem_path}/Gemfile"
|
47
53
|
|
48
54
|
FileUtils.move(gemfile_path, "#{gemfile_path}_tmp") if File.exists?(gemfile_path)
|
49
|
-
result = BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "test_ruby",
|
55
|
+
result = BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "test_ruby", params)
|
50
56
|
FileUtils.move("#{gemfile_path}_tmp", gemfile_path)
|
51
57
|
|
52
58
|
expect(result).to be_truthy
|
@@ -71,7 +77,10 @@ describe 'BRPM Script Executor' do
|
|
71
77
|
end
|
72
78
|
|
73
79
|
it "should execute a resource automation script in a separate process" do
|
74
|
-
|
80
|
+
params = get_default_params
|
81
|
+
params["home_dir"] = "#{File.dirname(__FILE__)}/customer_include"
|
82
|
+
|
83
|
+
result = BrpmScriptExecutor.execute_resource_automation_script_in_separate_process(@module_name, "test_resource", params, nil, 0, 10)
|
75
84
|
|
76
85
|
expect(result.count).to eql(3)
|
77
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brpm_content_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.49
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niek Bartholomeus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|