Jenkins is a tool for continuous integration and continuous deployment. It proves to be an extensible Automated Server for a simple CI server or for a large scale project where you need continuous integration throughout the process. Jenkins is the open source Automation server that gives you a blazing variety of plugins to build, deploy and automate any project throughout the process. The wide variety of plugins will let you customize your process as your client demands.
We currently use four development environments:
- Local Server used by Devs.
- Quality Server used by QAs to test also Developer use QA to perform Doting.
- Staging Server is used by product owner / client / stakeholders.
- Production Server which is actually live site.
Using Jenkins we make sure that everything is integrated , tested on every single code integration. We have currently four Quality Gates:
- Sonar (for Code Quality)
- Unit tests
- Vaddy (For Security Vulnerability)
- E2E Tests
How We Use Jenkins
The code you are getting from BitBucket is fetched on the Jenkins. Here, is the dashboard where we will have the pipelines i.e., branches for every stage. Let me explain how these are integrated by looking into the example of one environment, let say Quality. As we are using Git Flow for our branch management with SourceTree. So let say developer has completed one feature so steps onwards will be:
- Developer will Create a pull request to merge his Feature branch to Develop so that QA can perform QC activities.
- Pull request is created for Code written and tests written for particular feature.
- Then peer will review his code.
- If code review is passed then pull request is merged using BitBucket.
- Here then comes our superhero Jenkins.
How Jenkins Merge Code
- Jenkins get code from Development Branch.
- Integrate new feature with already developed code by making sure all dependencies are fixed successfully.
- Build Code.
- Run Sonar analytics:
- If sonar analytics fails then build is failed and will be notified to the developer to fix the code and make it pass from Sonar.
- If Sonar analytics passes then Jenkins runs unit tests, and test report is generated:
- If any test fails then it’ll assign back to the developer to refactor and pass it.
- When unit tests are passed then code is pushed to Vaddy to run security test using Vaddy:
- If vaddy points out any security threat in code then build is failed and it’s assigned back to developer to fix it.
- When Vaddy tests are passed the code is deployed on Quality Server.
- After code is deployed on Quality server, then Jenkins run E2E tests:
- If E2E tests are failed then assigned back to developer to refactor and pass tests.
- When E2E test are passed then email and notification is sent in Hipchat team room that deployment is successful.
- After deployment QA run QC activities like Cross Browser Testing , UX to make sure it’s pixel perfect and others if required.