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 463113 29168c60c4e65cf36d5df9787e1bcfca038ac31c
parent 463112 6b1f784267633a74b9f9395352a5332dcf44f5c9
child 463114 615a12a9276839868bef0858f3fb535a04106295
push id79999
push usermozilla@hocat.ca
push dateFri, 08 Mar 2019 07:01:52 +0000
treeherderautoland@29168c60c4e6 [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)