Auto Deploy Rules
Automate deployments based on rules and avoid manual intervention.
What are Auto Deploy Rules?
Auto Deploy Rules automatically deploy deployments based on specific conditions. When a new version of an application is created, Hydra Deploy can automatically deploy it to the appropriate projects and environments according to the rules you’ve set up.
Why Use Auto Deploy?
- Time Saving - No manual clicks needed for each new release
- Consistency - Ensure that every version is always deployed the same way
- Fewer Errors - Avoid forgotten deployments
- Less Steps - Integration with CI/CD pipelines
Creating an Auto Deploy Rule
From Projects Page
- Go to a Project
- Click on the tab for auto deploy rules
- Click on Create Rule
- Configure the rule:
- Application - Select the application
- Version Prefix/Pattern - Choose which versions should be auto deployed (e.g.,
v1.*for all 1.x versions) - Target Environment - Where should the version be deployed?
- Click on Save
From Rules Overview
- Go to the auto deploy rules page
- View all rules for all projects
- Create new rules or edit existing ones
Rule Configurations
Version Matching
You can use different strategies to determine which versions should be automatically deployed:
| Strategy | Pattern | Example |
|---|---|---|
| Exact match | v1.0.0 | Only version 1.0.0 |
| Wildcard | v1.* | All versions starting with v1. |
| Tag | stable | All versions with “stable” tag |
| Latest version | latest | Always the most recent version |
Environment Selection
Choose which environment the version should be deployed to:
- Development - For fast feedback during development
- Staging - For pre-production testing
- Production - For live deployments
Delays
You can set a delay before auto deploy executes:
- Immediate - Deploy immediately on new version
- After X minutes - Wait X minutes
- After X hours - Wait X hours
This is useful to:
- Give testing time for staging
- Prevent accidental deployments to production
- Allow manual review possible
Best Practices
Development Workflow
For development environments:
- Use auto deploy to Development on every new version
- This provides immediate feedback to developers
- Faster iteration cycles
Staging Workflow
For staging environments:
- Use auto deploy with short delay (e.g., 15 minutes)
- Give testers time to detect regressions
- Possibility to cancel deployment
Production Workflow
For production environments:
- Don’t use auto deploy, or use with long delay and approval
- Let staging tests pass before auto deploy to production
- Keep human approval in the process
Rule Management
Viewing Rules
In the rules overview, you see:
- All active rules
- The projects and applications they apply to
- The last time they were triggered
Editing Rules
- Click on a rule
- Adjust the configuration
- Save the changes
Note: If you modify a rule, future deployments will follow the new rule.
Deleting Rules
- Click on the delete button next to a rule
- Confirm the deletion
After deletion, new versions will no longer be automatically deployed according to that rule.
Disabling Rules
Instead of deleting, you can also temporarily disable rules:
- Turn the toggle off
- The rule is preserved but not executed
- Turn back on when needed
CI/CD Integration
Auto Deploy Rules work well with CI/CD pipelines:
Example Workflow:
- Developer pushes code to repository
- CI/CD pipeline is triggered
- Build and tests are executed
- New version is created via API
- Auto Deploy Rule is activated
- Deployment is automatically executed
Example API Call:
# Create new version
curl -X POST https://api.hydradeploy.com/versions/create \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"applicationCode": "my-app",
"version": "v1.2.3"
}'After this call, the auto deploy rule will determine if and where the version should be deployed.
Error Handling
Failed Auto Deploy
If an auto deployment fails:
- A notification is sent
- The deployment appears in deployment history with status “Failed”
- You can redeploy or do a rollback
Conflicting Rules
If multiple rules apply to the same version:
- The most specific rule takes precedence
- Exact match takes priority over wildcard
- Check rule order if needed
Monitoring
View in the Deployment History which deployments were automatically executed:
- Auto deployments are marked
- See which rule triggered the deployment
- Follow status of all deployments
Security
Approval Workflows
For critical production deployments:
- Use auto deploy with approval required
- One or more team members must approve
- Extra layer of security
Roles
Only users with appropriate roles can manage auto deploy rules:
- ORG_OWNER - Can create, edit, delete all rules
- ORG_MANAGER - Can manage rules for own projects
- ORG_USER - Can only view rules