blob: 605439730623f9721c7be3e4f4333a1510bff46f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import SKIPPED
import os, subprocess
class SendOePerfEmail(ShellCommand):
haltOnFailure = False
flunkOnFailure = True
name = "SendOePerfEmail"
description = ["Sending Performance Email"]
def __init__(self, factory, argdict=None, **kwargs):
self.factory = factory
description = ["Sending alert emails"]
for k, v in argdict.iteritems():
setattr(self, k, v)
# Timeout needs to be passed to LoggingBuildStep as a kwarg
self.timeout = 100000
kwargs['timeout']=self.timeout
ShellCommand.__init__(self, **kwargs)
def start(self):
if not os.environ.get("PERFORMANCE_SEND_EMAIL") == "True":
return SKIPPED
branch = self.getProperty("branch")
oe_build_perf_test_output = self.getProperty("oe_build_perf_test_output")
mailto = ""
mailcc = ""
mailbcc = ""
mailsig = ""
if os.environ.get('PERFORMANCE_MAIL_TO'):
mailto = os.environ.get('PERFORMANCE_MAIL_TO')
if os.environ.get('PERFORMANCE_MAIL_CC'):
mailcc = os.environ.get('PERFORMANCE_MAIL_CC')
if os.environ.get('PERFORMANCE_MAIL_BCC'):
mailbcc = os.environ.get('PERFORMANCE_MAIL_BCC')
if os.environ.get('PERFORMANCE_MAIL_SIG'):
mailsig = os.environ.get('PERFORMANCE_MAIL_SIG')
archive_dir = self.getProperty("oe_perf_archive_dir")
globalres_log = self.getProperty("oe_perf_globalres_log")
email_base = '''
Running on %s \n
%s
-----------------\n\n Global results file \n\n""$read_file"" \n
-----------------\n\n Archive results in %s \n''' % (oe_build_perf_test_output,
os.uname()[1], archive_dir)
mailsubject = "Build Performance Report - %s branch" % (branch)
email_header = ""
if mailto is not None and mailto is not "":
email_header += "To: " + mailto + "\n"
if mailcc is not None and mailcc is not "":
email_header += "Cc: " + mailcc + "\n"
if mailbcc is not None and mailbcc is not "":
email_header += "Bcc: " + mailbcc + "\n"
email_header += "Subject: " + mailsubject + "\n"
mailcmd = 'read_file=`cat %s`;' %(globalres_log)
mailcmd += ' echo "' + email_header + '\n' + email_base + '\n' + mailsig + '" | sendmail -t;'
self.command = mailcmd
ShellCommand.start(self)
|