From MozillaWiki
Jump to: navigation, search

What is mozharness?

  • It's a collection of Python modules that make it easy to extend and configure common automation tasks
    • (Henrik) It's mostly all configuration driven
  • Lives in mozilla-central under testing/mozharness:
  • Logging and config management (and much more) are already taken care of for you
  • Nice things: cross-platform, platform-specific configs, make it easy to create reproducible environment

How do I write a mozharness script? Some tips

  • See Resources below
  • Get mozharness without checking out all of mozilla-central (See below)
    • (Henrik) I would still propose to use mozilla-central or inbound if the target is to land the script in tree
  • Get your script to find mozharness (especially if your script lives in another repo, not in-tree): e.g.
  • Your script will probably consist of a class that extends BaseScript or VirtualenvMixin + config
  • Use multiple inheritance to plug-in the behaviour you need, then customize. Some examples:
  • Be careful: if your mozharness script creates a virtual env, you don't want to run it inside your own virtual env

How do I use mozharness scripts in my Jenkins instance?

  • Disclaimer: This is just how we set things up on pf-jenkins. There are other ways.
  • Use to put mozharness on your builders (see below)
  • Set an environment variable with the path to mozharness on the builders (in our case MOZHARNESSHOME)
  • Jenkins job checks out Github repo that contains our mozharness script (Note: our project will soon move from Github to mozilla-central)
  • mozharness script is called in build step


archiver_client example

1. Download archiver_client:

2. Run something like `python mozharness --rev 62cd40885e93` and it will download to ./mozharness