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
--- 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