Creating Sequences
This guide walks you through creating sequences that combine actions into ordered workflows.
Before You Begin
Section titled “Before You Begin”Make sure you have:
- At least one action to include
- Understanding of your deployment workflow
- Access to create sequences in Lens
Creating a Sequence
Section titled “Creating a Sequence”Step 1: Navigate to Sequences
Section titled “Step 1: Navigate to Sequences”- Open Lens in your browser
- Click Sequences in the sidebar
- Click New Sequence
Step 2: Basic Information
Section titled “Step 2: Basic Information”| Field | Description | Example |
|---|---|---|
| Name | Display name; used to derive the slug | deploy-web-application |
| Initial Version | Starting semantic version | 1.0.0 |
Step 3: Add Action Steps
Section titled “Step 3: Add Action Steps”- Click Add Action — a blank action row appears inline (there is no pop-up dialog)
- Select an action from the row’s dropdown
- Specify the version requirement in the same row
Repeat to add more actions. Each row has ↑/↓ buttons to set the order.
Step 4: Configure Version Requirements
Section titled “Step 4: Configure Version Requirements”For each action, set a version requirement:
| Requirement | Use Case |
|---|---|
^1.0.0 | Get compatible updates (recommended) |
~1.5.0 | Patch updates only |
=1.2.3 | Exact version (strict) |
>=1.0.0 | Any version 1.0.0 or newer |
Step 5: Order Steps
Section titled “Step 5: Order Steps”Use the up/down arrow buttons next to each step to arrange them:
┌─────────────────────────────────────────────────────────┐│ Sequence Steps │├─────────────────────────────────────────────────────────┤│ ││ 1. [≡] health-check (^1.0.0) [↑] [↓] [✕] ││ 2. [≡] stop-service (^1.0.0) [↑] [↓] [✕] ││ 3. [≡] deploy-files (^2.0.0) [↑] [↓] [✕] ││ 4. [≡] start-service (^1.0.0) [↑] [↓] [✕] ││ 5. [≡] smoke-test (^1.0.0) [↑] [↓] [✕] ││ ││ [+ Add Action] ││ │└─────────────────────────────────────────────────────────┘Step 6: Save
Section titled “Step 6: Save”Click Create Sequence to create your sequence.
Example Sequences
Section titled “Example Sequences”Web Application Deployment
Section titled “Web Application Deployment”| Step | Action | Version | Purpose |
|---|---|---|---|
| 1 | pre-flight-check | ^1.0.0 | Verify target is ready |
| 2 | backup-config | ^1.0.0 | Save current configuration |
| 3 | stop-application | ^1.0.0 | Graceful shutdown |
| 4 | deploy-files | ^2.0.0 | Copy new application files |
| 5 | update-config | ^1.0.0 | Apply configuration changes |
| 6 | start-application | ^1.0.0 | Start the service |
| 7 | health-check | ^1.0.0 | Verify deployment succeeded |
Database Migration
Section titled “Database Migration”| Step | Action | Version | Purpose |
|---|---|---|---|
| 1 | backup-database | ^2.0.0 | Create backup before changes |
| 2 | validate-migrations | ^1.0.0 | Check migration scripts |
| 3 | apply-migrations | ^1.0.0 | Run database migrations |
| 4 | verify-schema | ^1.0.0 | Confirm schema changes |
Service Restart
Section titled “Service Restart”| Step | Action | Version | Purpose |
|---|---|---|---|
| 1 | drain-connections | ^1.0.0 | Stop accepting new requests |
| 2 | stop-service | ^1.0.0 | Stop the service |
| 3 | start-service | ^1.0.0 | Start the service |
| 4 | health-check | ^1.0.0 | Verify service is healthy |
Step Configuration
Section titled “Step Configuration”Each action appears at most once
Section titled “Each action appears at most once”An action can appear only once per sequence version. The Lens editor
rejects a second step with the same action (keyed on the action id — even a
different version requirement of the same action is blocked), and the database
primary key (sequence_version_id, action_version_id) prevents the identical
action version appearing twice. If you need an action to run again (for example a
pre- and post-deployment health check), create a separate action for the
second use.
Sequence Editor Interface
Section titled “Sequence Editor Interface”┌─────────────────────────────────────────────────────────┐│ Edit Sequence: deploy-web-application │├─────────────────────────────────────────────────────────┤│ ││ Name: [deploy-web-application ] ││ Version: 1.0.0 ││ ││ ───────────────────────────────────────────────────── ││ ││ Steps: ││ ││ ┌─────┬─────────────────────┬────────────┬─────────┐ ││ │ # │ Action │ Version │ Actions │ ││ ├─────┼─────────────────────┼────────────┼─────────┤ ││ │ 1 │ pre-flight-check │ ^1.0.0 │ [↑][↓][✕]│ ││ │ 2 │ stop-application │ ^1.0.0 │ [↑][↓][✕]│ ││ │ 3 │ deploy-files │ ^2.0.0 │ [↑][↓][✕]│ ││ │ 4 │ start-application │ ^1.0.0 │ [↑][↓][✕]│ ││ │ 5 │ health-check │ ^1.0.0 │ [↑][↓][✕]│ ││ └─────┴─────────────────────┴────────────┴─────────┘ ││ ││ [+ Add Action] ││ ││ [Cancel] [Save] │└─────────────────────────────────────────────────────────┘Validation
Section titled “Validation”Before saving, Mantis validates:
| Check | Description |
|---|---|
| Actions exist | All referenced actions are available |
| Versions available | Matching versions exist for requirements |
| Slug uniqueness | No other sequence with the same slug in this scope (derived from the name unless overridden) |
After Creation
Section titled “After Creation”Your sequence is ready to:
- Be added to solutions
- Be deployed directly
- Be versioned with updates
Common Patterns
Section titled “Common Patterns”Pre/Post Deployment Hooks
Section titled “Pre/Post Deployment Hooks”1. pre-deploy-hook # Notify monitoring systems2. ... actual deployment steps ...3. post-deploy-hook # Update dashboardsRollback Preparation
Section titled “Rollback Preparation”1. create-snapshot # Save current state2. ... deployment steps ...3. verify-deployment # Check successNext Steps
Section titled “Next Steps”- Ordering Actions - Step ordering strategies
- Versioning - Managing sequence versions
- Overview - Return to sequences overview
