Skip to content
Permalink
Browse files

Bug 1530908 - Use a transform for try --artifact instead of a morph. …

…r=tomprince

While the morph was changing the treeherder symbol to `Ba` for all jobs,
doing so with a transform fails because of the conflicting symbol check
(as multiple jobs in the same category would end up with `Ba`). So
instead, we append `a` to the existing symbol.

We also change the documentation wrt templates for try pushes, as the
artifact template is now essentially gone (although technically, mach
try will still set params['templates']['artifacts']['enabled'] for now,
and the template still exists, albeit empty).

Differential Revision: https://phabricator.services.mozilla.com/D22054
  • Loading branch information...
glandium committed Mar 5, 2019
1 parent 93c337e commit fb52291bc932a9eb55f997ac76ff87a60dfc503c
@@ -98,7 +98,7 @@ from the ``try_task_config.json`` like this:
"version": 1,
"tasks": [...],
"templates": {
artifact: {"enabled": 1}
env: {"FOO": "bar"}
}
}

@@ -1,15 +1,3 @@
# This file is empty to keep mach try fuzzy happy until it doesn't use
# {"templates": {"artifact": {"enabled": "1"}}} to enable artifact builds.
---
$if: task["tags"]
then:
$if: task.tags["kind"] == "build"
then:
task:
$mergeDeep:
- $eval: task
- extra:
treeherder:
symbol: Ba
- payload:
env:
USE_ARTIFACT:
$eval: input.enabled
@@ -149,26 +149,6 @@ def inner(try_task_config, tasks=None):
return inner


def test_template_artifact(get_morphed):
morphed = get_morphed({
'templates': {
'artifact': {'enabled': 1}
},
})

assert len(morphed.tasks) == 2

for t in morphed.tasks.values():
if t.kind == 'build':
assert t.task['extra']['treeherder']['group'] == 'tc'
assert t.task['extra']['treeherder']['symbol'] == 'Ba'
assert t.task['payload']['env']['USE_ARTIFACT'] == 1
else:
assert t.task['extra']['treeherder']['group'] == 'tc'
assert t.task['extra']['treeherder']['symbol'] == 't'
assert 'USE_ARTIFACT' not in t.task['payload']['env']


def test_template_env(get_morphed):
morphed = get_morphed({
'templates': {
@@ -134,3 +134,17 @@ def enable_full_crashsymbols(config, jobs):
logger.debug("Disabling full symbol generation for %s", job['name'])
job['worker']['env']['MOZ_DISABLE_FULL_SYMBOLS'] = '1'
yield job


@transforms.add
def use_artifact(config, jobs):
if config.params['try_mode'] == 'try_task_config':
use_artifact = config.params['try_task_config'] \
.get('templates', {}).get('artifact', {}).get('enabled')
else:
use_artifact = False
for job in jobs:
if config.kind == 'build' and use_artifact:
job['treeherder']['symbol'] += 'a'
job['worker']['env']['USE_ARTIFACT'] = '1'
yield job

0 comments on commit fb52291

Please sign in to comment.
You can’t perform that action at this time.