brpm_content_framework 0.1.57 → 0.1.58

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2MxOWVmYWJmYzkyYzVjZjc1MTU4MTAzZTU2YzFkMmJmMmU1MzQyMQ==
4
+ NWI4OGQyZDQ3NzdiNjgzNTQ2YTNhMDllYTg0ZGVjMjQyNzdlYWNiNQ==
5
5
  data.tar.gz: !binary |-
6
- OTE2NjBiNmU4NzkzOTkzNjMzOTVmYWUwN2JlYjM0NjA5ZTllZTIzYg==
6
+ ZThlZTExZjIzMTc3ZTNhNzYyMDA5MTZhYTcyNzc5NTRmMjhkMjcwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTU3Nzk4MjVlNDI1ZGVhZDMxNjMzMTA3ODc2ZmZkMjAyOTg0ZmY5MzQ5ZjMy
10
- NmEzOWZhNzcxNDhhOTYzNzA5MjYxMWU1NzRjNjRhNGNjYmE1ZTMzZGRiNTcx
11
- ZTI3YTZiNTU4N2VhYTYzOGYyNGJmOGZlZjllODc3YzcyOWQ1MTQ=
9
+ NjQ3MWYyZGMxMjZhNDQxYjkxMzBkMjkxOGEzMGIyYzAwNzdmMTQyMGVlODg3
10
+ N2FkZTQ3OTljMzMxMThmN2FkNDhjMzc1YjdlZmQwZmFiOTVhODBjNWZmODJl
11
+ OWJjOWUxZGJlY2Y5YTYzOTJmZjRhZTcyNDNlY2ZhZDVkNjdlYjA=
12
12
  data.tar.gz: !binary |-
13
- YjQwMDhjMDFkYTFmNjk2MGMxODgxN2ZjY2M4N2I0NGZhNTBmNjAxNjk2ZWFk
14
- NjI3MWUyMjA5YWE5YWZjMzUwNTljZDUwYzRkMDk2YzlhODEyNjFiNzdlMjc4
15
- NGFiYTdmODBmZDhhNWE1NTQ4MDFhN2ExMWYwYTFiNGExNjMzNTQ=
13
+ YmQ3ODk1MzE0Njg5ZjdiMDhlODhjZjc4MDQ1MzE3M2Q4NzJiMTNlYTZmNTA5
14
+ MTlhOTE5MzEwYmJjOTQ1YWE0Y2NiNGYwN2JkNDAwOWE2N2U4MmZiNzJkMmVj
15
+ MGZkOWRmOWNkZWYxZTM4OTE4N2YwZGJhYTIyNzkyNWU5MWI0MjU=
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # BRPM Content framework
2
2
 
