Bug 1492362: [taskgraph] Only use absolute paths for checkouts in docker; r=glandium

We define a value `run.workdir` to point to the defaut directory to use for
all sorts of paths, including checkouts, in the job transform. However, that
directory only makes sense for docker-worker tasks, and relative paths should
be used elsewhere. Adjust the paths on non-docker-worker linux tasks to match
macOS paths.

Differential Revision: https://phabricator.services.mozilla.com/D86668
This commit is contained in:
Tom Prince 2020-08-19 11:02:29 +00:00
parent b9d69d8d9b
commit bcca419aba
10 changed files with 18 additions and 19 deletions

View File

@ -350,8 +350,8 @@ def make_task_description(config, jobs):
import_sibling_modules(exceptions=('common.py',))
for job in jobs:
# always-optimized tasks never execute, so have no workdir
if job['run']['using'] != 'always-optimized':
# only docker-worker uses a fixed absolute path to find directories
if job['worker']['implementation'] == 'docker-worker':
job['run'].setdefault('workdir', '/builds/worker')
taskdesc = copy.deepcopy(job)

View File

@ -82,20 +82,21 @@ def support_vcs_checkout(config, job, taskdesc, sparse=False):
is_mac = worker['os'] == 'macosx'
is_win = worker['os'] == 'windows'
is_linux = worker['os'] == 'linux' or 'linux-bitbar'
is_docker = worker['implementation'] == 'docker-worker'
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:
elif is_docker:
checkoutdir = '{workdir}/checkouts'.format(**job['run'])
geckodir = '{}/gecko'.format(checkoutdir)
hgstore = '{}/hg-store'.format(checkoutdir)
else:
checkoutdir = './checkouts'
geckodir = '{}/gecko'.format(checkoutdir)
hgstore = '{}/hg-shared'.format(checkoutdir)
cache_name = 'checkouts'

View File

@ -38,7 +38,7 @@ haz_run_schema = Schema({
Optional('secrets'): Any(bool, [text_type]),
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})

View File

@ -30,7 +30,7 @@ mach_schema = Schema({
Required('comm-checkout'): bool,
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})

View File

@ -116,7 +116,7 @@ mozharness_run_schema = Schema({
Required('comm-checkout'): bool,
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})

View File

@ -10,7 +10,7 @@ import re
import six
from six import text_type
from voluptuous import Required
from voluptuous import Required, Optional
from taskgraph.util.taskcluster import get_artifact_url
from taskgraph.transforms.job import (
@ -50,7 +50,7 @@ mozharness_test_run_schema = Schema({
Required('using'): 'mozharness-test',
Required('test'): test_description_schema,
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})
@ -215,7 +215,6 @@ def mozharness_test_on_docker(config, job, taskdesc):
@run_job_using('generic-worker', 'mozharness-test', schema=mozharness_test_run_schema)
def mozharness_test_on_generic_worker(config, job, taskdesc):
run = job['run']
test = taskdesc['run']['test']
mozharness = test['mozharness']
worker = taskdesc['worker'] = job['worker']
@ -406,7 +405,6 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
}]
job['run'] = {
'workdir': run['workdir'],
'tooltool-downloads': mozharness['tooltool-downloads'],
'checkout': test['checkout'],
'command': mh_command,

View File

@ -10,7 +10,7 @@ from __future__ import absolute_import, print_function, unicode_literals
from six import text_type
from taskgraph.transforms.job import run_job_using, configure_taskdesc_for_run
from taskgraph.util.schema import Schema
from voluptuous import Required
from voluptuous import Required, Optional
python_test_schema = Schema({
Required('using'): 'python-test',
@ -22,7 +22,7 @@ python_test_schema = Schema({
Required('subsuite'): text_type,
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})

View File

@ -54,7 +54,7 @@ run_task_schema = Schema({
Required('command'): Any([taskref_or_string], taskref_or_string),
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
# If not false, tooltool downloads will be enabled via relengAPIProxy
# for either just public files, or all files. Only supported on

View File

@ -29,7 +29,7 @@ sm_run_schema = Schema({
Optional('spidermonkey-platform'): text_type,
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
Required('tooltool-downloads'): Any(
False,

View File

@ -68,7 +68,7 @@ toolchain_run_schema = Schema({
): text_type,
# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})