While working with MuleSoft Integration Projects implemented with AnyPoint Studio, deployment automation is always required as a desired DevOps practice for Continuous Integration and Continuous Delivery.
In this Tutorial, you will learn how to achieve Deployment Automation in MuleSoft by using Jenkins as Automation tool, Git as Source Code versioning system and maven as Build tool.
MuleSoft CI/CD: Pre-Requisites for Setting Up Environment for Deployment Automation
In order to be able to do automation deployment for MuleSoft project implemented in AnyPoint Studio, you need to have following as pre-requisites:
- Java should be installed and added to Path. Also, JAVA_HOME should be set in environment variable.
- Maven should be installed and added to Path. You can download maven from the below link:
https://maven.apache.org/download.cgi
- Git should be installed in your machine in order to use Git Bash or Git GUI for pushing code to Github repository.
Git download link: https://git-scm.com/downloads
Also, make sure that you have an account on Github as you will need to create repository in Github and code will be pushed to that repository.
- You need to have Jenkins installed in your machine and it should be up & running. You will also need to install required Plugins in Jenkins including Git plugin, Maven Plugin and Pipeline Integration Plugin.
Jenkins can be downloaded from: https://www.jenkins.io/download/
MuleSoft CI/CD Deployment Automation Steps
Once you have met all the pre-requisites, following are the brief steps that you need to follow to achieve Automated deployment to Cloudhub.
- Create Github Account and Create a Github Repository.
- Using GitBash in your machine, add Github repository.
- Create a Project in AnyPoint Studio. Make sure to add cloudhub deployment configurations in your maven configurations in pom.xml file:
<configuration>
<cloudHubDeployment>
<uri>https://anypoint.mulesoft.com</uri>
<muleVersion>4.3.0</muleVersion>
<username>your_anypoint_user</username>
<password>anypoint_password</password>
<applicationName>CICD-Test</applicationName>
<environment>Sandbox</environment>
<workers>1</workers>
<workerType>Micro</workerType>
<objectStoreV2>true</objectStoreV2>
</cloudHubDeployment>
</configuration>
Make sure that you update the configuration values as per your account and deployment options.
- Now push your code to Github repository by using git commands for adding, committing and pushing the code respectively.
- Now login to Jenkins and create pipeline items for Code checkout, code build and code deployments.
You can refer to below video where I have demonstrated this entire CI/CD deployment in step by step which will help you to understand how to achieve deployment automation in MuleSoft with Jenkins Pipelines:
You can refer to another tutorial on this blog where I explained how to deploy MuleSoft Application to Cloudhub from Runtime Manager.
If you have any questions or any feedback, feel free to comment below and don’t forget to subscribe to the channel to get more content like this in future.
Pingback: MuleSoft API Lifecycle Management : API Lifecycle Stages