Scripts

The scripts directory contains various scripts that have various specific uses and help drive the development of Mozilla CI tools. All the scripts are located in mozci/scripts directory.

For each script, separate instructions are given if you have installed mozci via:

  1. “pip install” or
  2. Cloned the repository from source for development purposes

trigger.py

This script allows you to trigger a list of buildernames many times across a range of pushes. You can either:

  1. give a start and end revision
  2. go back N revisions from a given revision
  3. use a range based on a delta from a given revision
  4. find the last good known job and trigger everything missing up to it

If you have done “pip install”, run via commandline:

$ mozci-trigger

In cloned repository for development:

$ python trigger.py

Usage:

usage: trigger.py [-h] -b BUILDERNAME -r REV [--times TIMES] [--skips SKIPS]
                  [--from-rev FROM_REV] [--max-revisions MAX_REVISIONS]
                  [--dry-run] [--debug] [--delta DELTA]
                  [--back-revisions BACK_REVISIONS] [--backfill]

optional arguments:
  -h, --help            show this help message and exit
  -b BUILDERNAME, --buildername BUILDERNAME
                        Comma-separated list of buildernames used in Treeherder.
  -r REV, --revision REV
                        The 12 characters representing a revision (most
                        recent).
  --times TIMES         Total number of jobs to have on a push. Eg: If there
                        is 1 job and you want to trigger 1 more time, do
                        --times=2.
  --skips SKIPS         Specify the step size to skip after every retrigger.
  --from-rev FROM_REV   The 12 character representing the oldest push to start
                        from.
  --max-revisions MAX_REVISIONS
                        This flag is used with --backfill. This flag limits how
                        many revisions we will look back until we find the last
                        revision where there was a good job.
  --dry-run             flag to test without actual push.
  --debug               set debug for logging.
  --delta DELTA         Number of jobs to add/subtract from push revision.
  --back-revisions BACK_REVISIONS
                        Number of revisions to go back from current revision
                        (--rev).
  --backfill            We will trigger jobs starting from --rev in reverse
                        chronological order until we find the last revision
                        where there was a good job.

misc/write_tests_per_platform_graph.py

This script generates a graph of every platform and test in try.

The graph contains two main keys: ‘opt’ and ‘debug’. Inside each there is a key for each platform.

For every platform there is a key for every upstream builder, containing a list of its downstream builders and a key ‘tests’ that contains a list of every test that is run in that platform.

For example, the key ‘android-x86’ in ‘opt’ is:

"android-x86": {
          "Android 4.2 x86 try build": [
              "Android 4.2 x86 Emulator try opt test androidx86-set-4"
          ],
          "tests": ["androidx86-set-4"]
      },

triggerbyfilters.py

This script retriggers N times every job that matches –includes and doesn’t match –exclude.

If you have done “pip install”, run via commandline:

$ mozci-triggerbyfilters

In cloned repository for development:

$ python triggerbyfilters.py

Usage:

usage: th_filters.py [-h] REPO REVISION -i INCLUDES [-e EXCLUDE]
                     [--times TIMES] [--limit LIM] [--dry-run] [--debug]

positional arguments:
  repo                  Branch name
  rev                   The 12 character representing a revision (most
                        recent).

optional arguments:
  -h, --help            show this help message and exit
  -i INCLUDES, --includes INCLUDES
                        comma-separated treeherder filters to include.
  -e EXCLUDE, --exclude EXCLUDE
                        comma-separated treeherder filters to exclude.
  --times TIMES         Total number of jobs to have on a push. Eg: If there
                        is 1 job and you want to trigger 1 more time, do
                        --times=2.
  --limit LIM           Maximum number of buildernames to trigger.
  --dry-run             flag to test without actual push.
  --debug               set debug for logging.

For example, if you want to retrigger all web-platform-tests on cedar in a debug platform 5 times:

python triggerbyfilters.py cedar REVISION --includes "web-platform-tests,debug" --times 5

If you want the same thing but without web-platform-tests-2:

python triggerbyfilters.py cedar REVISION --includes "web-platform-tests,debug" --exclude "web-platform-tests-2" --times 5

Note: this script currently only does string matching on buildernames, so some queries may not be supported. If you encounter any problem, please file an issue.