Deploying Mule Application to CloudHub via Jenkins Pipeline

Apisero
4 min readNov 13, 2020

Author: Nisha Kshirsagar

Jenkins is a free and open source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat.

Following are the steps to Install Jenkins:

  1. Download Jenkins Setup.
  1. Install plugins
  1. Unlock Jenkins
  1. Create Admin User
  1. Configure Jenkins URL and Jenkins is ready to use

4. Dashboard will be open. Go to Manage Jenkins->Global Tool Configuration ->Add the JDK, Maven, and Git settings.

Deploying Mule Application to CloudHub via Jenkins Pipeline

Now, we shall see how to deploy Mule API via pipeline to CloudHub.

Note: Here we will use a script file (jenkinsfile.txt) from SCM and SCM is Git repository.

Step 1: Create a Mule project in Anypoint Studio.

Here is a simple API which has a transform message with sample payload.

Step 2: Add deployment Config in pom.xml.

Step 3: Add jenkinsfile.txt (script) in the project. There are three stages: Build , Test, and Deploy. When the pipeline is built, these three stages will be executed one after another. Each stage has repository location followed by a maven command (for the operation to be executed).

Step 4: Add settings.xml in the project

Step 5: Commit the code to the repository. Here, we’ve used Git repo.

Now, go to Jenkins and configure the pipeline.

Step 1: Click on New Item

Step 2: Provide name to pipeline, then choose pipeline option and click ok.

Step 3: Configure the “Pipeline” section as shown below.

-Select ‘Pipeline script from SCM” from drop down list.

-Provide GIt repo’s details like URL and credentials.

-Provide branch name to be deployed.

-Provide script path.

Step 4: Build Pipeline

Step 5: Once you build the pipeline, then the deployment will start. If something goes wrong, you can check logs to find its cause and work around it.

Step 6: Go to the Anypoint platform and check the app. Hit the endpoint and review the logs.

Note:

  • To resolve error: 400 Bad Request: {“status”:400,”message”:”Object Store V1 is not supported for your org”} add <objectStoreV2>true</objectStoreV2> in deployment config.
  • To resolve error 403 Forbidden: {“status”:403,”message”:”User unauthorized to access requested resource.”} try to change application name in deployment config to make it unique.

Reference: www.apisero.com

--

--