Serial Command
The serial command executes a list of commands sequentially, where each command waits for the previous one to complete before starting.
Attributes
Required
type: "serial": Identifies this as a serial batch commandname: Descriptive name for the command batch
Optional
working_directory: Directory inherited by all child commandsenv: Environment variables inherited by all child commandsruns_on_condition: When to run (success,error,always,exit-codes)runs_on_exit_codes: Specific exit codes that trigger executioncommands: List of commands to execute (either this orcommand_group)command_group: Reference to a named command group (either this orcommands)
Basic Example
Execution Flow
In serial execution:
- Commands execute in the order defined
- Each command waits for the previous to complete
- If a command fails, subsequent commands are skipped (unless they have
runs_on_condition: "error"orruns_on_condition: "always") - Skip codes propagate through the serial batch
Environment and Working Directory Inheritance
Child commands inherit environment variables and working directory:
Error Handling
Use conditional execution for error handling:
Nested Batches
Serial batches can contain other batches:
Using Command Groups
Reference reusable command groups:
Best Practices
- Group related tasks: Use serial for tasks that must run in order
- Handle errors: Add error handlers with
runs_on_condition: "error" - Use always for cleanup: Ensure cleanup runs with
runs_on_condition: "always" - Set common env at batch level: Inherit environment variables to child commands
- Use descriptive names: Name each step clearly for better visibility
Related
- Parallel Command - Execute commands concurrently
- Flow Control - Conditional execution and error handling
- Path Inheritance - Working directory resolution