Skip to content

Commit

Permalink
Bug 1492362: [taskgraph] Only use absolute paths for checkouts in doc…
Browse files Browse the repository at this point in the history
…ker; 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
  • Loading branch information
tomprince committed Aug 18, 2020
1 parent 3bcefd6 commit d7a57ec
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions taskcluster/taskgraph/transforms/job/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,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)
Expand Down
11 changes: 6 additions & 5 deletions taskcluster/taskgraph/transforms/job/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,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'

Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/job/hazard.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
Optional('secrets'): Any(bool, [text_type]),

# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})


Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/job/mach.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Required('comm-checkout'): bool,

# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})


Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/job/mozharness.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
Required('comm-checkout'): bool,

# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})


Expand Down
6 changes: 2 additions & 4 deletions taskcluster/taskgraph/transforms/job/mozharness_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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 (
Expand Down Expand Up @@ -50,7 +50,7 @@ def get_variant(test_platform):
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,
})


Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions taskcluster/taskgraph/transforms/job/python_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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',
Expand All @@ -22,7 +22,7 @@
Required('subsuite'): text_type,

# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})


Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/job/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/job/spidermonkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
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,
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/transforms/job/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
): text_type,

# Base work directory used to set up the task.
Required('workdir'): text_type,
Optional('workdir'): text_type,
})


Expand Down

0 comments on commit d7a57ec

Please sign in to comment.