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 |
|
|
108 |
Example: configuring compileSignal
|
|
109 |
----------------------------------
|
|
110 |
|
|
111 |
In this example we will configure the compileSignal to behave this way:
|
|
112 |
|
|
113 |
* send an email to additional users e.g: user@foo.com, user@bar.com
|
|
114 |
* defer the build failure.
|
|
115 |
|
588
|
116 |
Your configuration should contain (e.g build.xml)
|
587
|
117 |
|
|
118 |
.. code-block:: xml
|
|
119 |
|
|
120 |
<?xml version="1.0"?>
|
|
121 |
<project name="mybuild">
|
|
122 |
...
|
|
123 |
<import file="${helium.dir}/helium.ant.xml"/>
|
|
124 |
...
|
|
125 |
|
|
126 |
<hlm:notifierList id="myCustomNotifierList">
|
|
127 |
<hlm:emailNotifier templateSrc="${helium.dir}/tools/common/templates/log/email_new.html.ftl"
|
|
128 |
title="[signal] My build goes wrong: ${signal.name}"
|
|
129 |
smtp="${email.smtp.server}"
|
|
130 |
ldap="${email.ldap.server}"
|
|
131 |
notifyWhen="fail"
|
|
132 |
additionalrecipients="user@foo.com,user@bar.com"/>
|
|
133 |
</hlm:notifierList>
|
|
134 |
|
|
135 |
<hlm:signalInput id="compileSignalInput" failbuild="defer">
|
|
136 |
<hlm:notifierListRef refid="myCustomNotifierList" />
|
|
137 |
</hlm:signalInput>
|
|
138 |
|
|
139 |
</project>
|
|
140 |
|
|
141 |
|
|
142 |
A custom notifierList has been created with **myCustomNotifierList** as reference ID. It defines
|
588
|
143 |
an emailNotifier which uses the default email template under Helium (${helium.dir}/tools/common/templates/log/email_new.html.ftl).
|
|
144 |
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).
|
|
145 |
**notifyWhen** attribute will make the notifier send a notification only on build failure.
|
587
|
146 |
Finally the two additional email addresses will be set using the **additionalrecipients** attribute.
|
|
147 |
|
588
|
148 |
We then need to link the signal configuration and our custom signal to the notifier list, the signalInput element is used to achieve this.
|
|
149 |
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
|
150 |
Its **failbuild** attribute is set to **defer** which will configure the build to keepgoing, and fail at the end of the build flow.
|
|
151 |
Finally an embedded notifierListRef element will reference our custom notifier list: **myCustomNotifierList**.
|
|
152 |
|
588
|
153 |
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
|
154 |
|
|
155 |
|
|
156 |
Example: Report specific errors not included by default
|
|
157 |
-------------------------------------------------------
|
|
158 |
|
|
159 |
Target prep-work-area has extra log extraction added and output xml is read by a new signal.
|
|
160 |
|
|
161 |
.. code-block:: xml
|
|
162 |
|
|
163 |
<hlm:signalInput id="prepWorkAreaSignalInputWarn" failbuild="defer">
|
|
164 |
<hlm:notifierListRef refid="defaultSignalFailNotifier" />
|
|
165 |
</hlm:signalInput>
|
|
166 |
|
|
167 |
<hlm:signalListenerConfig id="prepWorkAreaSignalWarn" target="prep-work-area" message="Warnings happened during Preparing Work Area">
|
|
168 |
<signalNotifierInput>
|
|
169 |
<signalInput refid="prepWorkAreaSignalInputWarn" />
|
|
170 |
<notifierInput file="${build.log.dir}/${build.id}_ccm_get_input.log2.xml" />
|
|
171 |
</signalNotifierInput>
|
|
172 |
<hlm:targetCondition>
|
|
173 |
<hlm:hasSeverity severity="error" file="${build.log.dir}/${build.id}_ccm_get_input.log2.xml"/>
|
|
174 |
</hlm:targetCondition>
|
|
175 |
</hlm:signalListenerConfig>
|
|
176 |
|
|
177 |
<target name="prep-work-area" depends="ccmgetinput.prep-work-area">
|
|
178 |
<hlm:logextract file="${prep.log.dir}/${build.id}_ccm_get_input.log" outputfile="${build.log.dir}/${build.id}_ccm_get_input.log2.xml">
|
|
179 |
<recordfilterset>
|
|
180 |
<recordfilter category="error" regexp=".*Explicitly specified but not included" />
|
|
181 |
</recordfilterset>
|
|
182 |
</hlm:logextract>
|
|
183 |
</target>
|