summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-10-01 11:28:48 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-10-01 18:49:39 +0200
commit7210c95e600a27bbf8a31b50d45214dc372a1ecc (patch)
tree4b4d98b3780e0f88b8620e51c0cfbfe8c0209338 /script
parent0866e2dad23e86cb423665268bbd6235b2188869 (diff)
downloadsamba-7210c95e600a27bbf8a31b50d45214dc372a1ecc.tar.gz
samba-7210c95e600a27bbf8a31b50d45214dc372a1ecc.tar.bz2
samba-7210c95e600a27bbf8a31b50d45214dc372a1ecc.zip
autobuild: Add --always-email option.
Diffstat (limited to 'script')
-rwxr-xr-xscript/autobuild.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/script/autobuild.py b/script/autobuild.py
index 40635439c2..10dd7a3133 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -319,6 +319,8 @@ parser.add_option("", "--retry", help="automatically retry if master changes",
default=False, action="store_true")
parser.add_option("", "--email", help="send email to the given address on failure",
type='str', default=None)
+parser.add_option("", "--always-email", help="always send email, even on success",
+ action="store_true")
parser.add_option("", "--daemon", help="daemonize after initial setup",
action="store_true")
@@ -354,6 +356,35 @@ or you can get full logs of all tasks in this job here:
s.sendmail(msg['From'], [msg['To']], msg.as_string())
s.quit()
+def email_success():
+ '''send an email to options.email about a successful build'''
+ user = os.getenv("USER")
+ text = '''
+Dear Developer,
+
+Your autobuild has succeeded.
+
+'''
+
+ if options.keeplogs:
+ text += '''
+
+you can get full logs of all tasks in this job here:
+
+ http://git.samba.org/%s/samba-autobuild/logs.tar.gz
+
+''' % (user,)
+ msg = MIMEText(text)
+ msg['Subject'] = 'autobuild success'
+ msg['From'] = 'autobuild@samba.org'
+ msg['To'] = options.email
+
+ s = smtplib.SMTP()
+ s.connect()
+ s.sendmail(msg['From'], [msg['To']], msg.as_string())
+ s.quit()
+
+
(options, args) = parser.parse_args()
if options.retry:
@@ -420,6 +451,8 @@ if status == 0:
if options.keeplogs:
blist.tarlogs("logs.tar.gz")
print("Logs in logs.tar.gz")
+ if options.always_email:
+ email_success()
blist.remove_logs()
cleanup()
print(errstr)