In this article by Mitesh Soni, the author of the book DevOps for Web Development, provides some insight into DevOps movement, benefits of DevOps culture, Lifecycle of DevOps, how Jenkins 2.0 is bridging the gaps between Continuous Integration and Continuous Delivery using new features and UI improvements, installation and configuration of Jenkins 2.0.
(For more resources related to this topic, see here.)
Let's try to understand what DevOps is. Is it a real, technical word? No, because DevOps is not just about technical stuff. It is also neither simply a technology nor an innovation. In simple terms, DevOps is a blend of complex terminologies. It can be considered as a concept, culture, development and operational philosophy, or a movement.
To understand DevOps, let's revisit the old days of any IT organization. Consider there are multiple environments where an application is deployed. The following sequence of events takes place when any new feature is implemented or bug fixed:
Let's list the possible issues in this approach:
This diagram covers all the benefits of DevOps:
Collaboration among different stakeholders brings many business and technical benefits that help organizations achieve their business goals.
Continuous Integration(CI),Continuous Testing(CT), and Continuous Delivery(CD) are significant part of DevOps culture. CI includes automating builds, unit tests, and packaging processes while CD is concerned with the application delivery pipeline across different environments. CI and CD accelerate the application development process through automation across different phases, such as build, test, and code analysis, and enable users achieve end-to-end automation in the application delivery lifecycle:
Continuous integration and continuous delivery or deployment are well supported by cloud provisioning and configuration management. Continuous monitoring helps identify issues or bottlenecks in the end-to-end pipeline and helps make the pipeline effective.
Continuous feedback is an integral part of this pipeline, which directs the stakeholders whether are close to the required outcome or going in the different direction.
"Continuous effort – not strength or intelligence – is the key to unlocking our potential"
-Winston Churchill
What is continuous integration? In simple words, CI is a software engineering practice where each check-in made by a developer is verified by either of the following:
This step is followed by executing a unit test against the latest changes available in the source code repository.
The main benefit of continuous integration is quick feedback based on the result of build execution. If it is successful, all is well; else, assign responsibility to the developer whose commit has broken the build, notify all stakeholders, and fix the issue.
Read more about CI at http://martinfowler.com/articles/continuousIntegration.html.
So why is CI needed? Because it makes things simple and helps us identify bugs or errors in the code at a very early stage of development, when it is relatively easy to fix them. Just imagine if the same scenario takes place after a long duration and there are too many dependencies and complexities we need to manage. In the early stages, it is far easier to cure and fix issues; consider health issues as an analogy, and things will be clearer in this context.
Continuous integration is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
CI is a significant part and in fact a base for the release-management strategy of any organization that wants to develop a DevOps culture.
Following are immediate benefits of CI:
Jenkins, Apache Continuum, Buildbot, GitLabCI, and so on are some examples of open source CI tools. AnthillPro, Atlassian Bamboo, TeamCity, Team Foundation Server, and so on are some examples of commercial CI tools.
Jenkins was originally an open source continuous integration software written in Java under the MIT License. However, Jenkins 2 an open source automation server that focuses on any automation, including continuous integration and continuous delivery.
Jenkins can be used across different platforms, such as Windows, Ubuntu/Debian, Red Hat/Fedora, Mac OS X, openSUSE, and FreeBSD. Jenkins enables user to utilize continuous integration services for software development in an agile environment. It can be used to build freestyle software projects based on Apache Ant and Maven 2/Maven 3. It can also execute Windows batch commands and shell scripts.
It can be easily customized with the use of plugins. There are different kinds of plugins available for customizing Jenkins based on specific needs for setting up continuous integration. Categories of plugins include source code management (the Git, CVS, and Bazaar plugins), build triggers (the Accelerated Build Now and Build Flow plugins), build reports (the Code Scanner and Disk Usage plugins), authentication and user management (the Active Directory and GitHub OAuth plugins), and cluster management and distributed build (Amazon EC2 and Azure Slave plugins).
To know more about all plugins, visit https://wiki.jenkins-ci.org/display/JENKINS/Plugins.
To explore how to create a new plugin, visit https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial.
To download different versions of plugins, visit https://updates.jenkins-ci.org/download/plugins/.
Visit the Jenkins website at http://jenkins.io/.
Jenkins accelerates the software development process through automation:
Here are some striking benefits of Jenkins:
The Jenkins build pipeline (quality gate system) provides a build pipeline view of upstream and downstream connected jobs, as a chain of jobs, each one subjecting the build to quality-assurance steps. It has the ability to define manual triggers for jobs that require intervention prior to execution, such as an approval process outside of Jenkins. In the following diagram Quality Gates and Orchestration of Build Pipeline is illustrated:
Jenkins can be used with the following tools in different categories as shown here:
Language |
Java |
.Net |
Code repositories |
Subversion, Git, CVS, StarTeam |
|
Build tools |
Ant, Maven |
NAnt, MS Build |
Code analysis tools |
Sonar, CheckStyle, FindBugs, NCover, Visual Studio Code Metrics, PowerTool |
|
Continuous integration |
Jenkins |
|
Continuous testing |
Jenkins plugins (HP Quality Center 10.00 with the QuickTest Professional add-in, HP Unified Functional Testing 11.5x and 12.0x, HP Service Test 11.20 and 11.50, HP LoadRunner 11.52 and 12.0x, HP Performance Center 12.xx, HP QuickTest Professional 11.00, HP Application Lifecycle Management 11.00, 11.52, and 12.xx, HP ALM Lab Management 11.50, 11.52, and 12.xx, JUnit, MSTest, and VsTest) |
|
Infrastructure provisioning |
Configuration management tool—Chef |
|
Virtualization/cloud service provider |
VMware, AWS, Microsoft Azure (IaaS), traditional environment |
|
Continuous delivery/deployment |
Chef/deployment plugin/shell scripting/Powershell scripts/Windows batch commands |
Jenkins provides us with multiple ways to install it for all types of users. We can install it on at least the following operating systems:
One of the easiest options I recommend is to use a WAR file. A WAR file can be used with or without a container or web application server. Having Java is a must before we try to use a WAR file for Jenkins, which can be done as follows:
Download the jenkins.war file from https://jenkins.io/.
Open command prompt in Windows or a terminal in Linux, go to the directory where the jenkins.war file is stored, and execute the following command:
java – jar jenkins.war
Once Jenkins is fully up and running, as shown in the following screenshot, explore it in the web browser by visiting http://localhost:8080.
By default, Jenkins works on port 8080. Execute the following command from the command line:
java -jar jenkins.war --httpPort=9999
For HTTPS, use the following command:
java -jar jenkins.war --httpsPort=8888
Once Jenkins is running, visit the Jenkins home directory. In our case, we have installed Jenkins 2 on a CentOS 6.7 virtual machine.
Go to /home/<username>/.jenkins, as shown in the following screenshot. If you can't see the .jenkins directory, make sure hidden files are visible. In CentOS, press Ctrl+H to make hidden files visible.
Now that we have installed Jenkins, let's verify whether Jenkins is running. Open a browser and navigate to http://localhost:8080 or http://<IP_ADDRESS>:8080. If you've used Jenkins earlier and recently downloaded the Jenkins 2 WAR file, it will ask for a security setup.
To unlock Jenkins, follow these steps:
Go to the .Jenkins directory and open the initialAdminPassword file from the secrets subdirectory:
Copy the password in that file, paste it in the Administrator password box, and click on Continue, as shown here:
Clicking on Continue will redirect you to the Customize Jenkins page. Click on Install suggested plugins:
The installation of the plugins will start. Make sure that you have a working Internet connection.
Once all the required plugins have been installed, you will seethe Create First Admin User page. Provide the required details, and click on Save and Finish:
Jenkins is ready! Our Jenkins setup is complete. Click on Start using Jenkins:
Get Jenkins plugins from https://wiki.jenkins-ci.org/display/JENKINS/Plugins.
We have covered some brief details on DevOps culture and Jenkins 2.0 and its new features. DevOps for Web Developmentprovides more details on extending Continuous Integration to Continuous Delivery and Continuous Deployment using Configuration management tools such as Chef and Cloud Computing platforms such Microsoft Azure (App Services) and AWS (Amazon EC2 and AWS Elastic Beanstalk), you refer at https://www.packtpub.com/networking-and-servers/devops-web-development. To get more details Jenkins, refer to JenkinsEssentials, https://www.packtpub.com/application-development/jenkins-essentials.
Further resources on this subject: