Skip to main content

Creating deploy inference rules

Updated over 3 weeks ago

Deploy inference rules allow you to create DX deployments based on jobs that run in your 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:

  1. Pipeline Source: Select from Github Actions, GitLab, CircleCI, and other options based on connections you have configured in DX.

  2. CI/CD Level:

    • GitHub Actions & CircleCI: Automatically set to "Workflow".

    • Buildkite: Automatically set to "Pipeline."

    • GitLab & Azure DevOps: Option to select either "Pipeline" or "Stage".

  3. Repository: Select one from the dropdown, or input a regular expression.

  4. Integration branch (optional): Set this value if you are using a branch to integrate changes before merging to a release branch.

  5. Workflow: Select the specific workflow, pipeline, or stage for which you want a deployment to be generated from the dropdown.

  6. Target branch: The Git branch for which you want to infer deployments from (e.g. master, development).

  7. Service: The name of service being deployed.

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-".

CI/CD 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

Testing

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.

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.

Did this answer your question?