Bug 1532783: [taskgraph] Move handling of windows scopes to taskgraph.transfroms.task; r=dustin
authorTom Prince <mozilla@hocat.ca>
Fri, 08 Mar 2019 07:00:02 +0000
changeset 520978 29168c60c4e6
parent 520977 6b1f78426763
child 520979 615a12a92768
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1532783
milestone67.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 1532783: [taskgraph] Move handling of windows scopes to taskgraph.transfroms.task; r=dustin Currently the scopes are handled in some test-specific code. However, there is logic not to be in generic code. Differential Revision: https://phabricator.services.mozilla.com/D22447
taskcluster/taskgraph/transforms/job/mozharness_test.py
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/taskgraph/transforms/job/mozharness_test.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness_test.py
@@ -199,34 +199,26 @@ def mozharness_test_on_generic_worker(co
             'name': 'public/test_info',
             'path': 'build/blobber_upload_dir',
             'type': 'directory'
         })
 
     upstream_task = '<build-signing>' if mozharness['requires-signed-builds'] else '<build>'
     installer_url = get_artifact_url(upstream_task, mozharness['build-artifact-name'])
 
-    taskdesc['scopes'].extend(
-        ['generic-worker:os-group:{}/{}'.format(
-            job['worker-type'],
-            group
-        ) for group in test['os-groups']])
-
     worker['os-groups'] = test['os-groups']
 
     # run-as-administrator is a feature for workers with UAC enabled and as such should not be
     # included in tasks on workers that have UAC disabled. Currently UAC is only enabled on
     # gecko Windows 10 workers, however this may be subject to change. Worker type
     # environment definitions can be found in https://github.com/mozilla-releng/OpenCloudConfig
     # See https://docs.microsoft.com/en-us/windows/desktop/secauthz/user-account-control
     # for more information about UAC.
     if test.get('run-as-administrator', False):
         if job['worker-type'].startswith('aws-provisioner-v1/gecko-t-win10-64'):
-            taskdesc['scopes'].extend(
-                ['generic-worker:run-as-administrator:{}'.format(job['worker-type'])])
             worker['run-as-administrator'] = True
         else:
             raise Exception('run-as-administrator not supported on {}'.format(job['worker-type']))
 
     if test['reboot']:
         raise Exception('reboot: {} not supported on generic-worker'.format(test['reboot']))
 
     worker['max-run-time'] = test['max-run-time']
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -803,32 +803,40 @@ def build_generic_worker_payload(config,
             if 'artifact' in mount['content']:
                 if not mount['content']['artifact'].startswith('public/'):
                     task_def['scopes'].append(
                         'queue:get-artifact:{}'.format(mount['content']['artifact']))
 
     if mounts:
         task_def['payload']['mounts'] = mounts
 
-    if worker.get('os-groups', []):
+    if worker.get('os-groups'):
         task_def['payload']['osGroups'] = worker['os-groups']
+        task_def['scopes'].extend(
+            ['generic-worker:os-group:{}/{}'.format(
+                task['worker-type'],
+                group
+            ) for group in worker['os-groups']])
 
     features = {}
 
     if worker.get('chain-of-trust'):
         features['chainOfTrust'] = True
 
     if worker.get('taskcluster-proxy'):
         features['taskclusterProxy'] = True
         # this will soon be provided directly by the worker:
         # https://bugzilla.mozilla.org/show_bug.cgi?id=1460015
         worker['env']['TASKCLUSTER_PROXY_URL'] = 'http://taskcluster'
 
     if worker.get('run-as-administrator', False):
         features['runAsAdministrator'] = True
+        task_def['scopes'].append(
+            'generic-worker:run-as-administrator:{}'.format(task['worker-type']),
+        )
 
     if features:
         task_def['payload']['features'] = features
 
     # coalesce / superseding
     if 'coalesce' in task:
         task_def['payload']['supersederUrl'] = superseder_url(config, task)