Quick viewing(Text Mode)

White Paper Getting Started with Continuous Integration in Software

White Paper Getting Started with Continuous Integration in Software

WHITE PAPER

GETTING STARTED WITH CONTINUOUS INTEGRATION IN Amruta Kumbhar, Madhavi Shailaja & Ravi Shankar Anupindi Introduction DevOps culture is gaining rapid momentum in the IT industry as it enables business to adopt agile software delivery methodologies like Continuous Integration (henceforth referred to as CI) & (henceforth referred to as CD) .These methodologies enable quicker issue resolution, instant feedback loops, improved and cost saving to meet the ever- increasing demand to deliver better software faster. It would not be wrong to say that CI-CD practices will soon become the de- facto software delivery standards across the industry.

Though both these methodologies (CI and CD) This article compiles insights gained from complement each other, CI is the pre-requisite our practical experiences across various CI phase for enabling CD as the latter is built on enablement programs which we have been Gartner says “By 2016, top of the former. The primary goal of CI is associated with. not only to enable through DevOps will evolve Some of these experiences might vary continuous test and quality checks but also to from a niche to a depending on the choice of tools, provide project insights through reports and infrastructure setup, organization policies mainstream strategy dashboards. Since this phase is all about tools, and project requirements. In spite of the employed by 25 it imposes various integration challenges. differences, we hope, this article will act as Having a good knowledge of the tools Percent of global 2000 a helping guide to all those planning for CI involved, their integration aspects and the organizations” setup in their projects. best practices to follow, will definitely enable their smoother adoption and rollout across This article is organized into different sections enterprises looking to adopt CI practices. as below –

Section 1 Section 2 talks Section 3 Section 4 Section 5 Section 6 And we nally shows the CI about the discusses the includes some enumerates shows the summarize our setup which we various tools challenges of the best some of the deployment ndings in have been being used to faced and the practices that bene ts topology for Section 7. using. achieve CI. solution can be adopted obtained the CI setup approaches we for CI from CI used.

External Document © 2018 Infosys Limited External Document © 2018 Infosys Limited 3 Build Source Control Server

Continuous Integration Server 2 Fetch Changes

Test 4 5 Failure or Success

6 Notify Success or Failure Check in Changes 1

Various stakeholders Developer 1 Developer 2

Continuous Integration Setup

The below diagram illustrates the end to Integration server. Developers check-in notifications for any failure end Continuous Integration (CI) setup the code into source control server which which enables the development team to which we have been following across is integrated with CI server. For each build, take immediate action. This continuous projects. As seen below, the main actors CI server is configured to run the JUnit chain helps in reducing include the Development team, the Source cases, Selenium based functional test cases, the overall defect density and thereby Control Server and the Continuous code quality checks and provide improving the code quality.

Tools Adoption recommended that every organization successfully across various projects for CI CI depends mostly on adopting the must do proper due diligence in evaluating enablement. As seen, we have adopted correct set of tools and their proper different toolsets and choosing the as the continuous integration usage. The selection of tools is appropriate ones suitable for their platform but there are other CI platforms generally driven by various IT policies requirements. (Bamboo, TeamCity etc.) to choose from. in the organization, existing technology The same case holds good for other landscape, current infrastructure setup, The diagram below shows the toolsets toolsets also. and other considerations. It is therefore (phase wise) which we have been using

Develop Build Test Deploy01

Continuous Integration • Open Source • Widely used in industry • Provides varied plugins

Version Control Build Automation Code Quality Analysis Artifact Management

• Open Source • Open Source • Integrated test cases • Widely used in industry • Widely used in industry • Widely used in industry • Code quality dashboard • Ease of con guration • Jenkins integration • Jenkins compatible • Jenkins integration • Jenkins integration

External Document © 2018 Infosys Limited External Document © 2018 Infosys Limited Challenges Faced We faced a few challenges during our CI journey and some of the major challenges encountered are explained below.

Providing Granular Level Access Regular Build Failures Builds Waiting for GIT Repository Integration In Jenkins Node Executor 1 2 3 4

roidin indiidual leel access as ost common issue faced os ere Due to node deendency roects Issue ile creatin a trusted lin a redundant and time consumin failin ecause of erm en sace ere aitin in te ueue een if eteen I and enins serer tas issue emory consumtion on slae idle executors ere aailale on nodes as i due to enins o oter nodes uilds ere aitin for orsace and enerated artifacts executor due to eay uild load

Solution Approach Solution Approach Solution Approach Solution Approach

e came u it te role ased o sole tis issue cron scrits Een ceduler luin as used rust as created eteen I access solution aroac is ere created to clean u te o to ensure tat load distriution and enins usin ulic and aroac eled to roide orsace and artifacts once a as aenin eenly across all riate eys of enins serer access to roles rater tan ee in order to release te nodes indiidual leel memory

External Document © 2018 Infosys Limited External Document © 2018 Infosys Limited Best Practices Followed roidin indiidual leel access is alays After having worked on multiple CI le ased ccess a cumersome tas and terefore it is recommended to roide oleased access enablement projects we have condensed together the set of best practices which ron scrits ere created to clean u te o orsace and artifacts once a ee in order we have learnt/followed. Most of these egla clean sace aacs to release te memory and terey aoid practices have been standardized and memory lea issues published as CI guidelines for internal usage en dsn o oercome te default eaior of enins across teams. In this section we highlight lad acss ndes in terms of node icin o Een cedulin some of the best practices which we follow luin as used ic ensuresd een en chedle lgn distriution of or load across nodes and would like to share with others.

