Retry Actions

Mint allows you to create customized retry actions to vary the behavior of your task when it is retried. Retry actions can be useful for things like for retrying only the tests that failed or for setting special debug environment variables on retry. For example, you may want to set DEBUG=true on retry to give you more information about a failure.

Retry action outputs

You can produce your own retry actions by writing to the $MINT_RETRY_ACTIONS directory from your task. The name of a directory inside $MINT_RETRY_ACTIONS is the key for that retry action, and the directory is expected to have the following structure:

  • $MINT_RETRY_ACTIONS/retry-action-key/label: A file whose contents will be the text for the retry action in the UI. If not specified, the label defaults to the retry action key.
  • $MINT_RETRY_ACTIONS/retry-action-key/env: A directory that behaves the same as $MINT_ENV; the environment variables in this directory will be provided to the task when the retry action occurs
  • $MINT_RETRY_ACTIONS/retry-action-key/data: A directory that will be provided to the task when the retry action occurs. Within the retry task attempt, you can access this directory at $MINT_RETRY_DATA.

Example

tasks:
  - key: contrived-example
    run: |
      mkdir -p $MINT_RETRY_ACTIONS/retry-with-debug/env
      mkdir -p $MINT_RETRY_ACTIONS/retry-with-debug/data
      echo "Retry with DEBUG=true" > $MINT_RETRY_ACTIONS/retry-with-debug/label
      echo "true" > $MINT_RETRY_ACTIONS/retry-with-debug/env/DEBUG

      if [[ -n $DEBUG ]]; then
        echo "entering DEBUG mode"
        echo "the file contents:"
        cat $MINT_RETRY_DATA/some-file.txt
      fi

      echo "some text" > $MINT_RETRY_ACTIONS/retry-with-debug/data/some-file.txt

Here's how this retry action will appear in the UI:

retry actions UI

When the action is selected, the retry attempt will produce these logs:

entering DEBUG mode
the file contents:
some text