The efficiency of the software development life cycle is what differentiates a successful app delivery to a faulty one. The industry is emphasizing on the need to increase the productivity of the development process with speedy deployment. This can be achieved with continuous integration and continuous delivery. In agile development, there is a constant need to test the code regularly with continuous integrations of the builds. Jenkins helps in optimizing the CI/CD process. So let’s start with Continuous integration and then we will move on to the role of Jenkins in achieve continuous integration.
Continuous integration is a process in which multiple commits are made every day and each commit code is built and tested immediately. Once the test is passed the build is tested for deployment and then it is sent to production. A CI/CD pipeline consists of Continuous Integration server like Jenkins, Source Control tool, Build tool, and an automation testing framework like Selenium, Appium, etc. There are many benefits of continuous integration and according to the project requirement, the development team can choose the best continuous integration tools.
What is Jenkins
Jenkins is an open-source server-based application written in Java used to achieve continuous integration in an automated fashion. It is popular because it makes monitoring the repeated task which arises during the development phase. While working on the project, Jenkins automation will continuously test the builds and recognize the errors in the early stages of the development. Jenkins speed up the software development process by automating the build and test quickly.
Why CI needs Jenkins
When a team of developers works on a project and uses a shared repository, some might take 20 days and others might take 25 days to complete. When the developers were done with their coding, they used to commit at the same time and then the build was tested. This way a single build was done after many days. But with Jenkins, build, and testing of code can be done many times in a day. Once the testing is done then the source will be deployed into the test server. Jenkins will notify the developers if the build fails.
Since the code was built all at once, some developers would have to wait for others to complete which is not efficient. It was difficult to detect and fix bugs for multiple commits. Now with Jenkins, once the developer commits, the code is built immediately and thus it is easy to find the code that causes a build failure.
Earlier the code build and test process were done manually and this was the reason for more number of errors. This is rectified by the automated build and testing in Jenkins.
One more issue was that code was deployed when all the bugs were fixed and this made the development cycle slow. Jenkins helps speed up the process as the code is deployed after every build and test.
Advantages and Disadvantages
The best thing about Jenkins is that it is open source and the community takes feedback from the users for enhancement of the project. In every three months, there is a stable release and there are more than 320 plugins are published in its plugins database. It also supports cloud-based architecture and it can be integrated with cloud-based platforms.
Some flaws include its outdated user interface and lack in the overall user experience in some ways. It runs on a server which requires more maintenance and skills to install, configure and monitor the activity. There will be some issues with the setting changes and the continuous integration will break which will need developers attention.
Use of Jenkins to Achieve CI/CD Pipeline with pCloudy
Here we can see a sample app code that will be used in this process.
This app is also hosted on Git as shown in the figure.
Go to the configuration page in Jenkins for this project.
We have configured it to pCloudySampleAndroidApp. Jenkins will pick up this project from the location and build it. Then we need to get the Github access and branch to pick the code. The source control mechanism should be polled with a schedule.
In this build, we will build the android studio project using Gradle wrapper.
Here we can see the location of the Gradle wrapper and the task that needs to be performed by Gradle.
Next step is to integrate Jenkins and the plugin can be taken from the pCloudy website.
In Step 1, we have mentioned the URL of the device cloud followed by the user name and the API key. You can retrieve your API access key by going to the settings page in pcloudy.
In step 2 we need to provide the command line path where we have mentioned the Appium Jar file which has the test cases. Next, you need to give the path of the app that has been build by Jenkins and then mention the automation duration.
In step 3, we can choose the device on which we want to run the Appium. So you can select the Android version and select the preferred device with desired specifications. We selected two devices for the process.
Now we can go back to the code and check how the entire configuration comes together.
After making the changes in the code, go to the version control system and add a commit.
After that push the code. Once the push is successful you can check in the Git if it is showing the code change.
Now again go to Jenkins and click on “Build Now”.
In the next screen, we can see the initiation of Gradle Daemon.
Now go to active sessions in device.pcloudy to see the live view of the activity in the devices.
So this is how you can make changes in the code and push the code into Git from where Jenkins download the code and upload the build into pCloudy. This process takes a few minutes and we were also able to see the test activity live which is an advantage of integrating the Jenkins based build system with pCloudy’s automation.
Conclusion
Jenkins is like the soul of the continuous integration process as it builds and tests the app continuously which makes it easier to integrate changes to the process. Most of the process is automated and this saves time and effort which can be used to perform other tasks related to the delivery. It has some issues like the old UI but the benefits like an active opensource community overshadow the little disadvantages. This is why Jenkins is the most popular CI server among the developers.
Top comments (0)