source: obs_notify_generic/README.md@ 1193

Last change on this file since 1193 was 1186, checked in by joergs, on Jun 12, 2015 at 4:52:50 PM

added run notes (as user obsrun, in directory /usr/lib/obs/server/

File size: 2.2 KB
Line 
1OBS Notify Plugin
2=================
3
4
5Installation
6------------
7
8The file `obs_notify_generic.pm` and `obs_notify_generic_config.pm` must be located in the
9`/usr/lib/obs/server/plugins/` directory.
10
11Modify the OBS config file `/usr/lib/obs/server/BSConfig.pm`
12and add/set
13
14our $notification_plugin = "obs_notify_generic";
15
16Alternativly you can create an host specific configuration file:
17
18```
19/usr/lib/obs/server/bsconfig.`hostname -f`
20```
21
22```
23# notify settings
24our $notification_plugin = "obs_notify_generic";
25
261;
27```
28
29
30Configuration
31-------------
32
33All configuration is done in the file
34
35```
36/usr/lib/obs/server/plugins/obs_notify_generic_config.pm
37```
38
39The default log file is
40
41```
42/src/obs/log/notify_generic.log
43```
44
45but can be configured.
46
47The best configuration to start is by
48
49```
50our $cfg = {
51 "UNKNOWN" => [ { "log" => 1 } ],
52}
53```
54
55This logs all UNKNOWN events. With this configuration this are all events, as no specific events are defined.
56
57Usefull notification types are
58 * "BUILD_FAIL"
59 * "BUILD_SUCCESS"
60 * "REPO_PUBLISHED"
61
62Each event come with a number of parameter. These will also be logged.
63
64The configuration directove `filter` limits a notification type to certain cases. Filter can be regexes.
65
66Example:
67
68```
69our $cfg = {
70 "REPO_PUBLISH_STATE" => [],
71 "REPO_PUBLISHED" => [
72 {
73 "filter" => { 'project' => '.*:bareos' },
74 "log" => 1,
75 },
76 {
77 "filter" => { 'project' => '.*:bareos', 'repository' => 'SLE_12' },
78 "action" => 'logger "project $project published for repository $repository',
79 "log" => 0,
80 },
81 ],
82 "UNKNOWN" => [ { "log" => 1 } ],
83}
84```
85
86Meaing:
87 * type=REPO_PUBLISH_STATE
88 * ignore it
89 * type=REPO_PUBLISHED:
90 * log every time a project that matches the name ":bareos" get published
91 * when the project is published for SLE_12, also create a syslog message
92
93Limitations:
94 * the `action` run as user obsrun. As the OBS service run as daemon, only very few environment variables are set.
95 * the `action`s should have a short runtime. As long as these scripts run, some other services from the obs are blocked. Maybe the scripts are forcefully ended by the OBS service.
Note: See TracBrowser for help on using the repository browser.