当我的buildbot失败时,它被配置为发送电子邮件。
目前的配置是:
mailNotify = MailNotifier(fromaddr="****@****.com",
sendToInterestedUsers=True,
extraRecipients=['*****@*****.com', '****@****.com'],
relayhost="mail.****.com",
smtpPort=587,
addLogs = True,
addPatch = True,
useTls=True,
smtpUser="****@****.com",
smtpPassword="****"
mode="failing")我在本地网络中设置了一个构建主程序,为192.168.1.11。因此,当收到电子邮件时,它包含以下信息:
Full details are available at:
http://192.168.1.11:8020/builders/BuilderName/builds/136
Buildbot URL: http://192.168.1.11:8020/除此之外,我还有一个可公开访问的服务器,通过它我可以访问buildbot,即https://mydomain.com/buildbot/。
我想得到的是
Full details are available at:
https://mydomain.com/buildbot/builders/BuilderName/builds/136
Buildbot URL: https://mydomain.com/buildbot/我不想重写整个消息格式化程序,但我无法找到这样的方法。有可能吗?
发布于 2014-08-08 12:49:03
AFAIK最好的方法是编写您自己的messageFormatter()。这并不是什么痛苦。我这么做是为了我的建筑机器人,它就像一种魅力。
如果您查看源buildbot\status\mail.py,就会看到名为defaultMesage(...)的函数。只需在buildbot的配置中重写它,并将其传递给MailNotifier构造函数!最有可能的是,你只需要换一条线:108
def myMessageFormatter(mode, name, build, results, master_status)
# Copy everything from buildbot\status\mail.py:defaultMessage()
# Change this to point to https://mydomain.com/buildbot/
if master_status.getURLForThing(build):
text += "Full details are available at:\n %s\n" % master_status.getURLForThing(build)
text += "\n"https://stackoverflow.com/questions/25202028
复制相似问题