Ordering Actions
The order of actions in a sequence determines execution flow. Proper ordering is critical for successful deployments.
How Ordering Works
Section titled “How Ordering Works”Actions execute sequentially from first to last:
Each step must complete successfully before the next begins.
Order Index
Section titled “Order Index”Internally, steps have a 0-based order index:
| Display | Internal Index | Action |
|---|---|---|
| Step 1 | 0 | health-check |
| Step 2 | 1 | stop-service |
| Step 3 | 2 | deploy-files |
| Step 4 | 3 | start-service |
Reordering Steps
Section titled “Reordering Steps”In the UI
Section titled “In the UI”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.
Effects of Reordering
Section titled “Effects of Reordering”When you reorder:
- All order indices are recalculated
- Execution sequence changes
- A new sequence version should be created
Ordering Strategies
Section titled “Ordering Strategies”Dependency-Based Ordering
Section titled “Dependency-Based Ordering”Order based on what each step requires:
Risk-Based Ordering
Section titled “Risk-Based Ordering”Put low-risk, reversible steps first:
| Order | Action | Risk Level | Reversible |
|---|---|---|---|
| 1 | backup-database | Low | N/A (creates backup) |
| 2 | validate-schema | Low | Yes |
| 3 | apply-migrations | Medium | With backup |
| 4 | update-connections | High | Difficult |
Pre/During/Post Pattern
Section titled “Pre/During/Post Pattern”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-completionCommon Ordering Patterns
Section titled “Common Ordering Patterns”Service Update
Section titled “Service Update”1. pre-flight-check # Verify target is ready2. drain-connections # Stop accepting new requests3. wait-for-drain # Let existing requests complete4. stop-service # Stop the service5. deploy-files # Update application files6. start-service # Start the service7. health-check # Verify service is healthy8. restore-traffic # Resume accepting requestsDatabase Migration
Section titled “Database Migration”1. backup-database # Safety net2. stop-writes # Prevent data changes during migration3. run-migrations # Apply schema changes4. verify-schema # Confirm changes applied5. resume-writes # Allow data changes again6. update-app-servers # Point apps to new schemaBlue-Green Deployment
Section titled “Blue-Green Deployment”1. deploy-to-inactive # Update the inactive environment2. verify-inactive # Test the inactive environment3. switch-traffic # Route traffic to newly updated env4. verify-active # Confirm new active works5. cleanup-old # Clean up the now-inactive old envHandling Failures
Section titled “Handling Failures”Fail-Fast Ordering
Section titled “Fail-Fast Ordering”Put likely-to-fail steps early:
1. validate-config # Fail early if config is invalid2. check-permissions # Fail early if no access3. verify-connectivity # Fail early if network issue4. ... rest of deployment ...Rollback Considerations
Section titled “Rollback Considerations”Order to enable rollback:
1. create-snapshot # ALWAYS FIRST - enables rollback2. ... deployment steps ...3. verify-success # Check if we need to rollbackIf step 3 fails, you have a snapshot from step 1.
Order Visualization
Section titled “Order Visualization”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 ││ │└─────────────────────────────────────────────────────────┘Best Practices
Section titled “Best Practices”1. Validate Before Modify
Section titled “1. Validate Before Modify”✓ 1. validate-target # Check first 2. modify-system # Then change2. Backup Before Change
Section titled “2. Backup Before Change”✓ 1. create-backup # Save state 2. make-changes # Then modify3. Verify After Deploy
Section titled “3. Verify After Deploy” 1. deploy-application # Make changes✓ 2. health-check # Then verify4. Group Related Steps
Section titled “4. Group Related Steps”Keep related operations together:
# Database operations together1. backup-db2. migrate-db3. verify-db
# Application operations together4. stop-app5. deploy-app6. start-app5. Minimize Downtime Window
Section titled “5. Minimize Downtime Window”Order to reduce service unavailability:
1. prepare-deployment # Pre-work while service runs2. download-artifacts # Get files ready3. stop-service # Brief downtime starts4. swap-files # Quick file swap5. start-service # Brief downtime ends6. post-deployment # Clean up while service runsTroubleshooting
Section titled “Troubleshooting”Steps Execute in Wrong Order
Section titled “Steps Execute in Wrong Order”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.
Step Depends on Previous Output
Section titled “Step Depends on Previous Output”Symptom: Step fails because previous step’s output isn’t available
Solution: Use environment variables or files to pass data between steps:
# Step 1: Save valueecho "$VERSION" > /tmp/deploy-version
# Step 2: Read valueVERSION=$(cat /tmp/deploy-version)Reordering Not Saving
Section titled “Reordering Not Saving”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.
Next Steps
Section titled “Next Steps”- Versioning - Version management
- Creating Sequences - Creating new sequences
- Overview - Return to sequences overview
