Version management was made available with SCP business rules in February. In this blog, I will guide you to creating, managing and patching versions and also invoking business rules based on versions but before we start let us briefly understand the concept.
- Version: small increments in the business rules project content. For example: any changes to vocabulary, business logic, rule service interface etc.
- syntax: {major}.{minor}.{patch}
- incremental integer value like 1.0.1 or 5.1.6
- Revision: tagged or named collection of versions
- syntax: plain-text
- for example: "taxes 2019" which is collection of versions like 1.0.0, 1.0.1, 2.0.0, 2.0.1, 2.1.1, 2.1.2 etc.
- Working Set: currently authored rule.
- With version management, there have been an introduction of a new term called working set – which represents the current working copy where you work with business rules. A working copy can be managed from Manage Project application. You can make changes to the working copy and when you done with your edits you can activate the changes, and version them as well.
Create Version
- Before you create the revision or version, you need to ensure that all the business models are in Active status.
- Click on the Release Version button on the project screen to create the new version
- In the version dialog, you need to enter version, revision and description.
- Version should be in {major}.{minor}.{patch} format. Version number has to be unique throughout the project. Versioned project is immutable which means once you created the state of the business models are frozen and no further changes can be done.
- Revision is mandatory. If you want to create a new version in same revision then keep the revision name same and enter a new version number.
- Description is to capture the changes committed in the version.
View Versions
- Select the project and click on History to see versions of the project
- All the version will be grouped in revisions
- You can navigate into the project to see the versioned business rules
- You can also export the versioned project by selecting the version and click on download button. The project gets exported in zip format.
- If you want to invoke or execute versioned rules, then you need to go and deploy the versioned rule service.
Patch Version
- This is slightly misunderstood. When I say patch version, it does not mean that you make the changes the existing version. It means that you choose a versioned project to modify and then create a new version of the modified content. For example, if you want to modify version 2.1.0 then you are not updating this version instead you are just taking the content of this version for modification and after this you will create a new version which could be 2.1.1 or 2.2.0 etc. To reiterate again, versions are unchangeable and irreversible.
- To patch a version, you need to go into the version history. Select a version and click Edit Version. Just be sure before choosing to edit the version because it overrides the existing working copy. If you have done too many new changes in the working set then do export it or version it before patching any previous version which could be quite old.
Transporting Versioned Project
- If you do an export and import from Manage Projects application then only working set gets exported or imported. The versions do not get exported when you export the working set.
- You need to explicitly choose the version to export it in to local system. All the versions have to exported one-by-one
- Then you can import it into another system using Import option from Manage Projects A versioned project never imports as working set. You can see the imported versioned project in version history page.
Invoking Versioned Rules
- Invoking versioned rules are available only with v2 execution APIs. It is available with both Neo and Cloud Foundry environments.
- Use this API for versioned invocation of rule
- Now coming to the body. There is a new element introduced in the invocation body of v2 API to provide version or revision. There are two ways you can invoke the versioned project:
- RuleServiceRevision: revision of the rule.
- If you give revision name then the highest semantic deployed version of that revision will be invoked.
- RuleServiceVersion: version of the rule
- Exact version will be invoked but the rule service for this version must be deployed else error will be thrown
- Version number for invocation must be given in this format {6-digit major number}{6-digit minor number}{6-digit patch number}. For example, if version is 2.1.5 then you need give like this: 000002000001000005
That is all with version management in business rules. To know about it you can also read through the
help portal.