Pipelines
Use Pipelines to orchestrate multiple steps in sequence
Last updated
Use Pipelines to orchestrate multiple steps in sequence
Last updated
A Pipeline in Sling allows you to execute multiple steps in sequence. Each step can be a different type of operation, enabling you to create complex workflows by chaining together various actions like running replications, executing queries, making HTTP requests, and more.
A pipeline is defined in YAML format with a steps
key at the root level containing an array of steps. Each step supports the same types and configurations as .
Pipelines support all the same types as Hooks:
Check
Validate conditions and control flow
Command
Run any command/process
Copy
Transfer files between local or remote storage connections
Delete
Remove files from local or remote storage connections
Group
Run sequences of steps or loop over values
HTTP
Make HTTP requests to external services
Inspect
Inspect a file or folder
List
List files in folder
Log
Output custom messages and create audit trails
Query
Execute SQL queries against any defined connection
Read
Read contents of files from storage connections
Replication
Run a Replication
Store
Store values for later in-process access
Write
Write content to files in storage connections
Each step shares the same common properties as hooks:
type
The type of step (query
/ http
/ check
/ copy
/ delete
/ log
/ inspect
)
Yes
if
Optional condition to determine if the step should execute
No
id
A specific identifier to refer to the step output data
No
on_failure
What to do if the step fails (abort
/ warn
/ quiet
/skip
)
No (defaults to abort
)
Pipeline steps have access to the runtime state which includes various variables that can be referenced using curly braces {variable}
. The available variables include:
runtime_state
- Contains all state variables available
env.*
- All variables defined in the env
timestamp.*
- Various timestamp parts information
steps.*
- Output data from previous steps (referenced by their id
)
You can view all available variables by using a log step:
Here's a complete example that demonstrates various pipeline capabilities:
Error Handling: Use appropriate on_failure
behaviors for each step
Validation: Include check steps to validate critical conditions
Logging: Add log steps for better observability
Modularity: Break down complex operations into multiple steps
Conditions: Use if
conditions to control step execution
Variables: Leverage environment variables and runtime state for dynamic configuration
Identifiers: Use meaningful id
s for steps when you need to reference their output later
You can run a pipeline using the Sling CLI: