Automated build and deployment using Jenkins, ABE, Deployer

 View Only
Sat December 12, 2015 09:45 AM

Introduction: #

What is DevOps? #

DevOps is 

  • a practice with communication & collaboration for developers, QA & other IT operations.
  • demands an automated process of software delivery & Infra changes.
  • an initiative towards an environment where building / testing / delivery happens, –more rapidly–more frequently–more reliably


DevOps Drives need for Continuous Processes #


Deployability, Modifiability, Testability, Monitor ability are the significant architecture requirements for a successful DevOps practice.

This article focuses on the Deploy ability, Testability during Continuous Integration (CI), Continous Delivery/Deployment (CD) processes.

What is CI/CD?  #



  • Continuous Integration - Every change is validated automatically
  • Continous Delivery -  Every promotion is automated to higher stages 
  • Continuous Deployment - Every promotion (including configuration changes) to production is automated

For more details on CI/CD please go through https://techcommunity.softwareag.com/techniques-blog/-/blogs/continuous-integration-using-webmethods

CI/CD Implementation:
#

The below diagram represents the high-level overview of CI/CD implementation.


This article does not explain the Asset Development and check-in process, if you would like understand the same please go through the below articles.

For understanding about maintaining webMethods assets in the Version Control System, please go through the Github Project from Software AG - https://github.com/SoftwareAG/webmethods-sample-project-layout

Pre-requisites: #

Implementing CI/CD for webMethods requires the below tools/plug-in to be installed 

  • Asset Build Environment (ABE) - responsible for creating the builds for all webMethods assets.
  • Deployer - responsible for promoting the builds.
  • Unit Test Framework - responsible for test & code coverage
  • Any Continous Integration (CI) Tool, e.g., Jenkins. 

Checking Out Codebase: #

ABE offers checkout capabilities via "build-source-checkout.xml" within <SoftwareAG-Install-Dir>/common/AssetBuildEnvironment/master_build directory. However, if you are using any CI tool like Jenkins, it is better to checkout using the same. For example, please see below.

A sample of Jenkins file is attached to this article.

webMethods Builds: #

ABE is responsible for creating the creation of the build. Few items need to be pre-configured for the build creation process. Open "build.properties" under <SoftwareAG-Install-Dir>/common/AssetBuildEnvironment/master_build directory. Find the below properties and pre-configure them with applicable values.

  • build.output.dir ->  A directory accessible for CI Tool (Jenkins tool) and webMethods Deployer for creating the builds and reading the builds respectively. This location can also be passed dynamically from CI Tool (Jenkins Pipeline file).
  • build.archive.dir -> A directory accessible for CI Tool to archive the old builds. This is optional but it is good to keep the old builds for auditing.
  • enable.archive -> true if you want to enable archiving builds. default is false.
  • enable.build.* -> multiple properties tagged as enable.build.IS, enable.build.UM ,etc. mark each of us as true or false as required. marking true would create the builds for the respective product. In this article, these properties would be passed dynamically.

10.x onwards, ABE offers a script for build creation. build.bat|sh script within <SoftwareAG-Install-Dir>/common/AssetBuildEnvironment/bin directory. To verify the build creation run the below script from the command line within <SoftwareAG-Install-Dir>/common/AssetBuildEnvironment/bin directory. 

build.bat -Dbuild.output.dir=C:/Builds -Dbuild.source.dir=C:/IS/ (for linux use build.sh)

A successful configuration would create the builds in Builds directory passed from the Command line.

Deployer Project: #

10.x onwards Designer supports creating the scripts for Project creation in Unit Test Perspective. For reference see below,


Configure the properties in config.cnf

  • user=Deployer User Name
  • port=Deplouer Port
  • host=Deployer Host
  • useSSL=true/false
  • pwd=Deployer User Password

Use the below command to generate the Project Automator file. Ant is located under <SoftwareAG-Install-Dir>/common/lib/ant/bin directory. Run the command in this directory. Provide the Builds directory as a reference for deployment.

