Introduction:
Jenkins is a powerful automation platform that makes it relatively straightforward to automate build testing and integration. The reason you would want to do this is :
Developer time is focused on work that matters — Much of the work of frequent integrations is handled by automated build and testing systems, meaning developer time isn't wasted on large-scale error-ridden integrations.
Software quality is improved — Any issues are detected and resolved almost immediately, keeping software in a state where it can be safely released at any time.
Faster Development - Integration costs are reduced both because serious integration issues are less likely and because much of the work of integration is automated.
Simple work flow of Jenkins :
Following flow chart represents the work flow of Jenkins.
Advantages of Jenkins :
- It is open source and it is user-friendly, easy to install and does not require additional installations or components.
- It is free of cost.
- Easily Configurable. Jenkins can be easily modified and extended. It deploys code instantly, generates test reports. Jenkins can be configured according to the requirements for continuous integrations and continuous delivery.
- Platform Independent. Jenkins is available for all platforms and different operating systems, whether OS X, Windows or Linux.
- Rich Plugin ecosystem. The extensive pool of plugins makes Jenkins flexible and allows building, deploying and automating across various platforms.
- Easy support. Because it is open source and widely used, there is no shortage of support from large online communities of agile teams.
- Developers write the tests to detect the errors of their code as soon as possible. So the developers don’t waste time on large-scale error-ridden integrations.
- Issues are detected and resolved almost right away which keeps the software in a state where it can be released at any time safely.
- Most of the integration work is automated. Hence fewer integration issues. This saves both time and money over the lifespan of a project.
Continuous Integration :
Continuous Integration is the practice of running your tests on a non-developer machine automatically every time someone pushes new code into the source repository.
This has the tremendous advantage of always knowing if all tests work and getting fast feedback. The fast feedback is important so you always know right after you broke the build (introduced changes that made either the compile/build cycle or the tests fail) what you did that failed and how to revert it.
If you only run your tests occasionally the problem is that a lot of code changes may have happened since the last time and it is rather hard to figure out which change introduced the problem. When it is run automatically on every push then it is always pretty obvious what and who introduced the problem.
Built on top of Continuous Integration are Continuous Deployment/Delivery where after a successful test run your instantly and automatically release the latest version of your codebase. Makes deployment a non-issue and helps you speed up your development.
Let us imagine a scenario where the complete source code of the application was built and then deployed on a test server for testing:
First, a developer commits the code to the source code repository.
Meanwhile, the Jenkins server checks the repository at regular intervals for changes.
Soon after a commit occurs, the Jenkins server detects the changes that have occurred in the source code repository.
Jenkins will pull those changes and will start preparing a new build.
If the build fails, then the pertinent team will be notified.
If the build is successful, then Jenkins deploys the build in the test server.
You could configure the pipeline (the script to run) to create the build with several steps:
Prepare, test (unit and integration tests), package, publish, deploy.
After running it, Jenkins generates a feedback, if these constraints are ok, the artifact is valid ( artifact is a source code compiled for testing, find more info here). And then Jenkins notifies the developers about the build and test results.
Jenkins will continue to check the source code repository for further changes made in the source code, and the whole process will keep on repeating (functional tests).