File Governance and Versioning in Corticon BRMS

Seth Meldon - Oct 3 - - Dev Community

Learn how to integrate Corticon business rule assets into your version control systems.

Progress Corticon Studio is a robust application, enabling all aspects of business rule development and testing without coding. Because Progress Corticon operates upon data while storing no data, all the components developed within Corticon Studio are straightforward to manage as standard file assets—you have to really go out of your way to introduce external dependencies to Corticon business rules projects!

Everything authored in Corticon Studio’s respective file types—the vocabulary, rule sheets, rule tests and rule flows—are stored under the covers as XML files, making integration with version control systems like Git a cinch.


Table of Contents

Basic Version Control Workflow

Using version control systems (VCS) is a standard practice for most development teams, but here’s a brief overview of the primary VCS, Git, if it’s newer to you. GitHub is one of the most widely employed Git-based VCS and will be the tool used here.

Using a version control system provides numerous benefits for organizations, namely:

  • Restoring older versions in case you accidentally break something
  • Collaborating with team members without overwriting each other’s changes
  • Documenting who makes a change, when they made it and what they changed
  • Backing up your work in case files are lost

Repositories

The central hub where everything is stored and tracked is called a Repository. A common practice with Corticon is to create a Repository for each rule project. That way, when you open up Corticon Studio, the repository can be represented as a folder within the Project Explorer.

Every change made to the rule assets and any new files will be tracked as you go, and when you’ve completed the needed changes, you “stage” the changes to specify which files’ changes you want to save into the repository, and finally commit the rules back to the central repository. A commit is like a save point in a video game but documented with a user-defined commit message which will serve as an explainer of the changes made that can be referred to later on.

Branches

Branching is what enables multiple development team members to make changes to a shared repository. When you create a new repository, a “main” branch is created along with it. If one rule developer needs to tweak a few rules, she’ll create a new branch off the main branch to isolate her instance of the rule repository from the master repository, and “merge” her branch’s changes into the main branch once the changes are ready to go live. You can read more about how branching works in GitHub at this link.

Git Operations

Typically, a developer will execute these steps with the command line. For example:

$ git init     # Initialize a new git database

$ git clone    # Copy an existing database

$ git status   # Check the status of the local project

$ git diff     # Review the changes done to the project

$ git commit   # Save the current state of the project to database

Using terminal commands isn’t necessary for basic adoption of Git with Corticon Studio files, though. There are various tools that will allow us to bypass the command line when defining rules, including the built-in Eclipse plugin for Git version control. If you’ll be storing your assets on GitHub, though, an even easier solution is GitHub Desktop, a free desktop software that GitHub offers. It can be used in conjunction with Corticon Studio, handling most git commands for you. For full instructions on getting set up with GitHub desktop, follow the guides they provide here.

Once installed, users can link their account to the installation, then connect to existing repositories or create a new one. The repository will then be stored on GitHub and cloned to your local desktop. You can make changes to the files with branches (recommended), or make changes directly on the main branch. As you make changes to the Corticon rules, the files will be monitored and considered by GitHub as being in one of four states: untracked, modified, staged or committed. Once you're satisfied with your work, you can create a pull request to merge your changes in the current branch into another branch.

Integrate a Repository into Corticon Studio’s Project Explorer

Whether you’re using Corticon Studio for server-based or JavaScript deployments, the steps for version control integration are the same. Here, we’ll use the Corticon rule project samples repository for a demo.

1. Install GitHub Desktop and link to your GitHub account, as described above.

2. Navigate to the repository’s URL on GitHub (e.g. https://github.com/corticon/Importable-Rule-Projects).

3. Click the green “Code” button and select “Open with GitHub Desktop.”

screenshot of github.com open with github desktop shortcut

4. Select either the default or a custom directory which will serve as your local copy of the repository that you’ll work off of in Corticon Studio.

cloning a repo in github desktop

5. Open Corticon Studio or Corticon.js Studio.

6. Right click inside of the Project Explorer pane.

7. Select “Import.”

importing in corticon studio

8. Select “Projects from Folder or Archive” then “Next.”

import wizard corticon studio

9. Select “Directory.”

import wizard corticon studio - selecting directory

10. Navigate to the directory path of the GitHub repository on your local machine.

import wizard corticon studio - selecting directory 2

11. Choose the parent folder of all rule project files you want to import.

finish import

12. Open up the project, proceed with rule modeling.

rulesheet in studio

13. Once you wrap up, save all files, then open up GitHub Desktop if not already open, make sure “Current repository” and “Correct branch” are correct, then enter in a commit summary and optionally, a commit description.

committing in github desktop

14. Hit “Commit to main” (or the name of the current branch) and then “Push Origin.”

pushing to origin in github desktop

Your rules have been versioned! Whenever you or another rule developer next goes to make edits, you just need to open up GitHub Desktop and “Fetch Origin” so that your local copy of the repository is up to date. Then simply open up Corticon Studio, and the project explorer will automatically contain any of the new/changed files from the repository.

As mentioned, this is just one, basic way to integrate rules into your VCS workflow.

. . . . . . .