Bug 1275774 - Add try-syntax parsing of email notifications to taskcluster r=dustin
authorBrian Stack <bstack@mozilla.com>
Wed, 21 Sep 2016 18:02:43 -0700
changeset 315543 5202c23288507d490509e97a51c44856ca809e94
parent 315542 d596d23a7efe561c6fed90466d488d5a36fbc839
child 315544 229984f2cc9379b3560787ab1f518a2066a80bec
push id30751
push usercbook@mozilla.com
push dateThu, 29 Sep 2016 09:43:23 +0000
treeherdermozilla-central@b67dc49095dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1275774
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275774 - Add try-syntax parsing of email notifications to taskcluster r=dustin MozReview-Commit-ID: 8ZXCNEvMDCg
taskcluster/taskgraph/try_option_syntax.py
--- a/taskcluster/taskgraph/try_option_syntax.py
+++ b/taskcluster/taskgraph/try_option_syntax.py
@@ -165,33 +165,33 @@ RIDEALONG_BUILDS = {
         'sm-tsan',
         'sm-asan',
         'sm-msan',
     ],
 }
 
 TEST_CHUNK_SUFFIX = re.compile('(.*)-([0-9]+)$')
 
-
 class TryOptionSyntax(object):
 
     def __init__(self, message, full_task_graph):
         """
         Parse a "try syntax" formatted commit message.  This is the old "-b do -p
         win32 -u all" format.  Aliases are applied to map short names to full
         names.
 
         The resulting object has attributes:
 
         - build_types: a list containing zero or more of 'opt' and 'debug'
         - platforms: a list of selected platform names, or None for all
         - unittests: a list of tests, of the form given below, or None for all
         - jobs: a list of requested job names, or None for all
         - trigger_tests: the number of times tests should be triggered (--rebuild)
-        - interactive; true if --interactive
+        - interactive: true if --interactive
+        - notifications: one of 'none', 'all', 'failure'
 
         Note that -t is currently completely ignored.
 
         The unittests and talos lists contain dictionaries of the form:
 
         {
             'test': '<suite name>',
             'platforms': [..platform names..], # to limit to only certain platforms
@@ -200,16 +200,17 @@ class TryOptionSyntax(object):
         """
         self.jobs = []
         self.build_types = []
         self.platforms = []
         self.unittests = []
         self.talos = []
         self.trigger_tests = 0
         self.interactive = False
+        self.notifications = 'none'
 
         # shlex used to ensure we split correctly when giving values to argparse.
         parts = shlex.split(self.escape_whitespace_in_brackets(message))
         try_idx = None
         for idx, part in enumerate(parts):
             if part == TRY_DELIMITER:
                 try_idx = idx
                 break
@@ -222,29 +223,32 @@ class TryOptionSyntax(object):
         parser.add_argument('-b', '--build', dest='build_types')
         parser.add_argument('-p', '--platform', nargs='?',
                             dest='platforms', const='all', default='all')
         parser.add_argument('-u', '--unittests', nargs='?',
                             dest='unittests', const='all', default='all')
         parser.add_argument('-t', '--talos', nargs='?', dest='talos', const='all', default='all')
         parser.add_argument('-i', '--interactive',
                             dest='interactive', action='store_true', default=False)
+        parser.add_argument('-e', '--all-emails', dest='notifications', action='store_const', const='all')
+        parser.add_argument('-f', '--failure-emails', dest='notifications', action='store_const', const='failure')
         parser.add_argument('-j', '--job', dest='jobs', action='append')
         # In order to run test jobs multiple times
         parser.add_argument('--rebuild', dest='trigger_tests', type=int, default=1)
         args, _ = parser.parse_known_args(parts[try_idx:])
 
         self.jobs = self.parse_jobs(args.jobs)
         self.build_types = self.parse_build_types(args.build_types)
         self.platforms = self.parse_platforms(args.platforms)
         self.unittests = self.parse_test_option(
             "unittest_try_name", args.unittests, full_task_graph)
         self.talos = self.parse_test_option("talos_try_name", args.talos, full_task_graph)
         self.trigger_tests = args.trigger_tests
         self.interactive = args.interactive
+        self.notifications = args.notifications or self.notifications
 
     def parse_jobs(self, jobs_arg):
         if not jobs_arg or jobs_arg == ['all']:
             return None
         expanded = []
         for job in jobs_arg:
             expanded.extend(j.strip() for j in job.split(','))
         return expanded
@@ -537,9 +541,10 @@ class TryOptionSyntax(object):
 
         return "\n".join([
             "build_types: " + ", ".join(self.build_types),
             "platforms: " + none_for_all(self.platforms),
             "unittests: " + none_for_all(self.unittests),
             "jobs: " + none_for_all(self.jobs),
             "trigger_tests: " + str(self.trigger_tests),
             "interactive: " + str(self.interactive),
+            "notifications: " + self.notifications,
         ])