Mule 4 Application deployment with Jenkins

Environment:

  • Mule 4
  • Jenkins
  • Mac OS Catalina
  • Github
  • Apache Maven

Use brew to install Maven, Jenkins & Github.

Useful links:
https://www.jenkins.io/doc/book/installing/macos/#setup-wizard

Log onto Jenkins with admin credentials. Create new item to get the code from Github repository, specify the repository URL and credentials to access the Github account.

Specify the schedule and check the ‘Poll SCM’ and save the item.


Create another item for Build and specify the Maven home path to execute ‘mvn clean install’ command in ‘Execute shell’ and save the item.



Create another item for deployment and specify the command for mule deployment.



Install ‘Build Pipeline’ plugin from the Jenkins homepage-> Manage Jenkins->Manage plugins 



Go to the Checkout item (the item created to get code from Github), add Post Build action and specify Build item



Add post build item to the Build item as well, specify Deploy item



Create a new view and choose Build Pipeline view.



Select the initial job to execute.

The mule application pom.xml needs to be updated with following in the Mule plugin section:

<cloudHubDeployment>

<username>AnypointUser</username>

<password>AnypointUserPwd</password>

<environment>Sandbox</environment>

<workers>1</workers>

<workerType>Micro</workerType>

<applicationName>worldtime-demo-service</applicationName>

<muleVersion>4.3.0</muleVersion>

<objectStoreV2>true</objectStoreV2>

</cloudHubDeployment>

Thing to remember here is the common properties like HTTP port number are declared as global elements and placeholders are used in the configuration.

Once the code is checked into the Github, it will trigger the Build pipeline on Jenkins.
The execution status can be seen on Jenkins portal:



Try executing the Mule application deployed on the Cloudhub to check if it works as expected.

 

 

 

Leave a Reply

Your email address will not be published.