3
- [![Build Status](https://travis-ci.org/BMC-RLM/brpm_content.svg?branch=master)](https://travis-ci.org/BMC-RLM/brpm_content)
3
+ [![Build Status](https://travis-ci.org/BMC-RLM/brpm_content_framework.svg?branch=master)](https://travis-ci.org/BMC-RLM/brpm_content_framework)
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/brpm_content.png)](http://badge.fury.io/rb/brpm_content)
5
+ [![Gem Version](https://badge.fury.io/rb/brpm_content_framework.png)](http://badge.fury.io/rb/brpm_content_framework)
6
6
 
7
- The BRPM Content framework is intended to make the creation and usage of content (for the moment limited to automation scripts) on top of BRPM as easy as possible.
7
+ The BRPM Content framework is intended to make the creation and usage of content on top of BRPM as easy as possible. For the moment this content is limited to automation scripts, but in the future this could easily be extended to include sample applications, request templates, etc.
8
8
 
9
9
  It is designed around a number of core concepts like modularity, re-usability, testability that are further explained below.
10
10
 
@@ -12,50 +12,67 @@ It is designed around a number of core concepts like modularity, re-usability, t
12
12
 
13
13
  ### Installation
14
14
 
15
- First of all, make sure that the environment variable BRPM_HOME is set to the location where BRPM is installed, e.g.:
15
+ First of all, make sure that the necessary environment variables are set on the BRPM instance, e.g. for a default BRPM installation:
16
16
  ```shell
17
17
  export BRPM_HOME=/opt/bmc/RLM
18
+ export JAVA_HOME="$BRPM_HOME/lib/jre"
19
+ export JRUBY_HOME="$BRPM_HOME/lib/jruby"
20
+ export GEM_HOME="$BRPM_HOME/modules"
21
+
22
+ export PATH="$GEM_HOME/bin:$JRUBY_HOME/bin:$PATH"
18
23
  ```
19
24
 
20
- Then copy the [BRPM Content framework's installation script](https://raw.githubusercontent.com/BMC-RLM/brpm_content/master/infrastructure/shell_scripts/install_content_repo.sh) to the instance on which BRPM is installed and execute it.
25
+ 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.
21
26
 
22
- See here the commands to get you started:
27
+ Then create a file .brpm with the following contents in the root directory of the user account that runs BRPM:
23
28
  ```shell
24
- wget https://raw.githubusercontent.com/BMC-RLM/brpm_content/master/infrastructure/shell_scripts/install_content_repo.sh
25
- chmod +x install_content_repo.sh
26
- ./install_content_repo.sh
29
+ brpm_url: http://your-brpm-server:8088/brpm
30
+ brpm_api_token: ...
27
31
  ```
28
32
 
29
- The script will ask for the location of a zip file that contains the files. If the BRPM instance has access to the internet you can leave it empty in which case it will directly grab the files from this github.com repo.
30
- If you need the zip file of this repo you can find it on [https://github.com/BMC-RLM/brpm_content/archive/master.zip](https://github.com/BMC-RLM/brpm_content/archive/master.zip)
33
+ Note that he brpm_api_token should be the token of a user that is defined in BRPM and that has administrative rights.
31
34
 
32
- Alternatively, if the BRPM instance has internet access and wget is installed the framework can be installed by simply executing the following command on the BRPM instance as root:
35
+ Finally you can install the framework and the BRPM module (needed to configure the automation script wrappers of the modules) as following:
33
36
  ```shell
34
- wget -qO- https://raw.githubusercontent.com/BMC-RLM/brpm_content/master/infrastructure/shell_scripts/install_content_repo.sh | INSTALL=ONLINE sh
37
+ gem install brpm_content_framework
38
+ brpm_install brpm_module_brpm
35
39
  ```
36
40
 
37
- ### Configuration
38
-
39
- At this early stage it is still necessary to manually configure the automation scripts that come with this content repository in BRPM before you can start using them in the request steps.
40
-
41
- This can be done as following:
42
- - go to Environment > Automation and create an automation script
43
- - choose the type and category of the automation script
44
- - paste the content of the automation script's wrapper file (the file with the same name as the automation script but with the .txt extension) into the script body
41
+ If the BRPM instance has no direct access to the internet you can also download the modules (which are basically ruby gems) to your workstation and upload them from there onto the BRPM instance.
45
42
 
46
- The above remark applies to both automation scripts as well as resource automation scripts
43
+ In that case the installation can be done as following:
44
+ ```shell
45
+ gem install /path/to/brpm_content_framework-x.x.x.gem --local
46
+ brpm_install /path/to/brpm_module_brpm-x.x.x.gem
47
+ ```
48
+
49
+ Note that brpm_module_brpm is a module that contains a REST API client for BRPM and is needed to set up the automation scripts of the modules that will be installed later on.
47
50
 
48
- Finally, make sure that the following item is added to Metadata > Lists > AutomationErrors:
51
+ Both gem files can be downloaded from the public gem repository rubygems.org. Just look up the name and on the gem's home page you will find a "Download" button that has a link to the latest version of the gem.
52
+
53
+ ### Usage
54
+
55
+ OK now that the framework is installed the next thing to do is to install a couple of existing modules (or even build your own!). There is a list of available modules at the end of this page.
56
+
57
+ A module can be installed as following:
58
+ ```shell
59
+ brpm_install module-name
49
60
  ```
50
- ******** ERROR ********
61
+
62
+ Or if the BRPM instance has no direct access to the internet (assuming the gem file was manually uploaded onto the instance):
63
+ ```shell
64
+ brpm_install /path/to/module-name-x.x.x.gem
51
65
  ```
52
- This will allow non caught exceptions from the automation scripts to cause the step to go in problem mode.
66
+
67
+ The gem file of the module can be found on rubygems.org.
68
+
69
+ Once the module is installed you can immediately start using its contained automation scripts by linking the requests' steps to them.
53
70
 
54
71
  ## Architecture
55
72
 
56
73
  The BRPM Content framework is an automation platform that is built on top of BRPM. It allows to create, install and run what are called modules that contain automation logic that naturally belongs together. The framework itself provides a number of general purpose features like an automation script executor, dependency management, parameter handling, logging, etc.
57
74
 
58
- ![alt text](https://github.com/BMC-RLM/brpm_content/blob/master/architecture.png "architecture")
75
+ ![alt text](https://github.com/BMC-RLM/brpm_content_framework/blob/master/architecture.png "architecture")
59
76
 
60
77
  The BRPM Content framework was built with the following design principles in mind, all further explained in the remainder of this document:
61
78
  - **modularity**
@@ -67,45 +84,52 @@ The BRPM Content framework was built with the following design principles in min
67
84
 
68
85
  ### Using existing modules
69
86
 
70
- One of the core design principles of the framework is its modularity. The framework itself is deliberately chosen to be very lightweight. The purpose is that all custom automation logic is added by means of modules. Modules will typically group multiple automation scripts, resource automation scripts and libraries of one specific domain.
71
-
72
- Modules can be installed by executing the [module installation](https://github.com/BMC-RLM/brpm_content/blob/master/infrastructure/shell_scripts/install_content_module.sh) script on the BRPM instance:
73
- ```shell
74
- ~/shell_scripts/install_content_module.sh
75
- ```
76
-
77
- The script will ask for the location of a zip file or the url of a github.com repository that contains the module's files. For the Selenium module this url would be [https://github.com/BMC-RLM/brpm_module_selenium](https://github.com/BMC-RLM/brpm_module_selenium).
78
-
79
- Note that the BRPM Content framework contains a number of core [modules](https://github.com/BMC-RLM/brpm_content/tree/master/modules) that will be installed by default. The purpose is to gradually move these built-in modules into their own dedicated github repositories.
87
+ One of the core design principles of the framework is its modularity. The framework itself is deliberately chosen to be very lightweight. The purpose is to add all custom automation logic through modules. Modules will typically group multiple automation scripts, resource automation scripts and libraries of one specific domain or topic.
80
88
 
81
89
  ### Creating your own modules
82
90
 
83
91
  It is very simple to create your own module.
84
92
 
85
- Just make sure to stick with the following file structure:
93
+ Just make sure to stick with the following [file structure](https://github.com/BMC-RLM/brpm_content_framework/tree/master/infrastructure/module_template):
86
94
  ```
87
95
  +-- automations
88
96
  | +-- my_automation_script.rb
89
- | +-- my_automation_script.txt
97
+ | +-- my_automation_script.meta
90
98
  +-- resource_automations
91
99
  | +-- my_resource_automation_script.rb
92
- | +-- my_resource_automation_script.txt
100
+ | +-- my_resource_automation_script.meta
93
101
  +-- lib
94
102
  | +-- my_library.rb
95
103
  +-- tests
96
104
  | +-- my_automation_script_spec.rb
97
105
  | +-- spec_helper.rb
98
106
  +-- config.yml
107
+ +-- module.gemspec
108
+ +-- Rakefile
99
109
  ```
100
110
 
101
- The config.yml file contains the integration server and all other modules it depends on. Both settings are optional. In the future it will also be possible to version modules.
111
+ The config.yml file contains the meta data of the module as well as a list of the other modules it depends on.
112
+
113
+ The automations directory contains the actual automation scripts and the resource_automations directory contains the resource automation scripts. For each of these scripts a meta file must exist that contains (you guessed it right) the meta data of the automation script.
114
+
115
+ See the example files from the module_template directory for more information on the mandatory and optional fields.
102
116
 
103
- If you use a github.com repository to host the source code of the module you can directly install it from there. Otherwise you can create a zip file of the module and install it as such.
117
+ In order to publish your module, two more files are needed: a module.gemspec file and a Rakefile. These two files can be copied from the module_template directory unmodified.
104
118
 
105
- It is also possible to execute (and debug if your ruby IDE supports it, e.g. RubyMine) the scripts on your development machine. See further the section on Testability.
119
+ During the development life cycle, after you have committed the changes to your automation scripts and bumped the version number from the config.yml file, you can now publish the new version of your module with a simple command:
120
+ ```shell
121
+ rake release
122
+ ```
106
123
 
107
- For an example see the [Selenium](https://github.com/BMC-RLM/brpm_module_selenium) module.
124
+ By default the module will be published to the public rubygems.org repository. It is also possible however to publish your module to a [private repository](http://guides.rubygems.org/run-your-own-gem-server/) like [geminabox](https://github.com/geminabox/geminabox). See the [Demo] module (more specifically its Rakefile) for an example of this alternative. In this case you should not forget to add your private sem server as a source on the gem environment of the BRPM instance:
125
+ ```shell
126
+ gem sources -a http://your-private-gem-server:9292/
127
+ ```
128
+
129
+ 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.
108
130
 
131
+ For an example see the [Bladelogic](https://github.com/BMC-RLM/brpm_module_bladelogic) module.
132
+
109
133
  ## Re-usability
110
134
 
111
135
  ### Automation scripts
@@ -115,23 +139,32 @@ Although the initial purpose of the BRPM Content framework is to exist on top of
115
139
  As an example, see here how the create_package automation script from the bladelogic module can be executed in stand-alone mode:
116
140
 
117
141
  ```ruby
142
+ #!/usr/bin/env ruby
118
143
  # Load the BRPM Content framework's script executor
119
- require "modules/framework/brpm_script_executor"
144
+ require "brpm_script_executor"
120
145
 
121
146
  # Supply the input parameters for the automation script, if any
122
147
  params = {}
123
- params["application"] = "E-Finance"
124
- params["component"] = "EF - Java calculation engine"
125
- params["component_version"] = "1.2.3"
148
+ params["application"] = ENV["APPLICATION"]
149
+ params["component"] = ENV["COMPONENT"]
150
+ params["component_version"] = ENV["COMPONENT_VERSION"]
151
+
152
+ params["brpm_url"] = "http://#{ENV["BRPM_HOST"]}:#{ENV["BRPM_PORT"]}/brpm"
153
+ params["brpm_api_token"] = ENV["BRPM_TOKEN"]
154
+
155
+ params["SS_integration_dns"] = ENV["SS_INTEGRATION_DNS"]
156
+ params["SS_integration_username"] = ENV["SS_INTEGRATION_USERNAME"]
157
+ params["SS_integration_password"] = ENV["SS_INTEGRATION_PASSWORD"]
158
+ params["SS_integration_details"] = {}
159
+ params["SS_integration_details"]["role"] = ENV["SS_INTEGRATION_DETAILS_ROLE"]
126
160
 
127
- params["SS_integration_dns"] = "bladelogic"
128
- params["SS_integration_username"] = "brpm"
129
- params["SS_integration_password"] = "password"
161
+ params["log_file"] = ENV["LOG_FILE"]
162
+ params["also_log_to_console"] = "true"
130
163
 
131
164
  # Execute the automation script
132
- BrpmScriptExecutor.execute_automation_script("bladelogic", "create_package", params)
165
+ BrpmScriptExecutor.execute_automation_script("brpm_module_bladelogic", "create_package", params)
133
166
  ```
134
- [source](https://github.com/BMC-RLM/brpm_content/blob/master/infrastructure/shell_scripts/create_bl_package.sh)
167
+ [source](https://github.com/BMC-RLM/brpm_module_bladelogic/blob/master/bin/create_bl_package)
135
168
 
136
169
  ### Libraries
137
170
 
@@ -139,11 +172,11 @@ It is also possible to re-use the module's libraries in stand-alone mode:
139
172
 
140
173
  ```ruby
141
174
  # Load the BRPM Content framework
142
- require "framework/brpm_auto"
175
+ require "brpm_auto"
143
176
 
144
177
  # Set up the framework and load the brpm module
145
178
  BrpmAuto.setup()
146
- BrpmAuto.require_module "brpm"
179
+ BrpmAuto.require_module "brpm_module_brpm"
147
180
 
148
181
  # Create a BRPM REST client and find all requests for application E-Finance
149
182
  @brpm_rest_client = BrpmRestClient.new("http://my-brpm-server/brpm', "<api token>")
@@ -154,7 +187,7 @@ requests = @brpm_rest_client.get_requests_by({ "app_id" => app["id"]})
154
187
 
155
188
  ## Testability
156
189
 
157
- Thanks to the decoupling between the BRPM Content framework and BRPM itself, it is very easy to write automated tests for the automation logic that runs on top of the framework.
190
+ Thanks to the decoupling between the BRPM Content framework and BRPM itself, it is very straightforward to write automated tests for the automation logic that runs on top of the framework.
158
191
 
159
192
  As an example, see here a unit test written in RSpec that will create a plan and a request in that plan:
160
193
 
@@ -171,7 +204,7 @@ describe 'create release request' do
171
204
  params["release_plan_template_name"] = 'E-Finance Release Plan'
172
205
 
173
206
  # Execute the automation script
174
- BrpmScriptExecutor.execute_automation_script("brpm", "create_release_request", params)
207
+ BrpmScriptExecutor.execute_automation_script("brpm_module_brpm", "create_release_request", params)
175
208
 
176
209
  # Verify that the request was created and linked to the plan
177
210
  @brpm_rest_client = BrpmRestClient.new("http://my-brpm-server/brpm', "<api token>")
@@ -185,29 +218,23 @@ describe 'create release request' do
185
218
  ...
186
219
  end
187
220
  ```
188
- [source](https://github.com/BMC-RLM/brpm_content/blob/master/modules/brpm/tests/create_release_request_spec.rb)
189
-
190
- The framework itself comes with a set of RSpec tests that are executed automatically by [Travis CI](https://travis-ci.org/) after each commit. The status can be consulted on top of this page.
191
-
192
- When setting up an automated testing platform for your modules, make sure that the framework is installed before executing the tests.
221
+ [source](https://github.com/BMC-RLM/brpm_module_brpm/blob/master/tests/create_release_request_spec.rb#L28)
193
222
 
194
- ### Mac OS X
223
+ The framework itself comes with a set of [RSpec tests](https://github.com/BMC-RLM/brpm_content_framework/tree/master/tests) that are executed automatically by [Travis CI](https://travis-ci.org/) after each commit of code changes. The status can be consulted on top of this page.
195
224
 
196
- Clone this repository to a location that is side by side with your module's location. Then 'require' the brpm_script_executor in your spec_helper.rb:
197
- ```ruby
198
- require_relative "../../../brpm_content/modules/framework/brpm_script_executor"
199
- ```
225
+ ## Framework
226
+ ### Dependency management
200
227
 
201
- Make sure that you are running on ruby 1.9.3 and that all gem dependencies as specified in the Gemfile are installed.
202
-
203
- ### Travis CI
228
+ If you want to use a library or automation script from a different module you can indicate a dependency to that module in your own module's config.yml file. This will automatically install all directly and indirectly depending modules during the installation as well as make their libraries available to the scripts in your own module. No need to manage the 'require' statements for these libraries yourself.
204
229
 
205
- See the [.travis.yml](https://github.com/BMC-RLM/brpm_module_selenium/blob/master/.travis.yml) file in the Selenium module for more information on how to do this.
230
+ You can also pin the dependency to a specific version of a module. This can be useful in situations where multiple people of teams share the same modules and one team wants to upgrade to a new version of the depending module but the other teams don't want to risk breaking their own automations due to backward compatibilities that may have crept into the new version.
206
231
 
207
- ## Framework
208
- ### Dependency management
232
+ When multiple versions of a module are needed they can simply be installed side-by-side. This will happen automatically when the modules are installed as dependencies of other modules, but you can also indicate the version number when you install a module explicitly:
233
+ ```shell
234
+ brpm_install brpm_module_brpm 1.2.3
235
+ ```
209
236
 
210
- If you want to use a library or automation script from a different module you can indicate a dependency to that module in your own module's config.yml file. This will automatically make all libraries and automation modules available to all of the scripts in your own module. No need to add 'require' statements yourself.
237
+ When you link a request's step to an automation script can can optionally indicate the version number of the module (and even the framework). If no version number is specified then automatically the latest installed version will be used.
211
238
 
212
239
  ### Parameters
213
240
 
@@ -224,7 +251,7 @@ application = BrpmAuto.params.application
224
251
  my_custom_param = BrpmAuto.params["my_custom_param"]
225
252
  ```
226
253
 
227
- Check out the [automated tests](https://github.com/BMC-RLM/brpm_content/blob/master/modules/framework/tests/params_spec.rb) for more complex use cases.
254
+ Check out the [automated tests](https://github.com/BMC-RLM/brpm_content_framework/blob/master/tests/params_spec.rb) for more complex use cases.
228
255
 
229
256
  #### request params
230
257
 
@@ -240,7 +267,7 @@ BrpmAuto.request_params["created_issue_id"] = 123
240
267
  BrpmAuto.log "The id of the issue that was created by step 1 is #{BrpmAuto.request_params["created_issue_id"]}"
241
268
  ```
242
269
 
243
- Check out the [automated tests](https://github.com/BMC-RLM/brpm_content/blob/master/modules/framework/tests/request_params_spec.rb) for more complex use cases.
270
+ Check out the [automated tests](https://github.com/BMC-RLM/brpm_content_framework/blob/master/tests/request_params_spec.rb) for more complex use cases.
244
271
 
245
272
  #### integration settings
246
273
 
@@ -248,7 +275,7 @@ The integration settings are the connection parameters that are needed to connec
248
275
 
249
276
  ### Logging
250
277
 
251
- You can use the built-in logging feature for any logging needs. The logs will be visible on the 'Notes' tab of the associated BRPM step after the automation is finished. You can also consult the logs in real-time by navigating to my_brpm_server/brpm/automation_results/log.html?request=request id
278
+ You can use the built-in logging feature for any logging needs. The logs will be visible on the 'Notes' tab of the associated BRPM step after the automation is finished. You can also consult the logs in real-time by navigating to http://my_brpm_server/brpm/automation_results/log.html?request=request id
252
279
 
253
280
  Example:
254
281
  ```ruby
@@ -263,11 +290,11 @@ Any ruby exception that is not trapped inside the automation scripts will cause
263
290
 
264
291
  #### server yaml file
265
292
 
266
- The framework allows you to define your own parameters that will automatically be made available to all automation scripts. You can do this by creating a file server.yml in $BRPM_HOME/config and adding your parameters into it, in YAML format. See [here](https://github.com/BMC-RLM/brpm_content/blob/master/modules/framework/config/server.yml) for an example.
293
+ The framework allows you to define your own parameters that will automatically be made available to all automation scripts. You can do this by creating a file server.yml in $BRPM_HOME/config and adding your parameters into it, in YAML format. See [here](https://github.com/BMC-RLM/brpm_content_framework/blob/master/infrastructure/config/server.yml) for an example.
267
294
 
268
295
  #### customer include file
269
296
 
270
- The framework allows you to create your own ruby methods that you will automatically be able to use in all automation scripts. You can do this by creating a file customer_include.rb in $BRPM_HOME/config and adding your custom methods into it. See [here](https://github.com/BMC-RLM/brpm_content/blob/master/modules/framework/config/customer_include.rb) for an example.
297
+ The framework allows you to create your own ruby methods that you will automatically be able to use in all automation scripts. You can do this by creating a file customer_include.rb in $BRPM_HOME/config and adding your custom methods into it. See [here](https://github.com/BMC-RLM/brpm_content_framework/blob/master/infrastructure/config/customer_include.rb) for an example.
271
298
 
272
299
  Note
273
300
  If a get_customer_include_params method exists, the framework will automatically execute it and add the resulting hash into the parameters hash.
@@ -284,25 +311,24 @@ The BRPM Content framework makes it easy to integrate with other tools using web
284
311
 
285
312
  ### Web hook receivers
286
313
 
287
- The framework contains a generic [web hook receiver script](https://github.com/BMC-RLM/brpm_content/blob/master/infrastructure/integrations/webhook_receiver.rb) with an associated [bash wrapper script](https://github.com/BMC-RLM/brpm_content/blob/master/infrastructure/shell_scripts/run_webhook_receiver.sh) that can be run as a daemon. 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.
314
+ The framework contains a generic [web hook receiver script](https://github.com/BMC-RLM/brpm_content_framework/blob/master/bin/webhook_receiver) with an associated [bash wrapper script](https://github.com/BMC-RLM/brpm_content_framework/blob/master/infrastructure/scripts/run_webhook_receiver.sh) that can be run as a daemon. 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.
288
315
 
289
316
  A web hook receiver solution can be used for synchronizing data that is owned by another system (assuming it supports web hooks) with BRPM.
290
317
 
291
- For an example of how to synchronize JIRA issues with BRPM tickets see the [event handler script](https://github.com/BMC-RLM/brpm_content/blob/master/customers/demo/integrations/jira/process_webhook_event.rb) that could be used for this purpose. As soon as the script is run in daemon mode (and JIRA is configured to send event notifications to a web hook) it will start receiving events when issues are created or updated.
318
+ For an example of how to synchronize JIRA issues with BRPM tickets see the [web hook receiver script](https://github.com/BMC-RLM/brp_module_demo/lib/integrations/jira/process_webhook_event.rb) that could be used for this purpose. As soon as the script is run in daemon mode (and JIRA is configured to send event notifications to a web hook) it will start receiving events when issues are created or updated.
292
319
 
293
320
  ### Messaging engine
294
321
 
295
- 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/blob/master/infrastructure/integrations/event_handler.rb) with an associated [bash wrapper script](https://github.com/BMC-RLM/brpm_content/blob/master/infrastructure/shell_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.
322
+ 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.
296
323
 
297
324
  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.
298
325
 
299
- 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_content/blob/master/customers/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.
300
-
301
- ## Modules
302
- ### BRPM
303
- ### BladeLogic
304
- ### JIRA
305
- ### Jenkins
326
+ 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.
306
327
 
307
- ### [Selenium](https://github.com/BMC-RLM/brpm_module_selenium) (in progress)
328
+ ## Publicly available modules:
329
+ ### [BRPM](https://github.com/BMC-RLM/brpm_module_brpm)
330
+ ### [BladeLogic](https://github.com/BMC-RLM/brpm_module_bladelogic)
331
+ ### [JIRA](https://github.com/BMC-RLM/brpm_module_jira)
332
+ ### [Jenkins](https://github.com/BMC-RLM/brpm_module_jenkins)
333
+ ### [Demo](https://github.com/BMC-RLM/brpm_module_demo)
308
334
 
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.1.57
1
+ version: 0.1.58
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
@@ -0,0 +1,24 @@
1
+ # Copied from https://github.com/mitchellh/vagrant-aws/blob/master/Rakefile
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ require 'rspec/core/rake_task'
5
+
6
+ # Immediately sync all stdout so that tools like buildbot can
7
+ # immediately load in the output.
8
+ $stdout.sync = true
9
+ $stderr.sync = true
10
+
11
+ # Change to the directory of this file.
12
+ Dir.chdir(File.expand_path("../", __FILE__))
13
+
14
+ # This installs the tasks that help with gem creation and
15
+ # publishing.
16
+ Bundler::GemHelper.install_tasks
17
+
18
+ # Install the `spec` task so that we can run tests.
19
+ RSpec::Core::RakeTask.new do |task|
20
+ task.pattern = "tests/**/*_spec.rb"
21
+ end
22
+
23
+ # Default task is to run the unit tests
24
+ task :default => "spec"
@@ -0,0 +1,36 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
4
+ require "bundler/gem_tasks"
5
+
6
+ # Immediately sync all stdout so that tools like buildbot can
7
+ # immediately load in the output.
8
+ $stdout.sync = true
9
+ $stderr.sync = true
10
+
11
+ # Change to the directory of this file.
12
+ Dir.chdir(File.expand_path("../", __FILE__))
13
+
14
+ # This installs the tasks that help with gem creation and
15
+ # publishing. ra
16
+ Bundler::GemHelper.install_tasks
17
+
18
+ # Install the `spec` task so that we can run tests.
19
+ RSpec::Core::RakeTask.new do |task|
20
+ task.pattern = "tests/**/*_spec.rb"
21
+ end
22
+
23
+ # Default task is to run the unit tests
24
+ task :default => "spec"
25
+
26
+ # geminabox private gem server
27
+ # Don't push the gem to rubygems
28
+ ENV["gem_push"] = "false" # Utilizes feature in bundler 1.3.0
29
+
30
+ # Let bundler's release task do its job, minus the push to Rubygems,
31
+ # and after it completes, use "gem inabox" to publish the gem to our
32
+ # internal gem server.
33
+ Rake::Task["release"].enhance do
34
+ spec = Gem::Specification::load(Dir.glob("*.gemspec").first)
35
+ sh "gem inabox pkg/#{spec.name}-#{spec.version}.gem"
36
+ end
@@ -0,0 +1,21 @@
1
+ # list all input and output params
2
+ params:
3
+ my_parameter:
4
+ name: My parameter
5
+ position: A1:C1
6
+
7
+ friendly_name: <script friendly name> # this value will be used as the name of the automation script BRPM, if not specified the file name of the file will be used
8
+ description: creates a BlPackage from a component
9
+
10
+ # if your automation script depends on an integration server, you can specify here the type of the integration server it needs
11
+ # during the installation the applicable integration server of the BRPM instance will then be linked to the automation script
12
+
13
+ # supported integration server types:
14
+ # Jira
15
+ # Hudson/Jenkins, Jenkins
16
+ # Remedy via AO, AO, "AtriumOrchestrator
17
+ # BMC Application Automation, Bladelogic
18
+ # RLM Deployment Engine, BRPD
19
+
20
+ integration_server_type: <integration server type>
21
+
@@ -0,0 +1,5 @@
1
+ application = BrpmAuto.params.application
2
+ BrpmAuto.log("The application is #{application}")
3
+
4
+ my_parameter = BrpmAuto.params["my_parameter"]
5
+ BrpmAuto.log("The value of my_parameter is #{my_parameter}")
@@ -0,0 +1,13 @@
1
+ #list all dependencies
2
+ dependencies:
3
+ - <module name> { version: x.x.x } # version is optional
4
+
5
+ version: x.x.x
6
+
7
+ friendly_name: <module friendly name> # this value will be used to create an automation category in BRPM for the module, if not specified the name of the repository (minus "brpm_module_") will be used
8
+ author:
9
+ email:
10
+ homepage:
11
+ license:
12
+ summary:
13
+ description:
@@ -0,0 +1,5 @@
1
+ class MyLibrary
2
+ def do_something
3
+ return "I did something"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require "yaml"
2
+
3
+ config = YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = File.basename(File.expand_path(File.dirname(__FILE__)))
7
+ spec.version = config["version"]
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.license = config["license"]
10
+ spec.authors = [config["author"]]
11
+ spec.email = config["email"]
12
+ spec.homepage = config["homepage"]
13
+ spec.summary = config["summary"]
14
+ spec.description = config["description"]
15
+
16
+ spec.add_runtime_dependency "brpm_content_framework", ">=0.1.55"
17
+
18
+ if config["dependencies"]
19
+ config["dependencies"].each do |dependency|
20
+ if dependency.is_a?(Hash)
21
+ modul = dependency.keys[0]
22
+ options = dependency.values[0]
23
+ else
24
+ modul = dependency
25
+ options = {}
26
+ end
27
+ spec.add_runtime_dependency modul, options["version"]
28
+ end
29
+ end
30
+
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
33
+
34
+ spec.files = `git ls-files`.split("\n")
35
+ spec.require_path = 'lib'
36
+
37
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
38
+ spec.bindir = "bin"
39
+ end
@@ -0,0 +1,15 @@
1
+ description:
2
+
3
+ # if your automation script depends on an integration server, you can specify here the type of the integration server it needs
4
+ # during the installation the applicable integration server of the BRPM instance will then be linked to the automation script
5
+
6
+ # supported integration server types:
7
+ # Jira
8
+ # Hudson/Jenkins, Jenkins
9
+ # Remedy via AO, AO, "AtriumOrchestrator
10
+ # BMC Application Automation, Bladelogic
11
+ # RLM Deployment Engine, BRPD
12
+
13
+ integration_server_type: <integration server type>
14
+
15
+ render_as: Tree # possible values List, Tree, when nothing is specified List is chosen by default
@@ -0,0 +1,3 @@
1
+ def execute_script(params, parent_id, offset, max_records)
2
+
3
+ end
@@ -0,0 +1,19 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe 'execute test' do
4
+ before(:all) do
5
+ setup_brpm_auto
6
+ end
7
+
8
+ it 'should execute a test' do
9
+ params = get_default_params
10
+ params = params.merge(get_integration_params_for_bladelogic)
11
+
12
+ params["application"] = 'E-Finance'
13
+ params["component"] = 'EF - Java calculation engine'
14
+ params["component_version"] = '1.0.0'
15
+
16
+ BrpmScriptExecutor.execute_automation_script("my_module", "my_automation_script", params)
17
+ end
18
+ end
19
+
@@ -0,0 +1,38 @@
1
+ require 'fileutils'
2
+ require "brpm_script_executor"
3
+
4
+ def setup_brpm_auto
5
+ FileUtils.mkdir_p "/tmp/brpm_content"
6
+ create_symlink_to_gemset
7
+
8
+ BrpmAuto.setup( get_default_params.merge!(get_integration_params) )
9
+ end
10
+
11
+ def get_default_params
12
+ params = {}
13
+ params['also_log_to_console'] = 'true'
14
+
15
+ params['brpm_url'] = ""
16
+ params['brpm_api_token'] = ""
17
+
18
+ params['output_dir'] = "/tmp/brpm_content"
19
+
20
+ params
21
+ end
22
+
23
+ def get_integration_params
24
+ params = {}
25
+ params["SS_integration_dns"] = ""
26
+ params["SS_integration_username"] = ""
27
+ params["SS_integration_password"] = ""
28
+ params["SS_integration_details"] = ""
29
+
30
+ params
31
+ end
32
+
33
+ def create_symlink_to_gemset
34
+ module_name = File.basename(File.expand_path("#{File.dirname(__FILE__)}/.."))
35
+ symlink = "#{ENV["GEM_HOME"]}/gems/#{module_name}-999.0.0"
36
+ FileUtils.rm(symlink) if File.exists?(symlink)
37
+ FileUtils.ln_s(File.expand_path("#{File.dirname(__FILE__)}/.."), symlink)
38
+ end
@@ -97,6 +97,10 @@ class BrpmAuto
97
97
 
98
98
  def require_libs(module_path, log = true)
99
99
  lib_path = "#{module_path}/lib/**/*.rb"
100
+
101
+ log_message = "Loading all files from #{lib_path}..."
102
+ log ? (BrpmAuto.log log_message) : (print "#{log_message}\n")
103
+
100
104
  require_files(Dir[lib_path], log)
101
105
  end
102
106
 
@@ -105,8 +109,6 @@ class BrpmAuto
105
109
  error_messages = []
106
110
  files.each do |file|
107
111
  if File.file?(file)
108
- log ? (BrpmAuto.log "Loading #{file}...") : (print "Loading #{file}...\n")
109
-
110
112
  begin
111
113
  require file
112
114
  rescue NameError => ne # when we require a set of files with inter-dependencies, the order is important, therefore we will retry the failed files later
@@ -210,7 +210,7 @@ class ModuleInstaller
210
210
  def get_module_friendly_name(module_spec)
211
211
  module_config = YAML.load_file("#{module_spec.gem_dir}/config.yml")
212
212
 
213
- module_config["name"] || "#{module_spec.name.sub("brpm_module_", "").capitalize}"
213
+ module_config["friendly_name"] || "#{module_spec.name.sub("brpm_module_", "").capitalize}"
214
214
  end
215
215
 
216
216
  def create_automation_error_if_not_exists(automation_error)
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.57
4
+ version: 0.1.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus
@@ -122,13 +122,23 @@ files:
122
122
  - bin/brpm_uninstall
123
123
  - bin/event_handler
124
124
  - bin/webhook_receiver
125
- - brpm_content.gemspec
126
125
  - config.yml
127
126
  - infrastructure/.bashrc
128
127
  - infrastructure/.brpm
129
128
  - infrastructure/config/customer_include.rb
130
129
  - infrastructure/config/server.yml
131
130
  - infrastructure/log.html
131
+ - infrastructure/module_template/Rakefile
132
+ - infrastructure/module_template/Rakefile_for_private_gem_repo
133
+ - infrastructure/module_template/automations/my_automation_script.meta
134
+ - infrastructure/module_template/automations/my_automation_script.rb
135
+ - infrastructure/module_template/config.yml
136
+ - infrastructure/module_template/lib/my_library.rb
137
+ - infrastructure/module_template/module.gemspec
138
+ - infrastructure/module_template/resource_automations/my_resource_automation_script.meta
139
+ - infrastructure/module_template/resource_automations/my_resource_automation_script.rb
140
+ - infrastructure/module_template/tests/create_package_spec.rb
141
+ - infrastructure/module_template/tests/spec_helper.rb
132
142
  - infrastructure/scripts/backup_database.sh
133
143
  - infrastructure/scripts/ddns.sh
134
144
  - infrastructure/scripts/install_brpm.sh
@@ -159,6 +169,7 @@ files:
159
169
  - lib/version_control/git.rb
160
170
  - lib/version_control/svn.rb
161
171
  - lib/write_to.rb
172
+ - module.gemspec
162
173
  - tests/all_params_spec.rb
163
174
  - tests/brpm_auto_spec.rb
164
175
  - tests/customer_include/config/customer_include.rb