Bug 1508504: [tryselect] Handle try syntax --setenv like --env; r=ahal

This converts `--setenv` into `env` in `try_task_config` at parameter
generation time.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2020-03-14 01:18:44 +00:00
parent a917dc47e9
commit 5f37a68c8b
6 changed files with 3 additions and 32 deletions

View File

@ -115,7 +115,6 @@ def _try_option_syntax(full_task_graph, parameters, graph_config):
attributes = {
k: getattr(options, k) for k in [
'env',
'no_retry',
'tag',
]

View File

@ -101,6 +101,7 @@ class TestGetDecisionParameters(unittest.TestCase):
self.assertEqual(params['try_task_config'], {
'gecko-profile': False,
'use-artifact-builds': True,
'env': {},
})
@patch('taskgraph.decision.get_hg_revision_branch')

View File

@ -334,8 +334,7 @@ class TestTryOptionSyntax(unittest.TestCase):
def test_setenv(self):
"--setenv VAR=value adds a environment variables setting to env"
parameters = parse_message('try: --setenv VAR1=value1 --setenv VAR2=value2')
tos = TryOptionSyntax(parameters, graph_with_jobs, GRAPH_CONFIG)
self.assertEqual(tos.env, ['VAR1=value1', 'VAR2=value2'])
assert parameters["try_task_config"]["env"] == {"VAR1": "value1", "VAR2": "value2"}
def test_profile(self):
"--geckoProfile sets profile to true"

View File

@ -146,18 +146,6 @@ def use_profile_data(config, jobs):
yield job
@transforms.add
def set_env(config, jobs):
"""Set extra environment variables from try command line."""
env = []
if config.params['try_mode'] == 'try_option_syntax':
env = config.params['try_options']['env'] or []
for job in jobs:
if env:
job['worker']['env'].update(dict(x.split('=') for x in env))
yield job
@transforms.add
def enable_full_crashsymbols(config, jobs):
"""Enable full crashsymbols on jobs with

View File

@ -224,6 +224,7 @@ def parse_message(message):
try_task_config = {
"use-artifact-builds": try_options.pop("artifact"),
"gecko-profile": try_options.pop("profile"),
"env": dict(arg.split("=") for arg in try_options.pop("env") or [])
}
return {
"try_options": try_options,
@ -247,7 +248,6 @@ class TryOptionSyntax(object):
- interactive: true if --interactive
- notifications: either None if no notifications or one of 'all' or 'failure'
- talos_trigger_tests: the number of time talos tests should be triggered (--rebuild-talos)
- env: additional environment variables (ENV=value)
- tag: restrict tests to the specified tag
- no_retry: do not retry failed jobs
@ -272,7 +272,6 @@ class TryOptionSyntax(object):
self.notifications = None
self.talos_trigger_tests = 0
self.raptor_trigger_tests = 0
self.env = []
self.tag = None
self.no_retry = False
@ -291,7 +290,6 @@ class TryOptionSyntax(object):
self.notifications = options['notifications']
self.talos_trigger_tests = options['talos_trigger_tests']
self.raptor_trigger_tests = options['raptor_trigger_tests']
self.env = options['env']
self.tag = options['tag']
self.no_retry = options['no_retry']
self.include_nightly = options['include_nightly']
@ -686,7 +684,6 @@ class TryOptionSyntax(object):
"notifications: " + str(self.notifications),
"talos_trigger_tests: " + str(self.talos_trigger_tests),
"raptor_trigger_tests: " + str(self.raptor_trigger_tests),
"env: " + str(self.env),
"tag: " + str(self.tag),
"no_retry: " + str(self.no_retry),
])

View File

@ -69,19 +69,6 @@ class TryToolsMixin(TransferMixin):
'web-plaftform-tests',
'xpcshell',
)),
'--setenv': ({
'action': 'append',
'dest': 'setenv',
'default': [],
'metavar': 'NAME=VALUE',
}, (
'browser-chrome',
'chrome',
'crashtest',
'devtools-chrome',
'mochitest',
'reftest',
)),
}
def _extract_try_message(self):