LogoLogo
API Documentation
Current Version
Current Version
  • DecisionRules Documentation
  • DecisionRules Academy
  • API
    • API Introduction
    • API Keys
      • Solver API Keys
      • Management API keys
      • BI API keys
    • Rule Solver API
    • Management API
      • Rule Migration Strategies
      • Deprecated Endpoints
    • Console Logs API
    • Business Intelligence API
      • Deprecated Endpoints
    • Datacenters & Locations
      • Global Cloud
      • Regional Cloud
    • Apache Kafka Solver API
    • Endpoint Settings
    • Archive
      • Rule Flow Solver API (DEPRECATED)
  • AI Assistant
    • About Assistant
    • Assistant Setup
      • Gemini Assistant
  • RULES
    • Rules Introduction
    • Rule List
    • Rule Mode
    • Common Rule Features
      • Input & Output Model
        • Simple Editor
        • JSON Editor
      • Test Bench
      • Rule Alias
      • Rule State
      • Versioning
      • Rule Variables
      • Execution Strategy
      • Rule Dependencies
      • Rule Export & Import
        • Rule Export
        • Rule Import
        • Managing Decision Table in Excel/Google Sheets
        • Deprecated Formats: XLSX v.1 and CSV
      • Tags
      • Rule Comparison
        • Decision Table Comparison
        • Decision Tree Comparison
        • Scripting Rule Comparison
      • Rule Lock
      • Teamwork Indicator
      • Event Timeline
    • Data Types & Functions
      • Supported Data Types
      • Operators and Functions
        • Basic operators
        • Date operators
        • Functions
          • Logical Functions
          • Math Functions
          • Date and Time Functions
          • Text Functions
          • Data Functions
          • Array Functions
          • Integration functions
          • Functions and JSON
    • Decision Table
      • Table Designer
        • Table Operations
          • Filter Values
          • Valid Values
          • Sorting
      • Binding to Model
    • Decision Tree
      • Tree Designer
    • Workflow
      • Workflow Designer
      • Workflow Nodes Overview
      • Workflow Limits
    • Scripting Rule
      • Custom functions in Scripting Rules
      • Calling external API within ScriptingRules
      • Use Rule Variables in Scripting Rules
      • Call Embedded Rules in Scripting Rules
      • Tips
    • Rule Flow
      • Rule Flow Designer
      • Rule Flow Mapping
      • Rule States in Rule Flow
      • Warnings & Errors
      • Rule Flow Limits
  • SPACE
    • Space Introduction
    • Space Info
    • Dashboard
    • Access
    • API Keys
    • Audit Logs
  • Organization
    • Organization Introduction
    • Organization List
    • Members
    • Teams
    • Spaces
    • Space Roles
    • Policies
    • Statistics
    • Settings
  • Profile
    • Profile Introduction
    • General
    • Dashboard
    • Plans
    • Add-ons
    • Limits
      • Plan Limits Explained
    • Subscriptions
    • Invoices
  • Access
    • Sign Up & Login
    • Invitations & Permissions
    • Single Sign-On (SSO)
  • Business Intelligence
    • Audit Logs
    • Power BI Connectivity
      • Create a Power BI Report
      • Connect Power BI to Business Intelligence API
      • Connecting from Power BI (deprecated)
      • Connect DecisionRules to Power BI Using Our Custom Connector
  • OTHER DEPLOYMENT OPTIONS
    • Regional Cloud
      • Region Specific API URLs
    • Docker & On-Premise
      • Environment Variables
      • Redis Connection Modes
      • DecisionRules Application
        • Minimal Requirements
        • DecisionRules Server
        • DecisionRules Client
        • DecisionRules Business Intelligence
        • Networking Between Docker Containers
      • Setup Single Sign-On (SSO)
        • Set up Microsoft Entra ID SSO
        • Set up Google SSO
      • Docker Showcase App
        • Showcase
        • Showcase + Business Intelligence
      • AWS Setup
        • AWS ECS/Fargate
        • Cache - Amazon ElastiCache
      • Microsoft Azure Setup
        • Database - Azure CosmosDB
        • Cache - Azure Cache for Redis
        • Azure Container Apps
      • Azure Red Hat OpenShift
      • Google Kubernetes Engine (GKE)
      • Kubernetes Setup
        • Kubernetes Setup with Business Intelligence
      • Logging options
      • CD/CI Pipelines
        • Azure DevOps CICD Pipelines
        • Using Migration script (old way)
      • Offline License
      • White Labeling
  • SDK and Integrations
    • Languages / Frameworks
      • SQL Server
      • Oracle PL/SQL
      • PostgreSQL
      • JavaScript
      • Java Spring Example
      • PHP Library
      • Python Library
      • .NET Library
      • Google Tag Manager
    • Excel Add-in
  • Terms & Conditions
    • Terms and Conditions
    • Privacy Policy
    • Service Level Agreement
      • Community Support
      • Standard Cloud (SaaS)
      • Silver SLA
      • Gold SLA
      • Custom SLA
    • Sub-Processor List
  • Product Updates
    • Release Notes
      • Public Cloud
      • On-Premise / Private Cloud
    • Major Updates
      • Changes in Version 1.19.0 (10/2024)
      • Changes in Version 1.20.0 (4/2025)
    • Roadmap
