escapewindow: escape window (Default)
[personal profile] escapewindow

that allows production infrastructure and individual developers to use the same scripts.

What are actions?

Actions are discrete logical steps to a script, similar to [simple] makefile targets.

Since certain actions, like upload or notify might not be useful to certain consumers of a script, it's helpful to be able to turn those off.

Versatile, reusable configs are key to sharing scripts between automation and users with different workflows. Actions are another key ingredient.


What are default actions?

default_actions is a subset of all_actions, and specifies the list of actions to run if no action-specific command line options are specified.

Using the configtest.py script as an example:

deathduck:~/src/clean/mozharness [19:09:59] (default)
621$ scripts/configtest.py --list-actions
Actions available: list-config-files, test-json-configs, test-python-configs
Default actions: test-json-configs, test-python-configs

These are specified here.

It's now possible to specify your own default_actions in your config file, so if you want to run a script with a different set of default actions, you can do so without copy/pasting a ton of command line arguments.


How is the list of actions-to-run generated?

I have that documented here.

Using configtest.py as an example again:

# Only run the list-config-files action
configtest.py --list-config-files

# Run the list-config-files and test-json-configs actions
configtest.py --list-config-files --test-json-configs
# or
configtest.py --action list-config-files,test-json-configs
# or
configtest.py --action list-config-files --action test-json-configs

# Run list-config-files in addition to the default actions
configtest.py --add-action list-config-files

# Run the default actions, but not test-python-configs
configtest.py --no-test-python-configs

How are the actions run in the script?

That's handled by BaseScript.run():

  1. Change all dashes in the action name to underscores; that's the method to call
  2. If the action is not in the list of actions to run, skip + go to the next action.
  3. if preflight_METHODNAME exists, run that before running METHODNAME.
  4. Call METHODNAME.
  5. If postflight_METHODNAME exists, run that after running METHODNAME.

Mozharness home

November 2022

S M T W T F S
  12345
67 89101112
13141516171819
20212223242526
27282930   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 23rd, 2025 09:47 am
Powered by Dreamwidth Studios