Bug 1275613 - Always schedule a 'file_patterns' job when its task definition has changed, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 25 May 2016 11:56:38 -0400
changeset 370945 2f7bddff063ab9b47475c29e5df3058501c0b502
parent 370842 d6d4e8417d2fd71fdf47c319b7a217f6ace9d5a5
child 521865 fe2e50043830e8c1d7b737e8c65cc09ec6c3a2a5
push id19184
push userahalberstadt@mozilla.com
push dateWed, 25 May 2016 16:19:14 +0000
reviewersdustin
bugs1275613
milestone49.0a1
Bug 1275613 - Always schedule a 'file_patterns' job when its task definition has changed, r?dustin Currently, jobs which has 'file_patterns' set will only be run if a file matching one of those patterns has been modified. This means that unless the task definition of the job was explicitly included in those 'file_patterns', the job won't run when we modify it! I think it is safe to assume that when making changes to a job's task, we want it to be run no matter what. So let's add the task definition to 'file_patterns' automatically. Here's a try run which modifies the marionette harness task: https://treeherder.mozilla.org/#/jobs?repo=try&revision=01e6cf9d8599c64d61ac8ecb5320c1c4209e0a8b MozReview-Commit-ID: AUSfUFzhiA1
taskcluster/taskgraph/kind/legacy.py
testing/taskcluster/mach_commands.py
--- a/taskcluster/taskgraph/kind/legacy.py
+++ b/taskcluster/taskgraph/kind/legacy.py
@@ -186,16 +186,18 @@ class LegacyKind(base.Kind):
 
             when = task['when']
 
             # If the task defines file patterns and we have a set of changed
             # files to compare against, only run if a file pattern matches one
             # of the changed files.
             file_patterns = when.get('file_patterns', None)
             if file_patterns and changed_files:
+                # Always consider changes to the task definition itself
+                file_patterns.append('testing/taskcluster/{task}'.format(task=task['task']))
                 for pattern in file_patterns:
                     for path in changed_files:
                         if mozpackmatch(path, pattern):
                             logger.debug('scheduling {task} because pattern {pattern} '
                                          'matches {path}'.format(
                                              task=task['task'],
                                              pattern=pattern,
                                              path=path,
--- a/testing/taskcluster/mach_commands.py
+++ b/testing/taskcluster/mach_commands.py
@@ -306,16 +306,18 @@ class Graph(object):
 
             when = task['when']
 
             # If the task defines file patterns and we have a set of changed
             # files to compare against, only run if a file pattern matches one
             # of the changed files.
             file_patterns = when.get('file_patterns', None)
             if file_patterns and changed_files:
+                # Always consider changes to the task definition itself
+                file_patterns.append('testing/taskcluster/{task}'.format(task=task['task']))
                 for pattern in file_patterns:
                     for path in changed_files:
                         if mozpackmatch(path, pattern):
                             sys.stderr.write('scheduling %s because pattern %s '
                                              'matches %s\n' % (task['task'],
                                                                pattern,
                                                                path))
                             return True