Bug 1333424 - Implicitly add relevant taskcluster configuration files to 'files-changed' attribute, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 24 Jan 2017 10:42:45 -0500
changeset 465635 f7aef99f76a43e0d692d36a802f035ce66e45df8
parent 465527 8ff550409e1d1f8b54f6f7f115545dbef857be0b
child 543204 0d4cd943b9b2064cd2763ce3d314627cf8170298
push id42660
push userahalberstadt@mozilla.com
push dateTue, 24 Jan 2017 16:05:48 +0000
reviewersdustin
bugs1333424
milestone54.0a1
Bug 1333424 - Implicitly add relevant taskcluster configuration files to 'files-changed' attribute, r?dustin This will ensure that if the taskgraph module, taskcluster configs related to a task or docker image related to a task are modified, the task will run. MozReview-Commit-ID: 1H6LnYsxxpc
taskcluster/ci/android-stuff/kind.yml
taskcluster/ci/source-check/mozlint.yml
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/ci/android-stuff/kind.yml
+++ b/taskcluster/ci/android-stuff/kind.yml
@@ -56,17 +56,16 @@ jobs:
               - "/home/worker/bin/before.sh && /home/worker/bin/build.sh && /home/worker/bin/after.sh && true\n"
             max-run-time: 36000
         scopes:
           - docker-worker:relengapi-proxy:tooltool.download.internal
           - docker-worker:relengapi-proxy:tooltool.download.public
         when:
             files-changed:
               - "mobile/android/config/**"
-              - "taskcluster/docker/android-gradle-build/**"
               - "testing/mozharness/configs/builds/releng_sub_android_configs/*gradle_dependencies.py"
               - "**/*.gradle"
 
     android-test:
         description: "Android armv7 unit tests"
         attributes:
             build_platform: android-test
             build_type: opt
--- a/taskcluster/ci/source-check/mozlint.yml
+++ b/taskcluster/ci/source-check/mozlint.yml
@@ -35,17 +35,16 @@ mozlint-eslint/opt:
             # Run when eslint policies change.
             - '**/.eslintignore'
             - '**/*eslintrc*'
             # The plugin implementing custom checks.
             - 'tools/lint/eslint/eslint-plugin-mozilla/**'
             # Other misc lint related files.
             - 'python/mozlint/**'
             - 'tools/lint/**'
-            - 'taskcluster/docker/lint/**'
 
 mozlint-flake8/opt:
     description: flake8 run over the gecko codebase
     treeherder:
         symbol: f8
         kind: test
         tier: 1
         platform: lint/opt
@@ -61,17 +60,16 @@ mozlint-flake8/opt:
         - integration
         - release
     when:
         files-changed:
             - '**/*.py'
             - '**/.flake8'
             - 'python/mozlint/**'
             - 'tools/lint/**'
-            - 'taskcluster/docker/lint/**'
 
 wptlint-gecko/opt:
     description: web-platform-tests linter
     treeherder:
         symbol: W
         kind: test
         tier: 1
         platform: lint/opt
@@ -89,9 +87,8 @@ wptlint-gecko/opt:
     when:
         files-changed:
             - 'testing/web-platform/tests/**'
             - 'testing/web-platform/mozilla/tests/**'
             - 'testing/web-platform/meta/MANIFEST.json'
             - 'testing/web-platform/mozilla/meta/MANIFEST.json'
             - 'python/mozlint/**'
             - 'tools/lint/**'
-            - 'taskcluster/docker/lint/**'
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -737,16 +737,35 @@ def add_index_routes(config, tasks):
         else:
             extra_index['rank'] = rank
 
         del task['index']
         yield task
 
 
 @transforms.add
+def add_files_changed(config, tasks):
+    for task in tasks:
+        if 'files-changed' not in task.get('when', {}):
+            yield task
+            continue
+
+        task['when']['files-changed'].extend([
+            '{}/**'.format(config.path),
+            'taskcluster/taskgraph/**',
+        ])
+
+        if 'in-tree' in task['worker'].get('docker-image', {}):
+            task['when']['files-changed'].append('taskcluster/docker/{}/**'.format(
+                task['worker']['docker-image']['in-tree']))
+
+        yield task
+
+
+@transforms.add
 def build_task(config, tasks):
     for task in tasks:
         worker_type = task['worker-type'].format(level=str(config.params['level']))
         provisioner_id, worker_type = worker_type.split('/', 1)
 
         routes = task.get('routes', [])
         scopes = task.get('scopes', [])