Repeat

See Handling repeats.

Handling repeats

Selected Actions within the dispatcher support repeating an individual action (along with any internal pipelines created by that action) - these are determined within the codebase.

Repeating single actions

Selected actions (RetryAction) within a pipeline (as determined by the Strategy) support repetition of all actions below that point. There will only be one RetryAction per top level action in each pipeline. e.g. a top level Boot Action Reference action for U-Boot would support repeating the attempt to boot the device but not the actions which substitute values into the U-Boot commands as these do not change between boots (only between deployments).

Any action which supports failure_retry can support repeat but not in the same job. (failure_retry is a conditional repeat if the action fails, repeat is an unconditional repeat).

Retry on failure

Individual actions can be retried a specified number of times if the a JobError Exception or InfrastructureError Exception is raised during the run step by this action or any action within the internal pipeline of this action.

Specify the number of retries which are to be attempted if a failure is detected using the failure_retry parameter.

- deploy:
   failure_retry: 3

RetryActions will only repeat if a JobError Exception or InfrastructureError Exception exception is raised in any action inside the internal pipeline of that action. This allows for multiple actions in any one deployment to be RetryActions without repeating unnecessary tasks. e.g. download is a RetryAction to allow for intermittent internet issues with third party downloads.

Unconditional repeats

Individual actions can be repeated unconditionally using the repeat parameter. This behaves similarly to Retry on failure except that the action is repeated whether or not a failure was detected. This allows a device to be booted repeatedly or a test definition to be re-run repeatedly. This repetition takes the form:

- actions:
  - deploy:
      # deploy parameters
  - boot:
      method: qemu
      media: tmpfs
      repeat: 3
      prompts:
        - 'linaro-test'
        - 'root@debian:~#'
  - test:
      # test parameters

Resulting in:

[deploy], [boot, boot, boot], [test]

Repeating blocks of actions

To repeat block of actions, it’s adviced to use a templating engine, like jinja2, and to use it to generate a job definition where the block are repeated.