下列程序會參照 ClearCaseByDate 範本中的元素。所有配接器範本都能藉由其元素來啟用通知功能。
對在現行建置移入檔案的所有使用者發出通知
您可以使用 <adduser> 指令,動態建置移入建置程式碼的使用者群組,然後使用 <notify> 指令將通知傳送至該群組。
ClearCaseByDate 範本會向 ClearCase 查詢是否有視圖含有兩個時間戳記之間的所有變更。預設的時間戳記適用於現行的配接器作業與前次的配接器作業。就實際而言,可轉換成自前次針對現行建置移入建置以來,所作的所有變更清單。
假設:您用來依使用者名稱發出通知的 SMTP 伺服器,能夠識別視圖中所有使用者的名稱。這表示 ClearCase 使用者名稱必須與電子郵件使用者名稱一致。
如果要啟用這項通知功能:
<adduser group="MyChangers" user="$4">
位置參數 $4 會參照 ClearCase 視圖(由 ClearCaseByDate 範本產生)所顯示的使用者名稱欄位。<!-- 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 群組。電子郵件通知會在建置專案完成時,傳送至該群組。