Continuous deployment automation for cloud deployment

Steps to configure automated environment for continuous deployment of On-Premise assets and configurations to cloud solution.

Overview

This article describes the detailed steps to setup an automated environment for continuous deployment of On-Premise assets and configurations to cloud solution. Instructions described in this article are for webMethods product version 10.4 and above.

Prerequisites

  • Asset Build Environment (ABE)
  • webMethods Integration Cloud command line utility

Above SoftwareAG products should have its latest fixes installed

Third-party tools:

  • Jenkins with pipeline plugin
  • Node JS

Follow the guide http://techcommunity.softwareag.com/pwiki/-/wiki/Main/Quickstart+Guide+for+Cloud+Deployment to setup a cloud deployment environment

Refer http://techcommunity.softwareag.com/pwiki/-/wiki/Main/CLOUD+DEPLOYMENT+USING+ABE to setup ABE for cloud deployment

Setting up the WMIC command line utility

The Cloud Deployment CLI interacts with webMethods Cloud Deployment and performs tasks such as managing a solution, monitoring the status of all runtimes in a solution, promoting assets from one stage to another and so on. The CLI supports the

  • npm install -g @softwareag/wmcc-cli

Specify the credentials in config.json file

  • Create a config.json file under %USERPROFILE%/wmcd_cli/ location for Windows or /

home/wmcd_cli/ in Linux.

  • Add new profiles in the config.json file.

The following is an example of a default and referenced profile in the configuration file.

{
"default": {
"url": "https://{subdomain}.webmethodscloud.com",
"userName": "userName",
"password": "password”
},
"someotherProfile": {
"url": "https://{subdomain}.webmethodscloud.com",
"userName": "userName",
"password": "password”
}
}

Jenkins automation for continuous deployment

Assuming that you have followed the article described in prerequisite section, by now you should be having following

  • A tenant and solutions in both development and test stage
  • Source repository for ABE

Let’s create a declarative pipeline to automate the following stages

In this document, we are using a windows machine and respective batch commands have been used. For non-windows machine respective command need to be replaced

pipeline {
 agent {
  node {
   label "${machine}"
   customWorkspace 'C:/CloudTransformation/SAGLiveWorkspaceCICD'
  }
 }

 /*Requirement: Install nodeJS 10.15 or above
 This stage will perform prerequisite steps to configure WMIC command line utility
 */

 stages {

  /*
  This stage will perform steps to
  activate a solution in Integration Cloud Solution Landscape: Type2
  */

  stage('Activate Solution(Dev stage)') {
   steps {
        dir("CommandlineUtils") {
        bat "wmcd-cli solution-update-status ${SolutionName} live activate --url https://${domain.Host} --userName ${WICusername} --password ${WICpassword} --mode cli"
          }
        }
  }
 /*
   This stage will perform steps to build assets and configurations
   and upload it to Solution using ABE Solution Landscape: Type2
   */

  stage('Build & Deploy Assets/ Configurations') {
   steps {
  bat 'build buildUploadAssets'
   }
  }

  /*
    This stage will have tests to ensure succesful deployment
    Solution Landscape: Type2
    Stage:Development
    */

  stage('Test(Dev Stage)') {
   steps {     
    //Tests can be executed here to validate the successful deployment

     echo 'Test executed'
       }
  }

 /*
    This stage will Promote packages/Configuration to live stage
    Solution Landscape: Type2
    */

  stage('Promote Assets/Config to Live') {
   steps {
    dir("CommandlineUtils") {
     //promote Integration Server packages
     bat "wmcd-cli runtime promote-packages ${SolutionName} ${Target_Server_Name} development ${LiveSolutionName} ${Target_Server_Name} --url https://${domain.Host} --userName ${username} --password ${password} --mode cli --propFile acdlPropertiesReplacer.properties"
     //promote Integration Server configuration
     bat "wmcd-cli runtime promote-configuration ${SolutionName} ${Target_Server_Name} development ${LiveSolutionName} ${Target_Server_Name} --url https://${domain.Host} --userName ${username} --password ${password} --mode cli --propFile acdlPropertiesReplacer.properties"
     //promote Universal messaging configuration
     bat "wmcd-cli runtime promote-configuration ${SolutionName} ${Target_Server_Name} development ${LiveSolutionName} ${LiveSolutionName} --url https://${domain.Host} --userName ${username} --password ${password} --mode cli --propFile acdlPropertiesReplacer.properties" }
   }
  }

  /*
    This stage will have tests to ensure successful deployment
    Solution Landscape: Type2
    Stage:Live
    */

stage('Test(Live Stage)') {
   steps {
     //Tests can be executed here to validate the successful deployment
     echo 'Test executed'
   }
  }

  /*
    This stage will deactivate the solution in development stage
    Solution Landscape: Type2
    */

  stage('Deactivate Solution(Dev stage)') {
   steps {
    dir("CommandlineUtils") {
     bat "wmcd-cli solution-update-status ${SolutionName} development deactivate --url https://${domain.Host} --userName ${username} --password ${password} --mode cli"
    }
   }
  }
 }

    /*
    At the end of all stage execution depanding on status ,
    respective post section will executed
    */

 post {
  success {
   echo 'I succeeeded!'
  }
  unstable {
   echo 'I succeeeded!'
  }
  failure {
   echo 'I succeeeded!'
  }
  changed {
   echo 'I succeeeded!'
  }
 }
}

Push the source repository and Jenkins pipeline file to a Git so that any changes in the assets and configuration will trigger an automated Jenkins pipeline.

Create a Jenkins job with following Jenkins properties and declarative pipeline configuration.

${machine} –Jenkins node

${installDir} –ABE installation directory

${domain.Host}- tenant URL

${solution} - Solution Name in development stage

${Target_Server_Name} – target server, Integration Server/Universal messaging name

${repositoryPath} – path for parent directory of source

${username}/${password} - Login credentials of the tenant

Execution of Jenkins job will give a stage results as:

image.png

image.png

image.png

image.png