Recipe To Implement the Jenkins Pipeline For MuleSoft Application [Videos]
Take a look at this recipe for creating a Jenkins pipeline for MuleSoft applications with these videos and feature descriptions of tools.
Join the DZone community and get the full member experience.
Join For FreeWhat is DevOps?
DevOps is a culture which promotes collaboration between Development and IT Operations Team to deploy code to production faster in an automated & repeatable way.
Benefits of DevOps
- Releases/deployment can be done more frequently and quicker.
- Shorter mean time to repair.
- Cost reduction and reliable deployment.
- Fault isolation.
You may also enjoy: Building a Continuous Delivery Pipeline Using Jenkins
What is CI/CD?
Continuous Integration is a development practice where developers checked in the code multiple times a day in a shared repository. Each integration is verified by an automated build and automated unit testing.
Continuous Deployment is the ability to move the changes including features, bug fixes into the production quicker.
Benefits of CI/CD
- Quicker releases
- Smaller code changes
- Faster Mean Time To Resolution (MTTR).
- Improved testability.
- Improved customer satisfaction.
3.0 What is Jenkins?
Jenkins is an open-source continuous integration server capable of orchestrating a chain of actions that help to achieve the continuous integration process (and not only) in an automated fashion.
Jenkins is free and is entirely written in Java. Jenkins is a widely used application around the world that has around 300k installations and growing day by day.
CI/CD Tools For Deploying MuleSoft Application
There are many tools available to achieve CI/CD pipeline. In today’s demonstration, we will walk through this list of tools and they are widely used tools for achieving DevOps for your Mulesoft services/applications.
Tools | description |
---|---|
Github |
GitHub is a Git repository hosting service and provides a web-based graphical interface. It also provides access control and several collaboration features, such as wikis and basic task management tools for every project |
Git |
Git is the most commonly used version control system today and is quickly becoming the standard for version control. Git is a distributed version control system, meaning your local copy of code is a complete version control repository. |
MUnit |
MUnit is a Mule application testing framework that allows you to build automated tests for your Mule integrations and APIs. MUnit is very well integrated with Anypoint Studio. |
Nexus |
Nexus is a repository manager. It allows you to proxy, collect, and manage your dependencies so that you are not constantly juggling a collection of JARs |
SonarQube |
SonarQube (formerly Sonar) is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities on 20+ programming languages. |
MUnit
MUnit is a Mule application testing framework that allows you to build automated tests for your Mule integrations and APIs. MUnit is very well integrated with Anypoint Studio.
MUnit Matchers
MUnit matchers are a set of DataWeave functions to define assertion conditions for any value in an expression. When defining matchers, include the prefix MunitTools::
in the expression.
Matchers are grouped according to the type of conditions you want to validate.
Type Of Matchers
- Core Matchers
- String Matchers
- Comparable Matchers
- Iterable and Map Matchers
For more details on MUnit Matchers, click here.
Apache JMeter
Apache JMeter is an open-source software that is popular for performance testing. This tool is designed to load test functional behavior and measure performance.
It is very easy to integrate Apache JMeter with Jenkins for performing the load testing and generating the reports.
Postman And Newman CLI
Postman is currently one of the most popular tools used in API testing. A Postman Collection lets you group individual requests together. You can organize these requests into folders.
Postman Tests are JavaScript codes added to requests that help you verify results such as successful or failed status, comparison of expected results, etc. It usually starts with pm.test. It can be compared to asserts and verify commands available in other tools.
Newman is a command-line Collection Runner for Postman. It allows you to run and test a Postman Collection directly from the command line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.
It is capable of generating Command Line as well as HTML reports.
Some useful Newman commands:
Install Newman NPM: — npm install -g newman
Run Newman: — newman run Collection.postman_collection.json
Install HTML Extra: — npm install -g newman-reporter-htmlextra
Run Newman HTML Report: — newman run postman_collection.json -r htmlextra --reporter-htmlextra-export “path”
Newman Command-Line Report
Newman HTML Report
MuleSoft Deployment Options
Mulesoft provides various options for deploying your application.
- Standalone (On-premises)
- Cluster
- CloudHub
- Anypoint Runtime Fabric
- Private Cloud
Mule Maven Plugin
Mule Maven Plugin provided functionality of deploying and undeploying application to on-premise, CloudHub, cluster, or Anypoint runtime fabric. You need to add Mule Maven Plugin into your POM.xml of your application.
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>3.3.5</version>
</plugin>
Deploy Application: mvn clean package deploy -DmuleDeploy
Undeploy Application: mvn mule:undeploy
Deploying Mule Application to Cloudhub Using Mule Maven Plugin
The Mule Maven plugin has the the capability to deploy an application to Anypoint CloudHub. We need to understand some of the Mule Maven plugin parameters required for deploying an application to CloudHub.
parameters | description |
---|---|
uri |
Your Anypoint Platform URI. If not set, by default this value is set to https://anypoint.mulesoft.com |
muleVersion |
The Mule runtime engine version that will run in your CloudHub instance. |
applicationName |
The name of your application in CloudHub. |
username |
Your Cloudhub username. |
password |
Your Cloudhub password. |
server |
Maven server with Anypoint Platform credentials. |
workers |
The number of workers. By default, it is set to 1 |
workerType |
Size of each worker. The default value is MICRO. |
environment |
The CloudHub environment to which you want to deploy. |
businessGroup | Business Group of Deployment. |
properties | If you need to set properties for the Mule application you are deploying, you can use the <properties> top-level element:
Java
xxxxxxxxxx
1
1
<properties>
2
<key>value</key>
3
</properties>
For example:
Java
x
1
<properties>
2
<http.port>8081</http.port>
3
</properties>
|
region | Region of workers cloud. The default value is us-east-1. |
Deploying Mule Application to On-Premise Using Mule Maven Plugin
For more details on MuleSoft application deployment, click here.
YouTube Videos References
Deploying Mulesoft Application to Cloudhub Using Mule Maven Plugin
Deploying Mulesoft Application to CloudHub using Jenkins and Maven
Configuring Jenkins CI/CD Pipeline For Mulesoft Applications - Part I
Configuring Jenkins CI/CD Pipeline For Mulesoft Applications - Part II
Configuring Jenkins CI/CD Pipeline For Mulesoft Applications - Part III
Configuring Jenkins CI/CD Pipeline For Mulesoft Applications - Part IV
Configuring Jenkins CI/CD Pipeline For Mulesoft Applications - Part V
Create Postman Test Collection Suite for Mulesoft API
Performance or Load Testing for Mulesoft API Using Apache JMeter
Opinions expressed by DZone contributors are their own.
Comments