Skip to content

Actions

An Action is the fundamental building block of automation in Mantis. It represents a single, versioned executable unit that performs a specific task on deployment targets.

Actions define what gets executed on your targets. They can be as simple as a single command or as complex as a multi-step script. Each action is:

  • Versioned - Supports semantic versioning for controlled updates
  • Reusable - Can be referenced by multiple sequences and solutions
  • Configurable - Accepts arguments and environment variables
  • Auditable - All executions are logged with full history

Every action consists of:

ComponentDescription
NameDescriptive identifier (e.g., “Deploy Docker Container”)
VersionSemantic version number (e.g., “1.0.0”, “2.1.3”)
PayloadThe actual execution content (command, script, or restart)
ExecutorHow the payload runs (shell type or direct execution)

Actions support three payload types:

Executes a binary or executable with arguments. Best for single, well-defined operations.

FieldDescriptionExample
BinaryPath to executable/usr/bin/docker
ArgumentsCommand-line arguments["pull", "nginx:latest"]
Environment VariablesKey-value pairs{"DOCKER_HOST": "unix:///var/run/docker.sock"}
Working DirectoryExecution directory/opt/app

Example Use Cases:

  • Run a Docker command
  • Execute a system utility
  • Call an API endpoint with curl

Executes a script file from a configured storage backend. Best for complex, multi-step operations.

FieldDescriptionExample
StorageStorage backend referenceGit repository, local path, or S3 bucket
File NameScript filenamedeploy.sh
ArgumentsScript arguments["--environment", "production"]
Environment VariablesKey-value pairs{"LOG_LEVEL": "info"}
Relative PathPath within storagescripts/deployment/

Example Use Cases:

  • Complex deployment workflows
  • Configuration management
  • Database migrations

Triggers a system restart on the target. Used for scenarios requiring a full system reboot.

The executor determines how commands and scripts are run:

ExecutorShellPlatformSecurity Level
DefaultNone (direct)Cross-platformHighest - no shell interpretation
shPOSIX shellLinux/macOS (WSL on Windows)Good - metacharacter validation
bashBash shellLinux/macOS (WSL/Git Bash on Windows)Good - metacharacter validation
pwshPowerShell CoreCross-platformGood - metacharacter validation
zshZ shell (-f)Linux/macOS (WSL/MSYS2 on Windows)Good - metacharacter validation

When using shell executors (sh, bash, pwsh, zsh), Mantis validates inputs for dangerous metacharacters:

  • Rejected: ;, |, &, $, `, (, ), {, }, <, >, \n, \r, ', ", \, !, *, ?, [, ], #, ~
  • Arguments are quoted to prevent expansion
  • Path traversal attempts (../) are blocked

Actions use semantic versioning (MAJOR.MINOR.PATCH):

  • MAJOR - Breaking changes to behavior or interface
  • MINOR - New features, backward compatible
  • PATCH - Bug fixes, backward compatible
  1. Rollback Support - Deploy a previous version if issues arise
  2. Controlled Updates - Test new versions before promoting
  3. Dependency Pinning - Sequences can specify version requirements (^1.0.0, >=2.0.0)

Each version is immutable once created. To modify an action:

  1. Navigate to the action detail page
  2. Click Add Version
  3. Specify the new version number
  4. Configure the payload
  5. Save the version

Use descriptive, action-oriented names:

GoodBad
deploy-nginx-containerscript1
backup-databasedb_stuff
restart-web-servicesfix

Design actions to be safely re-runnable:

  • Check if work is already done before doing it
  • Use docker pull instead of assuming image exists
  • Handle “already exists” errors gracefully
  • Set appropriate timeouts for long-running operations
  • Use meaningful exit codes (0 = success, non-zero = failure)
  • Log enough context for debugging