package
1.33.0-rc3
Repository: https://github.com/ovh/utask.git
Documentation: pkg.go.dev

# README

echo Plugin

This plugin returns the output defined in its configuration, without performing any kind of work. It is useful for transforming and aggregating previous results, and for running tests on the engine.

Configuration

FieldDescription
outputan object with the complete output of the step
metadataan object containing the metadata returned by the step
unmarshalif true, then output is expected to be a single string containing valid JSON; this is useful for generating an object via templating, since uTask can normally only apply templating on strings
error_messagefor testing purposes, an error message to simulate execution failure
error_type(client/server) for testing purposes: client error blocks execution, server lets the step be retried

Example

An action of type echo requires the following kind of configuration. The default outcome is a successful step: by adding an error_message, the step will consider the action a failure and set the step in SERVER_ERROR state. This is the default error type, which will cause the step to be eligible for retry. To block the task, error_type can be set to client, causing the step state to be set to CLIENT_ERROR.

action:
  type: echo
  configuration:
    output: # an arbitrary yaml object representing the final output of the step
      foo: '{{.input.foo}}-suffix'
      bar: 'prefix-{{.input.bar}}'
    metadata: # an arbitrary yaml object representing the step's returned metadata
      HTTPStatus: 200
    error_message: Epic fail! # an arbitrary error message
    error_type: client # client|server

Requirements

None.

# Variables

the echo plugin is used to "manually" build result outputs allowing to aggregate several results in a consolidated structure.

# Structs

Config describes transparently the outcome of execution output: an arbitrary object, equivalent to a successful return metadata: the metadata returned by execution, if any unmarshal: defines whether unmarshal the output if it's a string or byte array before returning error_message: the outcome of a non-successful execution error_type: choose between client|server, to trigger different behavior (blocked VS retry).