ant.bat -f <location-of-executor>/AccountsTSE/deployer/updateAutomator.xml -Dbuild.output.dir=C:/Builds

This command will update the file "Deployment_ProjectAutomator.xml" under Test Suite executor created above. To verify the created project file run the below command in <SoftwareAG-Install-Dir>/IntegrationServer/instances/<instance-name>/packages/WmDeployer/bin/.

projectautomator.bat <location-of-genrated-PA-file>/Deployment_ProjectAutomator.xml

A successful configuration and run would create a Project on Deployer. open http://server-host:port/WmDeployer/ to verify if the project is created.

Deploying Project: #

Deployer offers another CLI to deploy the projects created on Deployer. CLI is located in <SoftwareAG-Install-Dir>/IntegrationServer/instances/<instance-name>/packages/WmDeployer/bin/. Run the command in this directory for deployment.

Deployer.bat --deploy -dc <deployment-candidate-name-on-deployer> -project <project-name-on-deployer> -host <deployer-host> -port <deployer-port> -user <deployer-user> -pwd <password>

A successful execution would deploy the webMethods Builds to the target server.

How to substitute the variables during the deployment? #

There might be cases where you have an Adapter connection during the deployment and you would like to substitute new values during deployment. This is known as Variable Substitution. This can be performed by preparing the variable substitution file. Follow the below steps to prepare this configuration file.


Save the file generated above as .vs file. To verify the configurations run the below commands.

cp *.vs <SoftwareAG-Install-Dir>/IntegrationServer/instances/<instance-name>/packages/WmDeployer/replicate/inbound/

Deployer.bat --import -varsub <you-file-name(.vs file)> -map <mapname-on-deployer> -project <project-name-on-deployer> -validate <true/false> -host <deployer-host> -port <deployer-port> -user <deployer-user> -pwd <password>

This command should be run before the Deployment command in the above section.

Test and Code Coverage: #

Test Suite Executor created in the above section for generating the Deployer Project would also have the scripts for executing the Test and Code Coverage cases. Configure the run-test-suites.properties under the test suite executor.

  • webMethods.integrationServer.ssl=true|false
  • webMethods.home=Software Installation Directory
  • webMethods.test.setup.profile.mode=COVERAGE (for running Code Coverage)
  • webMethods.integrationServer.name=Target Server Host name
  • webMethods.test.setup.location=Test Suite Project Name
  • webMethods.test.setup.external.classpath.layout=resources/test/classes,resources/java/classes,resources/test/jars,resources/java/jars,resources/jars (leave this as is)
  • webMethods.integrationServer.port=Target Server Port Name
  • webMethods.test.scope.packages=Package Names for Test Scope on Target Server
  • webMethods.integrationServer.userid=Targer Server User Name
  • webMethods.test.profile.result.location=Test & Coverage results location
  • webMethods.integrationServer.password=Target Server Password

 Run the below command with in the <SoftwareAG-Install-Dir>/common/lib/ant/bin directory.

ant.bat -f <Test-Suite-Executor-location>/run-composite-runner.xml -DwebMethods.integrationServer.name=<Target-host> -DwebMethods.integrationServer.port=<Tarter-Port> -DwebMethods.test.setup.location=<Test-Sute-location> -DwebMethods.integrationServer.userid=<Target-User-name> -DwebMethods.integrationServer.password=<Target-Password> -DwebMethods.test.profile.result.location=<Test-Results-location>'

Conclusion: #

If you are using Jenkins as CI Tool then you can use the sample Jenkins file from the attachments. This Pipeline uses HTML Reports, Junit Plugin for publishig the reports.

You can use the attached archive for practicing the entire tutorial. Below is the sample from the Jenkins Job.


P.S: You might want to set below property browser CSP policy on Jenkins



System.setProperty("hudson.model.DirectoryBrowserSupport.CSP",
"sandbox allow-popups allow-top-navigation allow-scripts allow-same-origin allow-forms; default-src 'none'; frame-src 'self' 'unsafe-inline'; connect-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src 'self' 'unsafe-inline';");



#suite
#creole
#webMethods