588
|
1 |
|
|
2 |
.. index::
|
|
3 |
module: Configuring Signaling
|
|
4 |
|
587
|
5 |
=====================
|
|
6 |
Configuring Signaling
|
|
7 |
=====================
|
|
8 |
|
|
9 |
Helium signaling framework offers you a simplest way to control
|
588
|
10 |
failures on build flow, and provides you with an easy way to get reporting on
|
587
|
11 |
some crucial steps of your build.
|
|
12 |
|
|
13 |
|
|
14 |
The configuration
|
|
15 |
-----------------
|
|
16 |
|
588
|
17 |
The signaling configuration is divided into three parts:
|
587
|
18 |
|
|
19 |
* the signalListenerConfig: defines the signal
|
|
20 |
* the signalInput: defines what to do when a signal is raised
|
|
21 |
* the notifierList: defines a set of notifiers
|
|
22 |
|
|
23 |
signalListenerConfig
|
|
24 |
....................
|
|
25 |
|
|
26 |
This part of the configuration is not targeted to be overridden by the build manager.
|
|
27 |
|
|
28 |
The following example defines a custom signal named as **customSignal**.
|
|
29 |
The default configuration must reference a default signalInput configuration using a nested inputRef element,
|
|
30 |
so the signaling framework knows how to behave when a signal is raised.
|
|
31 |
|
|
32 |
.. code-block:: xml
|
|
33 |
|
|
34 |
<hlm:signalListenerConfig id="customSignal" target="target-name" message="target-name triggered a signal">
|
|
35 |
<signalNotifierInput>
|
|
36 |
<signalInput refid="signalInputId" />
|
|
37 |
<notifierInput file="some/file/to/notify.html" />
|
|
38 |
</signalNotifierInput>
|
|
39 |
<hlm:targetCondition>
|
|
40 |
</available file="some-file.txt" />
|
|
41 |
</hlm:targetCondition>
|
|
42 |
</hlm:signalListenerConfig>
|
|
43 |
|
588
|
44 |
A signal will then be triggered each time the **target-name** completed. The signalInput will then define how it should be handled.
|
587
|
45 |
|
588
|
46 |
Another way to trigger a signal is by using the signal task:
|
587
|
47 |
|
|
48 |
.. code-block:: xml
|
|
49 |
|
|
50 |
<hlm:signal name="customSignal" result="1">
|
|
51 |
<signalNotifierInput>
|
|
52 |
<signalInput refid="signalInputId" />
|
|
53 |
<notifierInput file="some/file/to/notify.html" />
|
|
54 |
</signalNotifierInput>
|
|
55 |
</hlm:signal>
|
|
56 |
|
|
57 |
|
|
58 |
signalInput
|
|
59 |
...........
|
|
60 |
|
|
61 |
This Ant type defines what a signal should do when it is raised. The failbuild attribute defines
|
|
62 |
if a build failure should be:
|
|
63 |
|
|
64 |
* failing the build now (value: now)
|
|
65 |
* deferred at the end of the build (value: defer)
|
|
66 |
* ignored (value: never)
|
|
67 |
|
|
68 |
Then the configuration will accept a reference to a notifierList using the notifierListRef element.
|
|
69 |
|
|
70 |
Example of configurations
|
|
71 |
|
|
72 |
.. code-block:: xml
|
|
73 |
|
|
74 |
<hlm:signalInput id="customSignalInput" failbuild="now">
|
|
75 |
<hlm:notifierListRef refid="customNotifier" />
|
|
76 |
</hlm:signalInput>
|
|
77 |
|
588
|
78 |
This will run all notifiers from the customNotifier configuration then fail the build.
|
587
|
79 |
|
|
80 |
.. code-block:: xml
|
|
81 |
|
|
82 |
<hlm:signalInput id="customSignalInput" failbuild="defer"/>
|
|
83 |
|
588
|
84 |
This will defer the failure to the end of the build, no notifier will be run.
|
587
|
85 |
|
|
86 |
notifierList
|
|
87 |
............
|
|
88 |
|
|
89 |
The notifierList Ant type allows the user to configure a set of Notifier (e.g Email, execute task):
|
|
90 |
|
|
91 |
The following example configures a notifier list that will send an email and run few echo task to print
|
|
92 |
some information.
|
|
93 |
|
|
94 |
.. code-block:: xml
|
|
95 |
|
|
96 |
<hlm:notifierList id="customNotifier">
|
|
97 |
<hlm:emailNotifier templateSrc="${helium.dir}/tools/common/templates/log/email_new.html.ftl"
|
|
98 |
title="[signal] ${signal.name}" smtp="smtp.server.address"
|
|
99 |
ldap="ldap://ldap.server.address:389"
|
|
100 |
notifyWhen="always"/>
|
|
101 |
<hlm:executeTaskNotifier>
|
|
102 |
<echo>defaultSignalAlwaysNotifier: Signal: ${signal.name}</echo>
|
|
103 |
<echo>defaultSignalAlwaysNotifier: Status: ${signal.status}</echo>
|
|
104 |
</hlm:executeTaskNotifier>
|
|
105 |
</hlm:notifierList>
|
|
106 |
|
|
107 |
Detailed documentation of the notifier interface could be found `here <../../helium-antlib/index.html>`_.
|
|
108 |
|
|
109 |
|
|
110 |
Example: configuring compileSignal
|
|
111 |
----------------------------------
|
|
112 |
|
|
113 |
In this example we will configure the compileSignal to behave this way:
|
|
114 |
|
|
115 |
* send an email to additional users e.g: user@foo.com, user@bar.com
|
|
116 |
* defer the build failure.
|
|
117 |
|
588
|
118 |
Your configuration should contain (e.g build.xml)
|
587
|
119 |
|
|
120 |
.. code-block:: xml
|
|
121 |
|
|
122 |
<?xml version="1.0"?>
|
|
123 |
<project name="mybuild">
|
|
124 |
...
|
|
125 |
<import file="${helium.dir}/helium.ant.xml"/>
|
|
126 |
...
|
|
127 |
|
|
128 |
<hlm:notifierList id="myCustomNotifierList">
|
|
129 |
<hlm:emailNotifier templateSrc="${helium.dir}/tools/common/templates/log/email_new.html.ftl"
|
|
130 |
title="[signal] My build goes wrong: ${signal.name}"
|
|
131 |
smtp="${email.smtp.server}"
|
|
132 |
ldap="${email.ldap.server}"
|
|
133 |
notifyWhen="fail"
|
|
134 |
additionalrecipients="user@foo.com,user@bar.com"/>
|
|
135 |
</hlm:notifierList>
|
|
136 |
|
|
137 |
<hlm:signalInput id="compileSignalInput" failbuild="defer">
|
|
138 |
<hlm:notifierListRef refid="myCustomNotifierList" />
|
|
139 |
</hlm:signalInput>
|
|
140 |
|
|
141 |
</project>
|
|
142 |
|
|
143 |
|
|
144 |
A custom notifierList has been created with **myCustomNotifierList** as reference ID. It defines
|
588
|
145 |
an emailNotifier which uses the default email template under Helium (${helium.dir}/tools/common/templates/log/email_new.html.ftl).
|
|
146 |
It also sets the title of your email to be "[signal] My build goes wrong: ${signal.name}" (signal.name property will be replaced by the signal name raised).
|
|
147 |
**notifyWhen** attribute will make the notifier send a notification only on build failure.
|
587
|
148 |
Finally the two additional email addresses will be set using the **additionalrecipients** attribute.
|
|
149 |
|
588
|
150 |
We then need to link the signal configuration and our custom signal to the notifier list, the signalInput element is used to achieve this.
|
|
151 |
It must be defined using the same reference ID (see reference overriding how to) as the one in the Helium configuration, the naming convention for this is: **<signal_name>Input**.
|
587
|
152 |
Its **failbuild** attribute is set to **defer** which will configure the build to keepgoing, and fail at the end of the build flow.
|
|
153 |
Finally an embedded notifierListRef element will reference our custom notifier list: **myCustomNotifierList**.
|
|
154 |
|
588
|
155 |
While failing the signaling framework will execute all notifiers defined and then store internally the build failure so it can raise it again at the end of the execution.
|
587
|
156 |
|
|
157 |
|
|
158 |
Example: Report specific errors not included by default
|
|
159 |
-------------------------------------------------------
|
|
160 |
|
|
161 |
Target prep-work-area has extra log extraction added and output xml is read by a new signal.
|
|
162 |
|
|
163 |
.. code-block:: xml
|
|
164 |
|
|
165 |
<hlm:signalInput id="prepWorkAreaSignalInputWarn" failbuild="defer">
|
|
166 |
<hlm:notifierListRef refid="defaultSignalFailNotifier" />
|
|
167 |
</hlm:signalInput>
|
|
168 |
|
|
169 |
<hlm:signalListenerConfig id="prepWorkAreaSignalWarn" target="prep-work-area" message="Warnings happened during Preparing Work Area">
|
|
170 |
<signalNotifierInput>
|
|
171 |
<signalInput refid="prepWorkAreaSignalInputWarn" />
|
|
172 |
<notifierInput file="${build.log.dir}/${build.id}_ccm_get_input.log2.xml" />
|
|
173 |
</signalNotifierInput>
|
|
174 |
<hlm:targetCondition>
|
|
175 |
<hlm:hasSeverity severity="error" file="${build.log.dir}/${build.id}_ccm_get_input.log2.xml"/>
|
|
176 |
</hlm:targetCondition>
|
|
177 |
</hlm:signalListenerConfig>
|
|
178 |
|
|
179 |
<target name="prep-work-area" depends="ccmgetinput.prep-work-area">
|
|
180 |
<hlm:logextract file="${prep.log.dir}/${build.id}_ccm_get_input.log" outputfile="${build.log.dir}/${build.id}_ccm_get_input.log2.xml">
|
|
181 |
<recordfilterset>
|
|
182 |
<recordfilter category="error" regexp=".*Explicitly specified but not included" />
|
|
183 |
</recordfilterset>
|
|
184 |
</hlm:logextract>
|
|
185 |
</target>
|