Bug 1485757 - add run-as-administrator support to taskcluster to support xperf on windows 10-64. r=dustin
authorJoel Maher <jmaher@mozilla.com>
Tue, 11 Sep 2018 19:44:08 +0000
changeset 435809 a7876555f4d4557dd6d3aa284f95eb34ca99c051
parent 435808 da0f39e97a4a468a7f153a59bb4782478636681f
child 435810 4c8116f1b58276118faab24e90859ef4181992e8
push id34619
push userbtara@mozilla.com
push dateWed, 12 Sep 2018 03:11:51 +0000
treeherdermozilla-central@23860890d959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1485757
milestone64.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 1485757 - add run-as-administrator support to taskcluster to support xperf on windows 10-64. r=dustin we want to run xperf on windows 10 and need administrator access. Differential Revision: https://phabricator.services.mozilla.com/D5171
taskcluster/taskgraph/transforms/job/mozharness_test.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/transforms/tests.py
--- a/taskcluster/taskgraph/transforms/job/mozharness_test.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness_test.py
@@ -208,16 +208,30 @@ def mozharness_test_on_generic_worker(co
     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']
     worker['artifacts'] = artifacts
 
     env = worker.setdefault('env', {})
     env['MOZ_AUTOMATION'] = '1'
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -376,16 +376,19 @@ task_description_schema = Schema({
         Required('env'): {basestring: taskref_or_string},
 
         # the maximum time to run, in seconds
         Required('max-run-time'): int,
 
         # os user groups for test task workers
         Optional('os-groups'): [basestring],
 
+        # feature for test task to run as administarotr
+        Optional('run-as-administrator'): bool,
+
         # optional features
         Required('chain-of-trust'): bool,
         Optional('taskcluster-proxy'): bool,
 
         # Wether any artifacts are assigned to this worker
         Optional('skip-artifacts'): bool,
     }, {
         Required('implementation'): 'native-engine',
@@ -1033,16 +1036,19 @@ def build_generic_worker_payload(config,
     features = {}
 
     if worker.get('chain-of-trust'):
         features['chainOfTrust'] = True
 
     if worker.get('taskcluster-proxy'):
         features['taskclusterProxy'] = True
 
+    if worker.get('run-as-administrator', False):
+        features['runAsAdministrator'] = True
+
     if features:
         task_def['payload']['features'] = features
 
     # coalesce / superseding
     if 'coalesce' in task:
         task_def['payload']['supersederUrl'] = superseder_url(config, task)
 
 
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -336,16 +336,20 @@ test_description_schema = Schema({
     Optional('this-chunk'): int,
 
     # os user groups for test task workers; required scopes, will be
     # added automatically
     Optional('os-groups'): optionally_keyed_by(
         'test-platform',
         [basestring]),
 
+    Optional('run-as-administrator'): optionally_keyed_by(
+        'test-platform',
+        bool),
+
     # -- values supplied by the task-generation infrastructure
 
     # the platform of the build this task is testing
     'build-platform': basestring,
 
     # the label of the build task generating the materials to test
     'build-label': basestring,
 
@@ -438,16 +442,17 @@ def set_defaults(config, tests):
         if "-qr/" in test['test-platform']:
             test['webrender'] = True
         else:
             test.setdefault('webrender', False)
 
         test.setdefault('try-name', test['test-name'])
 
         test.setdefault('os-groups', [])
+        test.setdefault('run-as-administrator', False)
         test.setdefault('chunks', 1)
         test.setdefault('run-on-projects', 'built-projects')
         test.setdefault('instance-size', 'default')
         test.setdefault('max-run-time', 3600)
         test.setdefault('reboot', False)
         test.setdefault('virtualization', 'virtual')
         test.setdefault('loopback-audio', False)
         test.setdefault('loopback-video', False)
@@ -678,16 +683,17 @@ def handle_keyed_by(config, tests):
         'instance-size',
         'docker-image',
         'max-run-time',
         'chunks',
         'e10s',
         'suite',
         'run-on-projects',
         'os-groups',
+        'run-as-administrator',
         'mozharness.chunked',
         'mozharness.config',
         'mozharness.extra-options',
         'mozharness.requires-signed-builds',
         'mozharness.script',
         'worker-type',
         'virtualization',
     ]