source: obs_notify_generic/README.md

Last change on this file was 1209, checked in by joergs, on Dec 21, 2015 at 1:08:18 PM

cleanup

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 for this plugin 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 starting configuration could look like this:
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 notification types 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 directive `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', 'repo' => 'SLE_12' },
78 "action" => 'logger "project $project published for repository $repository',
79 "log" => 0,
80 },
81 ],
82 "UNKNOWN" => [ { "log" => 1 } ],
83}
84```
85
86Meaning:
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. It might help to call scripts using `sudo -u USERNAME`
95 * the `action` script do run in background, to prevent blocking other OBS services. Output will be write to `${logfile}.out.log`.
Note: See TracBrowser for help on using the repository browser.