Author: Kishan Jasani
CI/CD is a method to frequently deliver apps to customers by introducing automation into the stages of app development. The main concepts attributed to CI/CD are continuous integration, continuous delivery, and continuous deployment. CI/CD is a solution to the problems integrating new code can cause for development and operations.
Specifically, CI/CD introduces ongoing automation and continuous monitoring throughout the lifecycle of apps, from integration and testing phases to delivery and deployment. Taken together, these connected practices are often referred to as a “CI/CD pipeline.” They are supported by development and operations teams working together in an agile way with a DevOps approach.
Anypoint Platform setup
- Navigate to https://anypoint.mulesoft.com
- Check your Anypoint credentials ( username and password) and Deployment environment
- Github setup
- Navigate to your GitHub account https://github.com
- Check your GitHub credentials ( username and password) and Login
- Create a Repository and Push your code
- Save git repository URL Where you want to implement CI/CD pipeline (https://github.com/Kishan-Jasani/bookmyholiday-ws.git)
- Jenkins setup
- Download Jenkins from https://www.jenkins.io/download/
- Unzip the executable jar and host the application on port 8080
- Navigate to http://localhost:8080/ and setup admin username and password
- Project level configuration
- Open pom.xml of your mule project
- Find <plugin> tag under <plugins> where <groupId> is equal to org.mule.tools.maven
- Add <configuration> tag inside <plugin>
- Setting up CI CD Pipeline using Jenkins
- Navigate to http://localhost:8080/ and login with admin username and password
- Click on Manage Jenkins → Manage Credentials
- Under Stores scoped to Jenkins on the right, click on Jenkins
- Under System, click the Global credentials (unrestricted) link to access this default domain.
- Click Add Credentials on the left.
- Enter your Github Username and Password and click on OK
- Navigate to http://localhost:8080/ and click on New Item
- Enter an item name, select Free Style Project and click on OK
- You will be navigated to the configuration page
- Enter Pipeline Description and GitHub Project url where you want to implement CI CD pipeline
- Scroll down to Source Code Management and select git.
- Add Repository URL and select credential from drop down
- Specify branch of your repository where you want to set up your CI CD pipeline
- Under Build Triggers, click on Poll SCM and write cron expressions as per your requirement.
(For example, write ‘* * * * *’ ,If you want to check the update on repository every minute)
- Under Build, Add build step ‘Invoke top-level Maven targets’
- Select Maven Version as ‘MAVEN_HOME’ and write Goals
(You Copy and Paste Goals from below)
|clean deploy -DmuleDeploy -DskipTests -Dmule.version=4.3.0 -Danypoint.username=<Your Anypoint Platform Username> -Danypoint.password=<Your Anypoint Platform Password> -Denv=<Your Anypoint Platform Environmanet> -Dappname=cicd-pipeline-demo -Dbusiness=Apisero -DvCore=Micro -Dworkers=1|
- Click on Apply
- Click on Save
- You will be redirected to Dashboard. Build will start automatically every time you change your code in the GitHub repository.
- Your Pipeline will start running. You can see the Console Output
- Your Project will start deploying automatically in your Anypoint Platform
- We are now ready with our CI CD pipeline