Check how you can use OpenShift Pipelines (a.k.a Tekton) to automate the delivery of decision services implemented with Red Decision Manager (a.k.a. Drools). In this showcase you can see:
- The automation of repeatable decisions using the DMN specification;
- Usage of the rules engine based on Kogito Project and running on top of Quarkus Runtime;
- CI/CD Pipeline implemented using Tekton;
- How to configure webhooks in your pipeline to deploy based on changes on a git repository;
- Automated tests for decisions (with Test Scenarios ) that are considered during the pipeline execution;
- Deployment with zero downtime with OpenShift rolling deployment strategy;
-
Java 8
-
OpenShift 4.7
-
oc client
-
Fork this repository, in jbossdemocentral.
-
Clone your fork to your local machine.
$ git clone https://github.com/${yourgithubuser}/business-automation-showcase.git $ cd business-automation-showcase
2.1. Switch to kogito-quarkus
branch
$ git checkout kogito-quarkus
-
Run the provisioning script (Linux/MacOS):
$ sh provision.sh
At the end you'll get two URLs: one to a client web application and one to use in the GitHub integration settings. Something like:
******************************************************************
Use this URL in your GitHub Webhook configuration for automatic deployment
http://el-ba-cicd-event-listener-rhdm-kogito-cicd.apps.cluster- (...)
Use this URL to access the front-end application:
http://decision-service-webclient-rhdm-kogito-cicd.apps.cluster- (...)
******************************************************************
-
To configure the webhook for automated deployment, open your fork in your GitHub. Next, add a new webhook by opening "Settings -> Webhook -> Add webhook button".
-
Fill the form with the information below:
- Payload URL: provided after the provisioning. You can also get it using the command:
$ echo "$(oc get route el-ba-cicd-event-listener --template='http://{{.spec.host}}')"
- Content type:
application/json
- Secret: empty
- "Which events would you like to trigger this webhook?:
Just the push event
.
- Payload URL: provided after the provisioning. You can also get it using the command:
At this point, you should already have a fully automated integration and deployment lifecycle for the business application. Any changes pushed to your repository will trigger the pipeline in your OpenShift cluster.
If you run this test, a new deployment should be triggered. The pipeline will deploy the decision service for the first time.
-
In your terminal, access your project folder.
-
Commit and push. You can use this empty commit sample if you need:
git commit -m "an empty commit to test the pipeline" --allow-empty git push origin master
-
In OpenShift, access: "Pipelines -> ba-cicd-pipeline -> Pipeline Runs " and check the progress of your application deployment.
The web application allows you to interact with the deployed rules and decisions in a specific Decision Server (KieServer or Kogito runtime). To use the deployed web app to interact with the deployed decisions, first you need to set the KIE Server URL in the web app settings.
-
The deployed decision service is now deployed and accessible. Get your deployed KIE Server route. You can use the command:
echo "http://"$(oc get route business-application-service-route -n rhdm-kogito-cicd | awk 'FNR > 1 {print $2}')"/rest/server"
-
Open your web application. The URL was provided in the installation step. If you lost it, use the command
oc get route decision-service-webclient --template='http://{{.spec.host}}' -n rhdm-kogito-cicd
-
In the web application, click on the settings icon on the top right corner. In the field
Kie Server Base URL
, insert KIE Server URL. -
You can use the "Test Connection" button to validate the communication between the two services, then Save.
-
You should be able to test the available decisions and rules.
With this, the whole demo is now set up and ready to use.
NOTE: If you get interested in see how this webapp was developed the src code is available here
The provisioning script provision.sh
will:
- Create a new namespace called rhdm-kogito-cicd
- Install OpenShift Pipelines
- Create the pipeline resources
- Deploy a front-end application that you can use to interact with the decision service once you deploy it.
At the moment there are 2 projects in this branch:
- decisions-service: Kogito App using Quarkus runtime exposing the API for Decisions provided with this Showcase demo
- cicd: Tekton Pipeline resources to implement a fully automated CI/CD pipeline for your Business Application Services
To see a detailed instruction on each service and each deployment processes (with images), check: