Skip to content

Ordering Actions

The order of actions in a sequence determines execution flow. Proper ordering is critical for successful deployments.

Actions execute sequentially from first to last:

Each step must complete successfully before the next begins.

Internally, steps have a 0-based order index:

DisplayInternal IndexAction
Step 10health-check
Step 21stop-service
Step 32deploy-files
Step 43start-service

Sequence versions are immutable, so there is no standalone editor for reordering an existing version. To set or change action order, open the sequence detail page and click New Version From This on an existing version (or Add Version for a new one). Inside the modal, each action row has / buttons:

  • Click to move the action one position earlier
  • Click to move the action one position later

The numbered badge on each row updates as you reorder; submitting creates a new version with the new order.

When you reorder:

  1. All order indices are recalculated
  2. Execution sequence changes
  3. A new sequence version should be created

Order based on what each step requires:

Put low-risk, reversible steps first:

OrderActionRisk LevelReversible
1backup-databaseLowN/A (creates backup)
2validate-schemaLowYes
3apply-migrationsMediumWith backup
4update-connectionsHighDifficult

Structure sequences in three phases:

PRE-DEPLOYMENT
├── 1. health-check
├── 2. create-backup
└── 3. notify-stakeholders
DEPLOYMENT
├── 4. stop-service
├── 5. deploy-files
├── 6. update-config
└── 7. start-service
POST-DEPLOYMENT
├── 8. verify-deployment
├── 9. run-smoke-tests
└── 10. notify-completion
1. pre-flight-check # Verify target is ready
2. drain-connections # Stop accepting new requests
3. wait-for-drain # Let existing requests complete
4. stop-service # Stop the service
5. deploy-files # Update application files
6. start-service # Start the service
7. health-check # Verify service is healthy
8. restore-traffic # Resume accepting requests
1. backup-database # Safety net
2. stop-writes # Prevent data changes during migration
3. run-migrations # Apply schema changes
4. verify-schema # Confirm changes applied
5. resume-writes # Allow data changes again
6. update-app-servers # Point apps to new schema
1. deploy-to-inactive # Update the inactive environment
2. verify-inactive # Test the inactive environment
3. switch-traffic # Route traffic to newly updated env
4. verify-active # Confirm new active works
5. cleanup-old # Clean up the now-inactive old env

Put likely-to-fail steps early:

1. validate-config # Fail early if config is invalid
2. check-permissions # Fail early if no access
3. verify-connectivity # Fail early if network issue
4. ... rest of deployment ...

Order to enable rollback:

1. create-snapshot # ALWAYS FIRST - enables rollback
2. ... deployment steps ...
3. verify-success # Check if we need to rollback

If step 3 fails, you have a snapshot from step 1.

The sequence detail page shows execution order:

┌─────────────────────────────────────────────────────────┐
│ Sequence: deploy-application v1.2.0 │
├─────────────────────────────────────────────────────────┤
│ │
│ Execution Order: │
│ │
│ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │
│ │ 1 │ -> │ 2 │ -> │ 3 │ -> │ 4 │ -> │ 5 │ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ │
│ │ │ │ │ │ │
│ check backup deploy start verify │
│ │
└─────────────────────────────────────────────────────────┘
✓ 1. validate-target # Check first
2. modify-system # Then change
✓ 1. create-backup # Save state
2. make-changes # Then modify
1. deploy-application # Make changes
✓ 2. health-check # Then verify

Keep related operations together:

# Database operations together
1. backup-db
2. migrate-db
3. verify-db
# Application operations together
4. stop-app
5. deploy-app
6. start-app

Order to reduce service unavailability:

1. prepare-deployment # Pre-work while service runs
2. download-artifacts # Get files ready
3. stop-service # Brief downtime starts
4. swap-files # Quick file swap
5. start-service # Brief downtime ends
6. post-deployment # Clean up while service runs

Symptom: Step 3 runs before Step 2

Cause: Order indices may be duplicated or incorrect in the version

Solution: Sequence versions are immutable. To fix action ordering, click New Version From This on the existing version, reorder the actions using the ↑/↓ buttons in the modal, and submit to create a new version with the corrected order.

Symptom: Step fails because previous step’s output isn’t available

Solution: Use environment variables or files to pass data between steps:

Terminal window
# Step 1: Save value
echo "$VERSION" > /tmp/deploy-version
# Step 2: Read value
VERSION=$(cat /tmp/deploy-version)

Symptom: Changes to order don’t persist

Solution: Sequence versions are always immutable — there is no Save button for reordering steps in an existing version. To change action order, open the version using New Version From This, reorder the actions with the ↑/↓ buttons in the modal, and submit to create a new version with the updated order.