1 Introduction

With an accelerated growth towards the automated world, the demand for a high-quality software from the organization is also beaming high. This leads to increased competition among the software industries to develop features accomplishing efficient resource utilization and deliver projects with reduced build time. One among the tool that allow an industry to achieve is jenkins which is an open source CI tool [5]. Cloud computing with this view has gained a wider interest in the research area for optimal performance of resource allocation. In conventional software development the resources used by the developers are very expensive which in turn increases the gross resource utilized by the R&D (Research and Development) developers. To provide a measuring platform with rapid visualization for maintaining the monitoring system, CI techniques evolved.

2 Concepts on Continuous Integration and Jenkins

2.1 Continuous Integration

With the increase in the software development requirements, the need for developers to develop the codes satisfying all the scenarios plays a vital role. In this process the code needs to be enhanced and updated periodically [3]. Achieving this flexibility becomes a tedious task when it has to be performed manually, thus CI came into the picture. The ideology behind the CI is to provide developers a platform that can integrate the code into a shared repository such as git hub. The robustness of this ideology are monitored by providing check ins as and when the code is updated, which is verified by an automatic build process. Using this developer can identify the errors and debug them quickly [9].

Advantages of this CI are

  • Providing enhanced communication by increasing the visibility.

  • Locate and debug issues in the test bud itself.

  • Providing a solid platform.

  • Reduces the integration problems which allows developer to deliver software rapidly.

The CI server performs the unit tests and integration tests on the system built and releases deployable artifacts for testing along with assigning a label to each of the updated version as represented in Fig. 1.

Fig. 1.
figure 1

Continuous integration

2.2 Jenkins

Traceability is the main aspect of developers developing a software which provides flexibility of backtracking to the root cause. Jenkins is a CI tool that allows developers to implement a realistic and complete case study to create an agile environment. This further supports different orchestrate strategies and visualization tools. Plugins are used to perform the CI which acts as a boon for this software. Development life cycle processes of all kinds, including build, document, test, package, stage, deploy, static analysis will be integrated using jenkins.

Jenkins is mainly chosen for this work because, apart from other competitive tools [11], it supports a number of plugins, integrated to any development and operations (DevOps) stages as shown in Fig. 2, where jenkins is integrated with git, maven, selenium, etc. Some of the plugins that are widely used for this work are

Fig. 2.
figure 2

Jenkins integrating various DevOps stages

Build Status.

This plugin gives an information regarding how many builds are being done at a regular interval of time, be it daily or weekly along with the information about queue and wait time for each build. This enables user to know about the serving time required for each build [13].

Multiple SCM.

This provides the user check in and out multiple source control tools that might be one or more repository which overcomes the drawback of SCM that provides only one source control tool at a time [13].

Parameterized Trigger.

This plugin provides users to have their input as a variable and use it in run time. This is the most used plugin in dynamic environments where users have lots of options and user-defined values to be used in the build which may keep changing [13].

Perforce.

This provides a rapid and seamless path to extract projects into pipeline stages within Jenkins from a perforce plugin. In this context perforce behaves like a repository. This plugin helps to manage the user’s CI processes improvising the quality and traceability [13].

2.3 Literature Survey

CI has become a DevOps practice used by different communities as CI allows all the team to deploy rapidly changing hardware and software resources [16], related works on our research has been previously done using CI jenkins, build optimization as an important part of CI. In [3], regarding the build, the projects that use CI are more effective at merging requests, they researched their work on several GitHub projects and provided answers for CI usage, costs and benefits. Performance analysis of CI builds for GitHub projects were carried out specifically focusing on JAVA programming language [14]. In [7], the usage of CI has been researched and have acknowledged that, build information from different sources can help developers. In [8, 14], the CI usage in software quality information and scalable test execution using CI has been discussed. A primitive part of CI is built system, either way researchers tried to improve the performance of builds [6] and enhancing the dependency retrieval [10]. So, researchers have proposed several optimizing methods for builds [4] and also discussed efficient way of running test cases [1].

3 Methodology

This section briefs out about the formulation and proposed design for the optimization of build time. From our research build time can be optimized using full build, parallel build and incremental builds. We discuss the need for CI and how to enhance the build quality and optimize build time using open source tool Jenkins and by making efficient use of available Jenkins plugins. The design formulated in the Fig. 4 gives an overview of the methodology involved in performing the automated continuous integration for the slave node.

3.1 Jenkins Architecture

Jenkins supports master-slave architecture, which is also called Jenkins Distributed Builds. This provides user flexibility of running various environments like LINUX, Windows, Ubuntu, etc., also these distributable builds are capable of running same test cases in parallel on numerous environments. Such a build helps to improve the distributed approach and achieve the desired results instantly. The master node would be responsible for scheduling the jobs, monitoring the slaves, dispatching builds to the slaves for execution [12]. List of slaves configured are shown in Fig. 3.