elae ased centraliation of common roerties across roects

Benefits Realized

Following are some of the benefits which we have realized by CI enablement across projects.

ld an Cde al nalcs C naleen

Builds were automated Notication feature Sonar dashboard Workow conguration by using the Poll SCM enabled development provided centralized view on Jenkins enabled auto feature of Jenkins. This team to respond quickly of code quality issues and deployment of not only enabled faster to the build failure dashboards created application artifacts builds but also helped scenarios. This helped in leveraging Jenkins APIs, (EAR/WAR les) on the to eliminate manual quicker resolution of code provided complete build required application build e ort issues and ultimately led information. This enabled server whenever a new to stable code base project teams to take snapshot version of the timely corrective steps artifact was available

Fase eleases Cs angs ed dc ed Cde al

CI enabled faster release Many projects cut down CI-enablement helped CI-enablement helped cycles with stable code on the cost to maintain increase development increase development separate build teams team productivity by team productivity by after build automation. relieving them from relieving them from This resulted into build related aspects build related aspects signicant cost savings with complete focus on with complete focus on for them their core development their core development activities activities

Note: The above mentioned quantitative improvements are the average % improvements which have been observed across various projects.

External Document © 2018 Infosys Limited External Document © 2018 Infosys Limited Topology and Deployment view

Below is the high-level topology of the Moreover, executing jobs on the master’s workload of building projects is delegated CI platform which we have been using. executors can introduce a security issue. to multiple slave nodes. The key benefits of this topology are high Any Jenkins’s user with full permissions If you notice we have enabled Jenkins availability and scalability. To achieve high can play havoc with the system as they will master to only handle HTTP requests and scalability and distributed build system we have direct access to private information manage the build environment. Actual have set up dedicated build nodes that run whose integrity and privacy could not be, execution of builds will be delegated to the separately from the Jenkins master. This thus, guaranteed. We leveraged the Jenkins slaves. With this configuration it is possible frees up resources for the master server to supported “master/slave” mode, where the to horizontally scale the architecture. improve its scheduling performance.

Fig 2. Continuous integration topology view

External Document © 2018 Infosys Limited External Document © 2018 Infosys Limited # Component Key Characteristics To avoid a single point of failure and support high availability we have the master slave configuration 1 Master and Backup Server setup. In case the master goes down, a slave node can provide the continuity 2 NAS Storage Responsible for sharing $JENKINS_HOME directory for all Jenkins Master VMs A slave node is a machine set up to offload build projects from the master node. Actual execution of the build happens on the slave node. The method for scheduling builds depends on the configuration given 3 Jenkins Slave Nodes to a specific project. Some projects may be configured to only use a specific slave node while others can freely pick up a slave nodes from among the pool of slave nodes assigned to the master Responsible for concurrent builds on slave nodes. If a slave node consists of 4 executors , concurrently 4 4 Jenkins Executors jobs can be built on that node Responsible to ping all nodes in the cluster via a health check URL and uses their return codes to 5 Reverse Proxy Server determine which node is the primary/active master

Conclusion

We believe that Continuous Integration is at the core of DevOps and needs proper planning. Since it is all about tools and their integration aspects, making appropriate choices based on various considerations is very important. Building good expertise on the tools involved, their integration aspects and other best practices, helps, avoid common pitfalls and helps speed up CI adoption.

In spite of knowing and following all the best practices, there will always be some or other challenges faced during CI adoption but the final benefits realized far outweigh these initial hiccups. We hope this article might have helped you in some way or the other and we would love to hear from you.

References

1. Gartner Says By 2016, DevOps Will Evolve From a Niche to a Mainstream Strategy Employed by 25 Percent of Global 2000 Organizations- http://www.gartner.com/newsroom/id/2999017

2. Distributed builds using Jenkins : https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds

External Document © 2018 Infosys Limited External Document © 2018 Infosys Limited About the Team

Amruta Kumbhar Madhavi Shailaja Ravi Shankar Anupindi Technology Lead Technology Architect Sr. Technology Architect

Amruta Kumbhar is a Product Technical Madhavi is a Technology Architect in Ravi is a Senior Technology Architect in Infosys. Ravi has strong expertise on Java Lead in Infosys. She has strong expertise Infosys. She has strong expertise on Java technologies and leads the Performance on Java technologies and database technologies. She also has very good Engineering COE in one of the business technologies (Oracle, DB2, MongoDB ). expertise related to various CI aspects - verticals. His areas of interest include exploring latest technologies and looking She also has very good expertise related build management using Maven and Ant. at ways to adopt them to derive significant to various CI aspects - build management She can be reached at Madhavi_Katakam@ business benefits. He has been actively using Maven and SonarQube plugin infosys.com involved in DevOps initiatives for various creation. She can be reached at Amruta_ clients. He can be reached at Ravi_ [email protected] [email protected]

or more information contact asusinfosyscom

© 2018 Infosys Limited enaluru India ll its esered Infosys eliees te information in tis document is accurate as of its ulication date suc information is suect to cane itout notice Infosys acnoledes te rorietary rits of oter comanies to te trademars roduct names and suc oter intellectual roerty rits mentioned in tis document Excet as exressly ermitted neiter tis documentation nor any art of it may e reroduced stored in a retrieal system or transmitted in any form or y any means electronic mecanical rintin otocoyin recordin or oterise itout te rior ermission of Infosys Limited and or any named intellectual roerty rits olders under tis document

Infosyscom E I tay onnected