Bug 1436037 - [taskgraph] Support OSX generic-worker in run-task, r=Callek

This enables OSX generic-worker based tasks to use the run-task script.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2018-12-21 13:43:04 +00:00
Родитель a90b373483
Коммит 828485d8db
3 изменённых файлов: 24 добавлений и 13 удалений

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

@ -92,6 +92,7 @@ or added to the task's docker image then added to the PATH.
EXIT_PURGE_CACHE = 72
IS_MACOSX = sys.platform == 'darwin'
IS_POSIX = os.name == 'posix'
IS_WINDOWS = os.name == 'nt'
@ -402,7 +403,9 @@ def vcs_checkout(source_repo, dest, store_path,
print('revision is not specified for checkout')
sys.exit(1)
if IS_POSIX:
if IS_MACOSX:
hg_bin = '/tools/python27-mercurial/bin/hg'
elif IS_POSIX:
hg_bin = 'hg'
elif IS_WINDOWS:
# This is where OCC installs it in the AMIs.
@ -411,6 +414,7 @@ def vcs_checkout(source_repo, dest, store_path,
print('could not find Mercurial executable: %s' % hg_bin)
sys.exit(1)
store_path = os.path.abspath(store_path)
args = [
hg_bin,
'robustcheckout',

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

@ -64,12 +64,20 @@ def support_vcs_checkout(config, job, taskdesc, sparse=False):
This can only be used with ``run-task`` tasks, as the cache name is
reserved for ``run-task`` tasks.
"""
is_win = job['worker']['os'] == 'windows'
worker = job['worker']
is_mac = worker['os'] == 'macosx'
is_win = worker['os'] == 'windows'
is_linux = worker['os'] == 'linux'
assert is_mac or is_win or is_linux
if is_win:
checkoutdir = './build'
geckodir = '{}/src'.format(checkoutdir)
hgstore = 'y:/hg-shared'
elif is_mac:
checkoutdir = './checkouts'
geckodir = '{}/gecko'.format(checkoutdir)
hgstore = '{}/hg-shared'.format(checkoutdir)
else:
checkoutdir = '{workdir}/checkouts'.format(**job['run'])
geckodir = '{}/gecko'.format(checkoutdir)
@ -78,7 +86,7 @@ def support_vcs_checkout(config, job, taskdesc, sparse=False):
level = config.params['level']
# native-engine and generic-worker do not support caches (yet), so we just
# do a full clone every time :(
if job['worker']['implementation'] in ('docker-worker', 'docker-engine'):
if worker['implementation'] in ('docker-worker', 'docker-engine'):
name = 'level-%s-checkouts' % level
# comm-central checkouts need their own cache, because clobber won't

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

@ -20,7 +20,7 @@ run_task_schema = Schema({
# tend to hide their caches. This cache is never added for level-1 jobs.
Required('cache-dotcache'): bool,
# if true (the default), perform a checkout in {workdir}/checkouts/gecko
# if true (the default), perform a checkout of gecko on the worker
Required('checkout'): bool,
# The sparse checkout profile to use. Value is the filename relative to the
@ -41,12 +41,12 @@ run_task_schema = Schema({
})
def common_setup(config, job, taskdesc, command, geckodir):
def common_setup(config, job, taskdesc, command):
run = job['run']
if run['checkout']:
support_vcs_checkout(config, job, taskdesc,
sparse=bool(run['sparse-profile']))
command.append('--vcs-checkout={}'.format(geckodir))
command.append('--vcs-checkout={}'.format(taskdesc['worker']['env']['GECKO_PATH']))
if run['sparse-profile']:
command.append('--sparse-profile=build/sparse-profiles/%s' %
@ -73,8 +73,7 @@ def docker_worker_run_task(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker'] = job['worker']
command = ['/builds/worker/bin/run-task']
common_setup(config, job, taskdesc, command,
geckodir='{workdir}/checkouts/gecko'.format(**run))
common_setup(config, job, taskdesc, command)
if run.get('cache-dotcache'):
worker['caches'].append({
@ -101,8 +100,7 @@ def native_engine_run_task(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker'] = job['worker']
command = ['./run-task']
common_setup(config, job, taskdesc, command,
geckodir='{workdir}/checkouts/gecko'.format(**run))
common_setup(config, job, taskdesc, command)
worker['context'] = run_task_url(config)
@ -122,15 +120,16 @@ def generic_worker_run_task(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker'] = job['worker']
is_win = worker['os'] == 'windows'
is_mac = worker['os'] == 'macosx'
if is_win:
command = ['C:/mozilla-build/python3/python3.exe', 'run-task']
geckodir = './build/src'
elif is_mac:
command = ['/tools/python36/bin/python3.6', 'run-task']
else:
command = ['./run-task']
geckodir = '{workdir}/checkouts/gecko'.format(**run)
common_setup(config, job, taskdesc, command, geckodir=geckodir)
common_setup(config, job, taskdesc, command)
worker.setdefault('mounts', [])
if run.get('cache-dotcache'):