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