Chapter 1 What is Jenkins?
Jenkins is a scalable, continuous integration engine.
Mainly used for:
- Continuously and automatically build/test software projects.
- l Monitor some tasks that are performed regularly.
Features that Jenkins possesses include:
- Easy to install - just deploy jenkins.war to a servlet container without database support.
- l Easy to configure - all configurations are achieved through the web interface provided by it.
- l Integrated RSS/E-mail publishes build results via RSS or notifications via e-mail when the build is complete.
- l Generate JUnit/TestNG test reports.
- l Distributed build support Jenkins enables multiple machines to build/test together.
- l File recognition: Jenkins can track which jars are generated by which build, which version of jar is used by which build, etc.
- l Plugin support: Extensions are supported, so you can develop tools that suit your team's use.
1 Origin of Jenkins
Continuous integration (CI) has become a common practice for many software development teams to focus on ensuring code quality throughout the software development lifecycle. It is a practice designed to ease and solidify the software building process. And it can help your development team meet challenges such as:
- l Software Build Automation: After the configuration is completed, the CI system will build the target software according to the predetermined schedule or for a specific event.
- l Build sustainable automated checks: The CI system can continuously obtain new or modified check-in source code, that is, when the software development team needs to periodically check the new or modified code, the CI system will constantly confirm whether the new code has disrupted the successful build of the original software. This reduces the time and effort developers spend checking for changes in their interdependent code (to be straightforward, hehe).
- l Build sustainable automated testing: build an extended part of the check, execute a pre-defined set of test rules after building, and trigger notifications (email, RSS, etc.) to the relevant parties after completion.
- l Automation of subsequent processes after generation: When automated checks and tests are successfully completed, additional tasks may be required in the software build cycle, such as generating documentation, packaging software, and deploying components to a runtime or software repository. This allows the components to be made available to users more quickly.
- The minimum requirements required to deploy a CI system are a repository of available source code and a project with build scripts.
The following diagram summarizes the basic structure of a CI system:
The components of the system are functioning in the following order:
1. The developer checks in the code to the source code repository.
2. The CI system creates a separate workspace for each project. When a new build is preset or requested, it will store the source code from the source code repository to the corresponding workspace.
3. The CI system will execute the build process in the corresponding workspace.
4. (If Configuration Exists) Once the build is complete, the CI system performs a defined set of tests in a new artifact. Trigger notifications (Email, RSS, etc.) to the relevant parties upon completion.
5. (Configuration, if present) If the build is successful, this artifact is packaged and transferred to a deployment target (e.g. application server) or stored as a new version in the software repository. A software repository can be part of a CI system or an external repository, such as a file server or a website like Java.net, SourceForge, etc.
6. The CI system usually initiates corresponding actions based on requests, such as instant builds, generating reports, or retrieving some built artifacts.
Jenkins is one such CI system. Formerly known as Hudson.
Here are some reasons to use Jenkins:
- l It is the easiest to install and configure among all CI products.
- l Based on web access, the user interface is very friendly, intuitive and flexible, and in many cases provides instant feedback from AJAX.
- l Jenkins is developed on Java (which is very useful if you are a Java developer), but it is not limited to building Java-based software.
- l Jenkins has a large number of plugins. These plugins greatly expand the functionality of Jenkins; They are all open source, and they can be installed and managed directly through the web interface.
1.1 Jenkins' Objectives Jenkins' main goal is to monitor the software development process and quickly reveal problems. Therefore, it can ensure that developers and related personnel save time and effort and improve development efficiency.
The main role of the CI system throughout the development process is control: when the system detects a change in the code repository, it delegates the task of running the build to the build process itself. If the build fails, then the CI system notifies the relevant person and then continues to monitor the repository. Its characters appear to be passive; But it does reflect the problem quickly.
In particular, it has the following advantages:
- l Jenkins All configurations can be done on the web interface. Some configurations such as MAVEN_HOME and email only need to be configured once, and all projects can be used. Of course, it can also be configured by modifying the XML.
- l Modules that support Maven, Jenkins has optimized Maven, so it can automatically recognize modules, and each module can be configured as a job. Quite flexible.
- l Test report aggregation, the test reports of all modules are aggregated together, and the results are clear at a glance, using other CIs, which is an almost impossible task.
- l Artifact fingerprint, the result of each build is well automatically managed, and it can be easily browsed and downloaded without any configuration.
|