Deploy rules
Deploy rules allow you to create DX deployments by inferring from CI/CD jobs. Whereas the Deployments API is a flexible solution for handling a wide range of deployment mechanisms, inference rules are a no-code solution for simple deployment workflows.
Setup instructions
Deployment inference rules are configured in the DX user interface. To set up a rule, specify the following parameters:
- Pipeline Source: Select from connectors you have configured in DX.
- CI/CD Level: See below for the workflow levels supported by DX.
- Repository: Select a repository from the dropdown, or input a regular expression.
- Integration branch (optional): Set this value if you are using a branch to integrate changes before merging to a release branch.
- Workflow: The workflow, pipeline, or stage for which you want a deploy to be generated from.
- Target branch: The Git branch you want to infer deployments from (e.g.
development
). - Service: The name of the service being deployed.
Regular expressions
DX supports regular expressions for creating rules for multiple repositories and/or workflows at once. Below are a few common examples:
RegEx Expression | Use case |
---|---|
(.*) |
Create a rule that applies to all repositories. |
(.*deploy.*) |
Create a rule for all jobs that include the term “deploy”. |
(^mobile-.*) |
Create a rule for repositories beginning with “mobile-”. |
To verify that a deploy inference rule works, trigger a pipeline/workflow/stage to run on the relevant branch, then confirm that a deployment was created in DX with a deployment_inference_rule_id
corresponding to the rule.
Workflow levels
The second field for an inference rule is the CI/CD level. The table below lists CI/CD levels for each provider, with DX-supported levels highlighted in bold:
Provider | CI/CD levels |
---|---|
Azure Pipelines | Project > Repository > Pipeline > Stage > Job > Step |
CircleCI | Project > Pipeline > Workflow > Job > Step |
Buildkite | Pipeline > Step > Job |
GitHub | Repository > Workflow > Job > Step |
GitLab | Project > Pipeline > Stage > Job |
Data backfilling
Once your rules are setup and verified, you may wish to have deployment data backfilled using your historical data. Please contact DX support to request that a one-time backfill be performed.