Master Data Management (MDM)

Adding CBA to MDM Operational Server BLA using scripts to facilitate CI/CD

By CHITRA ANANTHANARAYANAN posted Tue June 02, 2020 12:19 PM

  
With the Headless Build available for MDM Workbench the scripts in this post will enable customers to use CI/CD for adding custom CBAs to the MDM operational server EBA.

Automated Builds of Physical MDM Customisations

Automated Builds of Physical MDM Customisations enable creation of CBAs, sqls and wsdls through execution of a script.  Details on setting up the headless build are elaborated in the highlighted link.  The script reads properties from a file.

Headless_Build_Properties.png

A sample invocation of the script can be noticed in the below image:
Headless_Build_Sample_With_Output.png

Here the CBAExport folder contains the CBAs.  The exportedArtifacts.zip file contains the wsdls and sqls in compressed format.   The folder that holds the CBAExport and exportedArtifacts.zip are used as input for the script demonstrated in further steps.  

Assets generated for a custom component bundle

They are the CBA and the SQL files are key assets to get the custom component bundles working.  The CBA has a name and version.  As part of SQL files, delete TAIL, rollback and insert SQLs are generated which have to be executed in the same order.  The CBAs have to be added as an Extension to the MDM operational server Enterprise Bundle Archive.
In certain cases, there is a necessity to remove the previous version on the CBA that is already added as an extension to the MDM operational server EBA.


Script to add custom CBAs to the MDM Operational Server EBA as an Extension

To enable addition of CBAs as an extension to the MDM operational server Enterprise Business Archive, we have addCba.py and an addCba.sh scripts.  We also have the installCba.sh script which reads property values from installCba.properties file and the mdm_install.properties file to reduce the number of inputs obtained from the user.  

Please find the inputs obtained through installCba.properties below.
Add_CBA_Properties.png

The installCba.sh script reads values from the installCba.properties, then obtains values such as Instance Id, WAS Profile Home and WAS Admin User from the mdm_install.properties.  It places addCba.sh and addCba.py in the <WAS_PROFILE_DIR>/bin folder and invokes the addCba.sh script.  This script in turn invokes the addCba.py using the wsadmin.sh tool from WAS and passes in parameters CBA location, Instance Id, Bundle Name and Bundle Version.  The addCba.py file adds the local repository bundle, adds it as an extension to the Enterprise Business Archive in MDM operational server Business Level Application, edits the composition unit and saves it.

Alternatively you can directly invoke addCba.py after placing it in the <WAS_PROFILE_DIR>/bin folder by passing the below parameters

./wsadmin.sh -conntype SOAP -host <HOST> -port <SOAP_PORT> -lang jython -username <WAS_ADMIN_USER> -password <WAS_ADMIN_PASSWORD> -f addCba.py <CBA_PATH> <MDM_INSTANCE_ID> <BUNDLE_NAME> <BUNDLE_VERSION>

Below is a sample invocation:

./wsadmin.sh -conntype SOAP -host abc.com -port 8879 -lang jython -username wasadmin -password wasadmin -f addCba.py /opt/IBM/test.cba E001 test.cba 1.0.1

Script to add custom CBAs to the MDM Operational Server EBA as an Extension and invoke SQLs

The installCbaWithSQL.sh performs the step mentioned above after executing the Delete, Rollback and Insert SQLs.  It expects the assets to be present in the format generated by the headless build, ie., the folders CBAExport and exportedAssets.zip have to be present in the directory cba.assets.dir present in the installCba.properties file.

Please observe a sample output in the below screen shots.
Invoke_Script_Rollback.png


Script_Insert.png
Script_CBA.png

Notice that the Rollback sqls and Setup sqls are executed followed by invocation of addCba.py through addCba.sh

CBA in the WAS Admin Console 

Please find the CBA available as an extension to the EBA in the WAS Admin Console.

EBA_Extension.png

IVT response

Please find the response from an IVT execution where a sample request generated by the Workbench was used.

IVT_Response.png

Removed attached CBAs

Scripts removeCba.sh and removeCba.py are also available.  These scripts have to be placed in <WAS_PROFILE_DIR>/bin and invoked.

To invoke removeCba.sh pass the below parameters:

./removeCba.sh <MDM_INSTALL_HOME> <BUNDLE_NAME> <BUNDLE_VERSION> <MDM_ADMIN_PASSWORD>

Alternatively you can directly invoke removeCba.py by using wsadmin.sh and passing in the below parameters:

./wsadmin.sh -conntype SOAP -host <HOST> -port <PORT> -lang jython -username <WAS_ADMIN_USER> -password <WAS_ADMIN_PASSWORD> -f removeCba.py <MDM_INSTANCE_ID> <BUNDLE_NAME> <BUNDLE_VERSION>

A screenshot of the invocation is attached here.
removeCBA.png
Usage

* Please find the sample scripts used - cicd.zip
* Fill in the installCba.properties
was.profile.dir - WAS Profile Directory - this property will be used to place the shell and python scripts and execute them
mdm.install.dir - MDM Installation Directory - this property will be used to find out other MDM related properties. It will also be used to execute SQLs using the madsql utility
cba.assets.dir - The directory in which CBAs are placed, the CBAExport and exportArtifacts.zip generated by the Headless build have to be placed in this directory.
mdm.admin.password - MDM Administrator Password - used for authentication with WAS Server

* To execute the rollback and insert SQLs and add the CBA to the MDM EBA execute installCbaWithSQL.sh

* To add the CBA to the MDM EBA execute installCba.sh

* To remove CBAs from the MDM EBA place removeCba.sh and removeCba.py in <WAS_PROFILE_HOME>/bin and invoke removeCba.sh with the below parameters
./removeCba.sh <MDM_INSTALL_HOME> <BUNDLE_NAME> <BUNDLE_VERSION> <MDM_ADMIN_PASSWORD>

* You can also directly invoke the jython scripts, to invoke addCba.py, pass in
./wsadmin.sh -conntype SOAP -host <HOST> -port <PORT> -lang jython -username <WAS_ADMIN_USER> -password <WAS_ADMIN_PASSWORD> -f addCba.py <CBA_PATH> <MDM_INSTANCE_ID> <BUNDLE_NAME> <BUNDLE_VERSION>

* To invoke the removeCba.py, pass in
./wsadmin.sh -conntype SOAP -host <HOST> -port <PORT> -lang jython -username <WAS_ADMIN_USER> -password <WAS_ADMIN_PASSWORD> -f removeCba.py <MDM_INSTANCE_ID> <BUNDLE_NAME> <BUNDLE_VERSION>

0 comments
39 views

Permalink