Powered by GitBook
On this page

Was this helpful?

  1. OTHER DEPLOYMENT OPTIONS
  2. Docker & On-Premise
  3. CD/CI Pipelines

Azure DevOps CICD Pipelines

Last updated 6 months ago

Was this helpful?

Using Azure DevOps CICD Pipelines with DecisionRules Business Rules Engine

This page provides a basic example of how to create pipelines with DecisionRules and Azure DevOps. For more advanced or customized pipelines tailored to specific use cases, please refer to DecisionRules Consulting for expert guidance and support.

Introduction

This tutorial will guide you through setting up two CI/CD pipelines using Azure DevOps CICD Pipelines to automate the management of business rules in DecisionRules. The first pipeline will handle moving business rules from one DecisionRules space to another, even across different environments (e.g., from development to production). The second pipeline will focus on Restore-in-Time Recovery, allowing you to revert to a previous state of your business rules when necessary.

Prerequisites

Before starting, ensure the following:

  • Azure DevOps account and project set up.

  • DecisionRules account with API access.

  • A Git repository with your DecisionRules configurations and rules.

  • Access to a Service Principal with appropriate permissions in Azure DevOps.

Pipeline 1: Moving DecisionRules Business Rules Between Spaces/Environments

This pipeline will automate moving business rules from one space in DecisionRules to another, supporting deployment across different environments such as development, staging, and production.

Step 1: Create a New Azure DevOps Pipeline

  1. Navigate to your Azure DevOps project.

  2. Go to Pipelines in the side panel, then select Create Pipeline.

  3. Choose where your code is hosted (e.g., GitHub, Azure Repos).

  4. Select the repository where your DecisionRules configuration and rules are stored.

  5. Choose the Starter Pipeline or define a YAML pipeline.

Step 2: Configure YAML Pipeline for DecisionRules Deployment

The YAML configuration below automates the transfer of business rules between spaces:

trigger: none

#External parameters of this YAML pipeline. You can select source environment and target environment
parameters:
- name: srcEnv
  displayName: "Source Environment"
  type: string
  default: "TEST"
  values: [ "PRODUCTION", "TEST" ]
- name: destEnv
  displayName: "Target Environment"
  type: string
  default: "PRODUCTION"
  values: [ "PRODUCTION", "TEST" ]

variables:
- group: dr-var

pool:
  vmImage: ubuntu-latest



steps:
# Get DecisionRules CDCI Pipeline tools from Github
- script: |
    git clone https://github.com/decisionrules/decisionrules-cicd-tools.git
    cd decisionrules-cicd-tools
    npm install
  displayName: 'Prepare DecisionRules CICD tools'

# Create branchName variable which represents branch in github repo
- script: |
    echo "##vso[task.setvariable variable=branchName;]$(date '+%Y-%m-%d-%H-%M-%S')"
  displayName: 'Set variables'

# Create project folder
- script: |
    cd decisionrules-cicd-tools
    mkdir export
  displayName: 'Creating project folder'

# Export source space from source environment
- script: |
    cd decisionrules-cicd-tools
    npm run export export/export.json $(${{parameters.srcEnv}}_ENV_URL) $(${{parameters.srcEnv}}_SPACE_MANAGEMENT_APIKEY) 
  displayName: 'Storing source project'

# Create repository, create branch for backup, commit and push exported space to git repository
- script: |
    mkdir repository && cd repository
    git clone $(GIT_REPO) .
    git config --global user.email "release@decisionrules.io"
    git config --global user.name "Release Pipeline Agent" 
    git checkout -b release/$(branchName)
    cp ../decisionrules-cicd-tools/export/export.json .
    git add .
    git commit -a -m 'Storing release'
    git push --set-upstream origin release/$(branchName) --force
  displayName: 'Storing data to git'
  
# Also attach deployment artifact to the pipeline.
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: 'decisionrules-cicd-tools/export/export.json'
    artifact: 'Exported Space'
    publishLocation: 'pipeline'
  displayName: 'Attach deployment artifact to the pipeline'

# Prepare target space for new import
- script: |
    cd decisionrules-cicd-tools
    npm run clear $(${{parameters.destEnv}}_ENV_URL) $(${{parameters.destEnv}}_SPACE_MANAGEMENT_APIKEY)
  displayName: 'Preparing target project'

# Upload tada to target space
- script: |
    cd decisionrules-cicd-tools
    npm run import export/export.json $(${{parameters.destEnv}}_ENV_URL) $(${{parameters.destEnv}}_SPACE_MANAGEMENT_APIKEY)
  displayName: 'Migrating to target project'

Step 3: Set Up Variables

  1. In Azure DevOps, navigate to Pipelines > Library > Variable Groups.

  2. Create Variable group dr-var

  1. Add the following variables:

    • GIT_REPO: Git repository where backups are stored

    • *_ENV_URL: URL of environment endpoint. This endpoint can be named i.e. as PRODUCTION, DEV, TEST, etc. This prefix is then selected in pipelines parameters section:

    parameters:
    - name: srcEnv
      displayName: "Source Environment"
      type: string
      default: "TEST"
      values: [ "PRODUCTION", "TEST" ]
    - name: destEnv
      displayName: "Target Environment"
      type: string
      default: "PRODUCTION"
      values: [ "PRODUCTION", "TEST" ]
    • *_SPACE_MANAGEMENT_KEY: Decision Rules Management API key that identifies the space on DecisionRules environment

Step 4: Trigger and Monitor the Pipeline

Once set up, you can trigger this pipeline through code commits or manually and monitor the status from the Pipelines page.


Pipeline 2: Restore-in-Time Recovery Pipeline

This pipeline will allow you to revert to a previous version of a business rule, enabling a restore-in-time recovery for DecisionRules.

Step 1: Create a New Pipeline for Recovery

  1. Follow the same steps as above to create a new pipeline in Azure DevOps.

  2. Name it something like Restore-In-Time Pipeline.

Step 2: Configure YAML Pipeline for Rule Restoration

Here’s the YAML configuration for the restore pipeline:

trigger: none

#External parameters of this YAML pipeline. You select target environment and source branch you want to restore.
parameters:
- name: destEnv
  displayName: "Target Environment"
  type: string
  default: "PRODUCTION"
  values: [ "PRODUCTION", "TEST" ]
- name: sourceBranch
  displayName: "Select source branch"
  type: string
  default: ""

#Definition of variable group in Azure DevOps.
variables:
- group: dr-var

pool:
  vmImage: ubuntu-latest


steps:
# Get DecisionRules CDCI Pipeline tools from Github
- script: |
    git clone https://github.com/decisionrules/decisionrules-cicd-tools.git
    cd decisionrules-cicd-tools
    npm install
  displayName: 'Prepare DecisionRules CICD tools'
  
# Checkout git branch you want to restore. The branch is pushed to this YAML as sourceBranch parameter
- script: |
    mkdir repository && cd repository
    git clone --branch ${{parameters.sourceBranch}} --single-branch $(GIT_REPO) .
    git config --global user.email "release@decisionrules.io"
    git config --global user.name "Release Pipeline Agent"
  displayName: 'Storing data to git'
  

# Prepare DecisionRules space
- script: |
    cd decisionrules-cicd-tools
    npm run clear $(${{parameters.destEnv}}_ENV_URL) $(${{parameters.destEnv}}_SPACE_MANAGEMENT_APIKEY)
  displayName: 'Preparing target project'

# Import data from git repository to DecisionRules space
- script: |
    cd decisionrules-cicd-tools
    npm run import ../repository/export.json $(${{parameters.destEnv}}_ENV_URL) $(${{parameters.destEnv}}_SPACE_MANAGEMENT_APIKEY)
  displayName: 'Restoring target project'

Step 4: Trigger and Monitor the Pipeline


Conclusion

By setting up these two Azure DevOps pipelines—one for moving business rules between spaces and the other for time-based recovery—you can effectively automate rule management in DecisionRules. These pipelines will help you maintain consistent deployments, streamline environment management, and offer the ability to quickly revert to a previous rule state when needed.

DecisionRules Pipeline Tools basics on Github
Example of two standard pipeline use cases in Azure DevOps Pipelines
Run pipeline
Parameters of Restore space in time pipeline
Successful pipeline run