Closed Bug 1242083 Opened 8 years ago Closed 8 years ago

Support --setenv in try syntax to set environment variables

Categories

(Release Engineering :: Applications: MozharnessCore, defect)

defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
Tracking Status
firefox47 --- fixed

People

(Reporter: MattN, Assigned: chmanchester)

References

Details

Attachments

(1 file, 1 obsolete file)

For mochitest-browser-screenshots, the env. variable MOZSCREENSHOTS_SETS lets one pick which browser combinations to capture e.g. `MOZSCREENSHOTS_SETS=LightweightThemes,Tabs,WindowSize` and it would be convenient if developers could easily specify that in try syntax to get non-default screenshots.

There are some other environment variables used by our applications that could also use this feature.

Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=76971f07ef86
Comment on attachment 8711234 [details]
MozReview Request: Bug 1242083 - Support --setenv in try syntax to set environment variables. r=chmanchester

So the try push reminded me why this may not be ideal: the argument is passed to harnesses that give an error due to the unknown argument.

Should I implement a solution like --try-test-paths?
Attachment #8711234 - Flags: review?(cmanchester) → feedback?(cmanchester)
https://reviewboard.mozilla.org/r/32035/#review29089

::: testing/mozharness/mozharness/mozilla/testing/try_tools.py:48
(Diff revision 1)
>      known_try_arguments = {
> +        '--setenv': {
> +            'action': 'append',
> +            'dest': 'environment',
> +            'default': [],
> +            "metavar": "NAME=VALUE",
> +        },

As you've found this will cause problems for harnesses that don't take this argument. It looks like it would be pretty straightforward to have an idea here of what flavors an argument is acceptable for, make harness_extra_args a dict mapping flavors to args, and then take arguments based on flavor in the try_args function.

How does that sound?
Attachment #8711234 - Flags: feedback?(cmanchester)
MattN and I spoke about this to be possible for both try syntax as well as properties when scheduled out of band with mozci.

From looking at the code [1], TryToolsMixin is available for test jobs.
I will be reading tomorrow my comment in [2] and see what exactly we need to support properties for test jobs as well (since that comment was about talos).

This is just a heads up about our intentions.

[1] https://dxr.mozilla.org/mozilla-central/source/testing/mozharness/mozharness/mozilla/testing/testbase.py#102
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1241535#c2
Armen, comment 3 is all we need to do this from try syntax. Let me know if you'd like me to write the patch.
Matt, can you confirm comment 6 has the expected effect?
Yep!

> --setenv MOZSCREENSHOTS_SETS=LightweightThemes,Tabs,WindowSize

led to https://treeherder.mozilla.org/logviewer.html#?job_id=16306592&repo=try#L1501
> console.info: mozscreenshots: 3 sets: Array ["LightweightThemes","Tabs","WindowSize"]

Works great
Assignee: MattN+bmo → cmanchester
Comment on attachment 8715931 [details]
MozReview Request: Bug 1242083 - Add --setenv to the arguments accepted by mozharness to pass to the harness command, add a way to specify flavors an argument applies to. r=armenzg

https://reviewboard.mozilla.org/r/33659/#review30451

wfm

::: testing/mozharness/mozharness/mozilla/testing/try_tools.py:53
(Diff revision 1)
> -        },
> +        }, ('marionette', 'xpcshell', 'mochitest', 'browser-chrome',

Could you please re-org the suites alphabetically?
It will make it easier in the long term what suites are applicable to each argument.
Perhaps listing one per line.
Attachment #8715931 - Flags: review?(armenzg) → review+
Attachment #8711234 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/f0b059e04fa4
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Depends on: 1247808
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: