Continuous integration is a software development practice where team members integrate their work frequently (at least once a day, although multiple daily integrations are usually done). This is a fantastic idea in the DevOps context, which is why Jenkins is an important tool for companies focusing on DevOps.
Each integration is verified by compiling the source code and obtaining an executable (this is called build, and must be done in an automated way). In addition, quality tests and metrics are also passed to detect errors as soon as possible.
It is highly recommended to make builds periodically and to check that they work correctly, to achieve a more reliable final product, with fewer production failures. By frequently integrating the code, and with the help of tools like Jenkins, you can know the status of the software at all times. You know what works, what doesn’t and what mistakes there are. You can also monitor the quality of the code and its test coverage. Continuous integration can even help you reduce technical debt and keep costs down. So how does Jenkins help in this system? Let’s see.
Jenkins is a continuous, free, open-source integration server and currently one of the most employed for this feature. It is also very easy to use.
This tool comes from another similar one called Hudson, devised by Kohsuke Kawaguchi, who worked in Sun Microsystems. A few years after Oracle bought Sun, the Hudson community decided to rename the project to Jenkins, migrate the code to Github, and continue the work from there. However, Oracle has since continued to maintain and work on Hudson.
The basis of Jenkins is the tasks, where we indicate what needs to be done in a build. For example, we could schedule a task that checks the version control repository from time to time, and when a developer wants to upload their code to version control, it will compile and run the tests.
If the result is not expected or there is an error, Jenkins will notify the developer and the QA team by email or any other means to resolve it. If the build is correct, we can tell Jenkins to try to integrate the code and upload it to the version control repository.
That’s not all. One of the good things Jenkins has is that in addition to being able to help you integrate the code periodically, it can act as a linking tool throughout the development process.
From Jenkins, you can look at your quality metrics and visualize the results within the same tool. You can also view the test results, generate and view the project documentation, or even pass a stable version of the software to the QA environment to be tested, pre-production or production.
It is imperative to have a version control repository (mercurial, git, svn, plastic, etc.). Everything you need to do the build must be there (code, test scripts, third-party libraries). Without this, we will not be able to get the most out of Jenkins, since one of its strengths is that it is able to monitor version control and act on any changes.