Fig. 3.
figure 3

Supervising slave nodes

The slave node monitored by master node will be responsible for the execution of parallel builds. The user can configure the master to run a particular build on any slave or can schedule a build for a particular time. Each slave as a number of executors where one slave can run multiple jobs in it.

3.2 Implementation of Jenkins Jobs

Before jumping into the main approach, let us see the initial steps required for setting up a jenkins job, jenkins server will be installed on master node with the use of manage node, different OS slaves will be created based on platforms, one slave agent can run multiple tasks with the help of multiple executors plugin, when all the slave agents are up and running, master will choose a slave agent where a job can run in an OS definitive platform. Our approach is using maven project, which deals with POM (Project Object Model) file which drastically reduces the configurations. To manage source codes jenkins supports Git, Perforce, Mercurial, Multiple SCM’s (source code management) etc. Jenkins allows user to pass parameter to build using parametrized build plugin.

Build steps are included in the scripts, since it is a maven build mentioning the POM file, goals like clean and install is the key part for build. Based on the obtained results from the executed jobs, concerned teams are notified and if the build fails particular person who broke the build will be notified. Above procedure are successfully executed with the help of our scripts, configuration files and with the efficient use of available jenkin plugins. Advancing to the optimization part, this process can be completely automated, but our main focus is to approach a way to reduce the build time.

figure a

As shown in Fig. 4, whenever build is triggered to run the test cases, we need an environment to test these things. From the POM file the required files and software’s are copied to the slave agent and run the test cases, this operation is full build, where every time a new job is created full build happens, so whenever a developer check-in build will be triggered. Let us take a use case whenever a build is triggered a clean install happens in other words full build, whenever there is full build it may take more than 3 h to build. To make it efficient the approach is to use incremental build. So, whenever there is a check-in in the same module, we can keep a check, so we can build only that module in other words incrementally building jenkins tasks, the algorithm 1 for build optimization is shown below.

Fig. 4.
figure 4

Proposed methodology

Detailed flow of running jenkins tasks is shown and steps to it are listed below.

  1. 1.

    Initially the process begins with code check-in, if there is no code check-in, tasks will be in the hold state.

  2. 2.

    After successful code check in, Jenkins server selects the appropriate slave platform for which the workflow could be started along with the note on efficient utilization of resource.

  3. 3.

    It is very important to update the changes in the repository regarding the selected slave and the code check-in status.

  4. 4.

    Check whether the repository sever is running on slave platform, if installed execute workflow or else install the repo server and required modules and then proceed to the workflow.

  5. 5.

    Build/Launch and run the Test source code on the slave machine.

  6. 6.

    If the test cases fail, fix the bugs and again reinitiate the build, if the build is successful generate a report.

  7. 7.

    The report consists of all the information about failed and passed test cases, who initiated the build, who broke the build.

  8. 8.

    So, if there is a code check-in in the same module, first the system checks whether there are any required modules to be installed in the system, if not incremental build will be initiated, it is at this stage the build is being optimized with the help our scripts.

  9. 9.

    Step 5, 6 &7 will be repeated again.

  10. 10.

    Terminate the workflow and the build on successful completion of the pipeline.

4 Results and Discussions

The outcome of build optimization and the time expended for list of jobs are shown in the graph, in Fig. 5. From the graph we can get to know about the time duration of number of builds, total build time and different states of builds, yellow coloured part represents the unstable build and the red coloured part depicts the failed scenarios whereas the black coloured line displays total collective build time on each time range. Logs will be available in the build console and a detailed description of all the builds or a particular build will be available. From Fig. 5, in build No. 30, Full build takes around 2 h to build, progressively the build time is getting reduced, these shows our methodology is fully functional. For example, in Fig. 6, build No. 37 took approximately 2 h to build, while build No. 42 which took approximately 1 h, this is due to incremental build of certain modules. So, whenever there is a check-in, perform full build and if there are only few changes in the builded module incremental build is a paramount option.

Fig. 5.
figure 5

Build time trend

Fig. 6.
figure 6

Build duration

Also, parallelly building jobs in slaves will save time. There are number of CI tools in the market, since jenkins is an open source tool and availability of efficient plugins makes it as a cost-efficient solution to all CI related problems.

5 Conclusion and Future Scope

CI is the imperative part for any Software industry. Integration of tasks on a regular basis will optimize developers time, CI helps developers to focus more on key issues and better software quality. Jenkins afford a superior result for these tasks and it’s a chosen one for CI automation. These paper gives an idea about how build time is optimized using Jenkins. The detailed steps and procedures for implementing are discussed and an overview of plugins used for Jenkins are discussed in detail in this paper. Finally, these tasks can be optimized much more in the future, allowing to build/rebuild using any repository and test whenever there is a check-in, the entire process can be automated in future.