CICD Implementation in Standalone Server using Jenkins [POC]

Author: Manuel George

1. CICD Components

Build Server components:

  • OS: Linux server/Windows server
  • Jenkins
  • Maven 3.6.3
  • Jdk 1.8 or above
  • Repository: Gitlab
  • Deployment Type: Mule Standalone Deployment 4.2.1
  • Client Tools Required: Putty
  • Sourcetree/Tortoise Git/GithubDesktop

2. Setting up new Gitlab project

  1. Log into Gitlab account
  2. Click on the button ‘NewProject’

3. Type the project name, project slug and check the box ‘Initialize the repository with read me’ click create project.

4. Create a dev branch and clone the same to your local system using the any client apps like Source tree, Github Desktop/Tortoise Git

5. Open GithubDesktop and clone the repository using the url retrieved from Gitlab.

  1. Commit and push the sample code to the dev branch with the jenkins code.


3. Setting up CICD for a new project

3.1 Setting up CICD scripts in Gitlab repository

Jenkinsfile.txt is based on Maven based Deployment and attaching the same below.

pipeline {
  agent any
  stages {
             stage('Build and Deploy to Standalone Server'){ 
		     steps {
		        //defining environment variables based on the opted environment from the job
		        def deployenv =params.ENVIRONMENT_TO_DEPLOY
		        def versionv = deployenv+'_DEPLOY_MULE_VERSION'
		        def targetserverv=deployenv+'_DEPLOY_TARGET_SERVER'
		        def deployusernamev= deployenv+'_DEPLOY_ANYPOINT_USERNAME'
		        def deploypasswordv=deployenv+'_DEPLOY_ANYPOINT_PASSWORD'
		        def anypointurlv=deployenv+'_DEPLOY_ANYPOINT_URL'
		        def muledeployenvv = deployenv+'_DEPLOY_ENV_NAME'
                //Assigning respective variables for deployment
                def version = env."${versionv}"
                def targetserver=env."${targetserverv}"
                def deployusername=env."${deployusernamev}"
                def deploypassword=env."${deploypasswordv}"
                def anypointurl=env."${anypointurlv}"
                def muledeployenv = env."${muledeployenvv}"
        //-----getting Application specific variable from config.json 
                def buildConfig = readJSON file: 'Jenkins/config.json'
		        def mulekey = buildConfig."${deployenv}".APP_MULEKEY
		        def muleenv = buildConfig."${deployenv}".ENV
                sh """mvn --settings settings.xml clean deploy -Dmule_key=${mulekey} -Dmule_env=${muleenv} -DskipMunitTests -DmuleDeploy -Dmule.version=${version} -Dtarget_server=${targetserver}   -Dusername=${deployusername}   -Dpassword=${deploypassword}   -Denv=${muledeployenv}  -Durl=${anypointurl}"""


Config.json to define -vm args specific to the  project.

	"DEV": {
		"APP_MULEKEY": "***************",
	"QAS": {
		"APP_MULEKEY": "*************",
	"PROD": {
		"APP_MULEKEY": "***********",


POM file – Eg: VM args [properties.key,mule.env, etc…]

POM file update require for CICD:

  1. Configure ARM deployment config.
  2. Add the repositories corresponding to the package if not present.

Sample POM has been shared in the folder.

ARM deployment config:


3.2. Setting up Jenkins job for the GITLAB project

*Install Git parameter plugin in Jenkins

  1. Log into Jenkins 
  2. Create a new job called test in Jenkins
  3. Select the Pipeline job and enter the project name and SCM as Git
  4. Enter the repository and add credentials as well.
  5. Set the pipeline script path  as well as ‘Jenkins/Jenkinsfile.txt’

6. Add the parameter in Job to display the list of branches to deploy and the anypoint Env in the choice parameter.

*Once the tag is created u can checkout the code from the tag by altering the Parameter type(Branch/Tag) in ListGitBranches

7. Save it.

8. In Manage Jenkins, define the global variables for all the environments.

*These are the variables that will be used  in the Jenkinsfile.txt . 

4. Munit Test Integration in CICD

Munit testing has been added as a part of CICD deployment.Pipeline will be updated as checkout-> Munit Test -> Build -> Deploy to Standalone server.Below are the changes that has been done as a part of CICD deployment.


Added a new stage called Munit Test in Jenkinsfile.txt which will be reflected in the pipeline.


stage('Munit Test'){             
steps{       script{
def munit_test = params.MUNIT_CHECK
if(munit_test == true){
sh """mvn --settings settings.xml clean test"""
else {


POM file Update

A maven configuration exclusive to MUnit has to be defined in the build configuration of  the POM to make the code maven enabled. As the Munit is intended to DEV all the configs inside the pom are hardcoded with DEV credentials.


Private repository is inevitable while configuring munit.

			<name>MuleSoft Releases Repository</name>

Jenkins UI: Configure Job(for DEV and PROD)  Define Boolean Build Parameter : MUNIT_CHECK

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.