下列过程引用了 ClearCaseByDate 模板中的元素。 任何适配器模板都可以添加自己的元素来启用通知。
通知为当前构建检入了文件的所有用户
可以使用 <adduser> 命令动态构建检入该构建代码的用户组,然后使用 <notify> 命令向该组发送通知。
ClearCaseByDate 模板查询 ClearCase 以了解两个时间戳记之间的所有更改。缺省时间戳记用于当前适配器运行和上次适配器运行。实际上,它将转换为自上次构建以来为当前构建检入的所有更改的列表。
假定:视图中所有用户名对您用于按该名称通知的 SMTP 服务器均为已知。这就意味着 ClearCase 用户名需要与电子邮件用户名保持一致。
要启用此通知:
<adduser group="MyChangers" user="$4">
位置参数 $4 引用 ClearCaseByDate 模板生成的 ClearCase 视图中显示的用户名字段。<!-- Set some notifications for when the build completes -->
<onproject result="fail">
<notify group="MyChangers" subject="Build $BF_TAG ($CurDate) Failed." message="${Changing}${Changes}"/>
</onproject>
<onproject result="pass">
<notify group="MyChangers" subject="Build $BF_TAG ($CurDate) Passed." message="${Changing}${Changes}"/>
</onproject>
适配器运行时,将从视图中的用户名构建 MyChangers 组。构建项目完成时,将向该组发送电子邮件通知。
通知属于一个 Build Forge 访问组的所有用户
在本示例中,您希望通知某个 Build Forge 访问组的所有成员。ClearCaseByDate 适配器模板用于此示例。假定:Build Forge 中的所有用户名与 SMTP 服务器中的电子邮件用户名相对应。
<adduser group="Developer_Access_Group" user="Developer">
<!-- Set some notifications for when the build completes -->
<onproject result="fail">
<notify group="Developer_Access_Group"
subject="Build $BF_TAG ($CurDate) Failed." message="${Changing}${Changes}"/>
</onproject>
<onproject result="pass">
<notify group="Developer_Access_Group"
subject="Build $BF_TAG ($CurDate) Passed." message="${Changing}${Changes}"/>
</onproject>
适配器运行时,将从属于 Developers 访问组的用户名构建 Developer_Access_Group 组。构建项目完成时,将向该组发送电子邮件通知。