Custom Tasks

As part of your dynamic delivery definition, you can execute arbitrary commands in a docker image of your choosing via custom tasks.

Defining a Custom Task

Custom task definitions consist of:

  1. Program configuration (docker image, command, optioanlly env variables)
  2. The release channel to run the task in
  3. Optional retry configurations (never retry, retry X times, retry forever). The default is to never retry and fail the pipeline if the custom task fails.

To define a custom task:

# pvnctl applications create/edit
...
pipelineTemplates:
- nameSuffix: -push
  tasks:
  ...
  - customTask:
      program:
        image: <your docker image>
        cmd: <command to run in the image>
        env: <env variables and secrets>  # optional
      releaseChannel: staging  # run custom task in the runtime associated with the staging release channel
  ...

Blocking Tasks

A common use for custom task is waiting on some external event to occur before moving on in the pipeline. This can be accomplished via retryConfig.

# pvnctl applications create/edit
...
pipelineTemplates:
- nameSuffix: -push
  tasks:
  ...
  - customTask:
      program:
        image: <your docker image>
        cmd: <command to run in the image>
        env: <env variables and secrets>  # optional
      releaseChannel: staging
      retryConfig:
        retryForever: true  # this will cause Prodvana to keep retrying the task until it succeeds, subject to backoff
        firstFailureNotification:  # optionally send a notification on first failure (e.g. to prompt someone to take action)
          message: Waiting on <some external event>
  ...

firstFailureNotification will send a message to backend/channel specified in the application-level notifications settings.
It is better to have a custom task be short and rely on retryConfig than to implement the retry yourself in a long-running custom task.