Author: Anjali Kushwaha
Introduction:
This guide is about the CI/CD (Continuous Integration/Continuous Delivery) pipeline. CI/CD, or continuous integration and continuous delivery, is the practice of building and releasing software in an automated and safe manner.
Prerequisites:
- Bitbucket Account
- Anypoint Platform Account
- Standalone Mule Server
- Container Registry eg. Nexus, jFrog, etc (if using maven dependencies which are not found in .m2/repository)
Objective:
- To deploy a MuleSoft application having a domain project to Anypoint Platform using Mule Standalone Server with Bitbucket Tool.
Steps to configure in Mule Standalone Server:
- Before starting the server, place your domain project jar inside the domain folder of your runtime(if any).
- Start mule runtime from command prompt- /bin/mule.bat
Note: here using server name – node1 and application name – Hybrid-App
Steps to configure in Bitbucket:
Using Sandbox Environment only for the demo, the same can be done for other environments (Dev, UAT, Prod).
1. Add Application to your Repository:
- Create two folders, Application and Domain.
- Add Application to the Application’s folder and Domain Project(if any) to the Domain’s folder.

2. Enable Bitbucket Pipeline:
- From Repository Settings, go to Pipeline settings and enable pipeline.

3. Edit Application’s POM:
- Add below mule-maven-plugin configuration to your pom.xml.

4. Setting up Pipeline Repository Variables:
- Go to the Repository Settings, from there we can set repository variables that can further be used in pipelines.
- Create the following variables.

5. Build CICD Pipeline:
- Create a bitbucket-pipelines.yml file in the master branch.
- As we are deploying the application only on Sandbox, add below code to your bitbucket-pipelines.yml.
image: maven:3.5.2
pipelines:
branches:
master:
– step:
name: ‘Build’
trigger: automatic
caches:
– maven
script:
– mvn -f Domain clean install
– parallel:
– step:
name: Build and Deploy
trigger: automatic
caches:
– maven
script:
– mvn -f Application deploy -DmuleDeploy -Dtarget=$target -DtargetType=$targetType -Dusername=$username -Dpassword=$password -Denvironment=$environment
– step:
name: Security Scan
script:
– pipe: atlassian/git-secrets-scan:0.4.3
- Reason to build Domain Project (Both steps are running in parallel, so as to use domain project dependency in our Main Application else container registry can also be used).
- In case you want to deploy application which is not external domain referenced, add below code:
image: maven:3.5.2
pipelines:
branches:
master:
– step:
name: Build and Deploy
trigger: automatic
caches:
– maven
script:
– mvn -f Application deploy -DmuleDeploy -Dtarget=$target -DtargetType=$targetType -Dusername=$username -Dpassword=$password -Denvironment=$environment
– step:
name: Security Scan
script:
– pipe: atlassian/git-secrets-scan:0.4.3
- Click pipelines to see running jobs

- Now our application is deployed, visit Anypoint Platform Runtime Manager to check the deployed application.
