Bug 1525373 - Add an option to `using: run-task` to keep running tasks as root. r=tomprince

The tasks on bitbar currently rely on being run as root, and run-task
defaults to drop its privileges to the `worker` user.

Depends on D28024

Differential Revision: https://phabricator.services.mozilla.com/D28025

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-06-06 13:25:27 +00:00
Родитель 1706a86277
Коммит 257b1d707e
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -55,6 +55,8 @@ run_task_schema = Schema({
'internal',
),
# Whether to run as root. (defaults to False)
Optional('run-as-root'): bool,
})
@ -78,6 +80,7 @@ worker_defaults = {
'comm-checkout': False,
'sparse-profile': None,
'tooltool-downloads': False,
'run-as-root': False,
}
@ -114,6 +117,8 @@ def docker_worker_run_task(config, job, taskdesc):
if run['comm-checkout']:
command.append('--comm-checkout={workdir}/checkouts/gecko/comm'.format(**run))
command.append('--fetch-hgfingerprint')
if run['run-as-root']:
command.extend(('--user', 'root', '--group', 'root'))
command.append('--')
command.extend(run_command)
worker['command'] = command
@ -163,6 +168,8 @@ def generic_worker_run_task(config, job, taskdesc):
run_command = '"{}"'.format(run_command)
run_command = ['bash', '-cx', run_command]
if run['run-as-root']:
command.extend(('--user', 'root', '--group', 'root'))
command.append('--')
command.extend(run_command)