Closed Bug 1518572 Opened 7 years ago Closed 7 years ago

Overhaul |mach try| preset mechanism

Categories

(Developer Infrastructure :: Try, enhancement, P1)

enhancement

Tracking

(firefox67 fixed)

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

With many |mach try| subcommands, you can save and load presets. E.g:

$ ./mach try fuzzy --save foobar -q "'some 'query"
$ ./mach try fuzzy --preset foobar

However, there are a lot of problems with this system. Most of them stem from the fact that the storage backend isn't adequate enough. It's a key/value store in an ini file (with subcommand names as the section headers). This makes it hard to save things that require more than one value.

Instead, I propose we use a format as follows (using yaml in the example):

foo:
    subcommand: fuzzy
    args:
        queries:
            - 'some 'query
            - 'someotherquery
        artifact: false
        env:
            CUSTOM_ENV: value
bar:
    subcommand: syntax
    args:
        syntax: -b o -p linux -u mochitest
        ...

This simply stores the subcommand to run, and the arguments to pass into that subcommand. This makes it flexible enough to store as much (or as little) information along with the preset as desired.

Another benefit is that subcommands don't have to worry about loading presets at all. We could even restrict the ability to use --preset unless passed to the root |mach try| command. We could possibly even handle --save outside of the subcommands (though I'm on the fence about this, because it would mean no --save with fuzzy interactive mode).

Completing this task will allow us to fix several outstanding preset bugs, as well as provide a lot of new goodness.

Severity: normal → enhancement
Priority: -- → P2
Blocks: 1524949
Assignee: nobody → ahal
Priority: P2 → P1
Status: NEW → ASSIGNED

Status update: this is mostly done. Just need to update some tests/documentation and get it reviewed. Hopefully landed in the next week or two.

No longer blocks: 1507710, 1518542
Blocks: 1529047

For mach commands that have 'pass_context=True', we should implicitly add the
handler instance to the context. This will give mach command implementations an
easy way to access things like the command/subcommand names, the parser, argv
list, etc.

I forgot to remove this after re-implementing without this dependency.

Depends on D20521

Pushed by ahalberstadt@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9afd71742756 [mach] Stuff the 'handler' instance into the context when applicable r=firefox-build-system-reviewers,mshal https://hg.mozilla.org/integration/autoland/rev/d7a45b84e063 [tryselect] Remove unused 'flask-wtf' dependency from |mach try chooser| r=gbrown https://hg.mozilla.org/integration/autoland/rev/1b5a4da48de3 [tryselect] Store all arguments when saving a preset r=gbrown https://hg.mozilla.org/integration/autoland/rev/24105ffcf6f5 [tryselect] Migrate old preset files to the new format r=gbrown

Sadly there was a bug in the preset migration despite the test. If you are here because of warnings about presets not being migrated, please see:
https://bugzilla.mozilla.org/show_bug.cgi?id=1530775#c3

Depends on: 1530775
Depends on: 1531364
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: