2016-06-14 20 views
0

我想在我們的buildbot系統上發送自定義電子郵件狀態通知。在使用MailNotifier時,我無法找到在電子郵件主題中獲取構建屬性的方法。如何在使用MailNotifier時在電子郵件主題中獲取buildbot構建屬性?

我在messageFormatter回調函數參數中發現了構建對象。但它只能在身體中使用,而不能在主體中使用。

我也嘗試使用Json API,通過從我的master.cfg本身調用它,但它不工作,並且buildbot服務器進行某種無限循環。如果單獨調用Json API,可以很好地查詢構建特定數據。

我使用的是buildbot 0.8.12,我是這個框架的新手。謝謝你的幫助。

回答

0

MailNotifier的文檔字符串:

@param messageFormatter: function taking (mode, name, build, result, 
    master_status) and returning a dictionary 
    containing two required keys "body" and "type", 
    with a third optional key, "subject". The 
    "body" key gives a string that contains the 
    complete text of the message. The "type" key 
    is the message type ('plain' or 'html'). The 
    'html' type should be used when generating an 
    HTML message. The optional "subject" key 
    gives the subject for the email. 

所以,你可以只添加一個項目的結果字典,你會得到你想要的。例如。

... 
return {..., 'subject': 'Abracadabra %s' % build.getProperty('my-favourite-build-property')} 
相關問題