Continuous Integration(CI) Tools

Continuous Integration(CI) Tools

Abstract

In this article, you will get the profound understanding of continuous integration and several tools to achieve the purpose. Moreover, you will understand the need of CI tools for your projects and will eventually be able to decide best suitable tools for your project.

Introduction(About Continuous Integration Tools)

Continuous Integration tool is a development practice that requires developers to integrate code into shared repositories several times a day. By integrating regularly, error can be detected quickly and located easily.

How does it help?

With continuous integration, there is significantly less backtracking to discover problems or to find where things went wrong in your code. With this you can spend more time in building stuffs rather to find error and fixing it.

Moreover, CI is cheap. If continuous approach is not followed then this makes it exponentially difficult to find and fix problems. Such integration problem can easily knock the project off deadline or cause it fail altogether.

Martin Fowler put it nicely:

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily – leading to multiple integrations per day. Each integration is verified by an automated build
(including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

Benefits of CI:

Enough talking about what is Continuous Integration. Let us now focus into some of its benefits in depth.

  • Reduced integration risk: 

    Working on a project involves the involvement of several people over different part of code. More the people, more riskier the integration gets. In this case, debugging and solving the issue can be painful and can potentially mean a lot of changes to the code. Integrating on a daily basis or even more frequently can help reduce these kinds of problems to a minimum.

  • Higher Code Quality:

    More focus is given to code functionality rather to be invested in solving bugs and thus producing higher quality product.

  • Reduced Conflicts among team members:

    Having the impartial system in place reduces the frequency of conflicts between team members.

  • The code in version controls work:

    If you commit something that breaks the build, the team member immediately gets notified about the bug and it is immediately fixed before someone else pulls the code and start working on it.

  • Easy for testers:

    Having different versions and builds of code can help isolate and trace bugs efficiently and makes it easy for QA.

  • Less time deploying:

    Deploying projects can be very tedious and time-consuming, and automating that process makes perfect sense.

  • Increased confidence:

    People can invest their focus and energy to concentrate on producing than to worry about the potential consequences of their actions.

Requirements of CI

Now, the question arises what are the requirements for the installation of CI systems.

  • The first and foremost requirement is having version control system(VCS).There is no other alternative for this. VCS provides a reliable method to centralize and preserve changes made to project over time.
  • If you are using onsite solutions, another requirement is to have a spare server or workstation or at the very least a virtual machine. Having a clean machine to build your system on is of the essential importance.
  • If you do want either of the above, then there is many hosted CI tool solutions that abstract the maintenance of the whole process and offer easier scalability.

The most widely known and used CI tools include Jenkins,TeamCity, Bamboo and many more. We will discuss about these in details later on in this article.

Continuous Integration Servers

Continuous integration server (aka build server, aka CI server) is a software tool that centralizes all your CI operations and provides a reliable and stable environment for you to build your projects on. CI servers are highly configurable and adjustable to be able to build a variety of projects for different platforms. Running builds and tests are the basic features of every build server.

Continuous Integration(CI) Server

The most important things to consider when using CI server is to have a clean machine prepared for its installation. Having a neutral environment, untainted by unnecessary tools, environment variables, and other configurations, is crucial for the successful usage of the CI server and CI overall. If it’s not possible to install the CI server physical machine, you can set up a virtual environment and use it as the last resort.

Using development machines without setting up virtual environments will probably leave you with false assumptions and results. Once you deploy the application to another machine, you could potentially run into new problems.

Typically CI server uses a version control system like Subversion or Git or any other to pull your project files. It monitors your project’s repository and on the successful commit it pulls the changes and performs the tasks what you defined previously for that project. Upon completion of the tasks, CI server sends feedback to the relevant project members with the details of the build. Checking out the latest version of your project, running the build scripts, running the tests, and sending notifications are the most basic functionalities of the CI servers.

Besides these, features like code analysis, code coverage, code quality reports, agent pooling, pipelines, build comparisons, IDE integration, third-party tools support and many others make the CI servers very flexible and comfortable to use.

  • Jenkins: Continuous Integration(CI) Server

    Jenkins is an open-source tool written in Java. It is a cross-platform CI tool and it offers configuration both through GUI interface and console commands. Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed. Jenkins is a highly extensible product whose functionality can be extended through the installation of plugins.

    Note:One of the best solutions out there, both powerful and flexible at the same time. The learning curve could be a bit steep, but if you need flexibility it very well pays off to learn how to use it.

    Working:

    • 1. Set up Prerequisites (make sure you have jdk 1.8 or more): AWS account, AWS Identity and Access Management(IAM) user name and password, an Amazon EC2 key pair, and a configured Virtual Private Cloud(VPC).
    • 2. Launch an EC2 instance: Launch a virtual server to host Jenkins. These virtual instances are called EC2 instances. This is also called as Amazon Machine Image(AMI).
    • 3. Install and Configure Jenkins: Deploy Jenkins on your EC2 instance by following the procedure: (a) Connect to Your Linux Instance (b) Download and Install Jenkins (c) Configure Jenkins

    Jenkins Installation and Configuration

    Now we are ready to install `Jenkins`. So before the package installation, we have to add the key and source list to apt for Jenkins. To do so, issue the following two commands in the terminal.

    root@ubuntu-14:~# wget -q -O -https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo
    apt-key add –
    OK

    You will get the `OK` status after you add the key. For the source list, here is the command to run.

    root@ubuntu-14:~# sh -c ‘echo deb http://pkg.jenkins-ci.org/debian binary/ >
    /etc/apt/sources.list.d/jenkins.list’

    Now proceed with the following commands:

    root@ubuntu-14:~# apt-get update

    root@ubuntu-14:~# apt-get install Jenkins

    Jenkinscode

    To check jenkin status run : root@ubuntu-14:~# service jenkins status

    If you need to update the configurations of Jenkins as per your requirements, then you can find its configuration file under the `/etc/default/` directory and can make the changes.

    root@ubuntu-14:~# vim /etc/default/Jenkins

  • 2. TeamCity: teamCity

    TeamCity is a Java-based build management and continuous integration server from JetBrains.TeamCity works on many different platforms and has the support for wide variety of tools and frameworks. There are many publicly available plugins, developed both by JetBrains and third parties. Despite being the Java- based solution, TeamCity offers the best .NET support among the tools on this list. There are also different enterprise packages, that scale by the number of agents your company needs.

    Note: Great solution overall, but due to its complexity and price, better suited for enterprise needs.

  • 3. Travis CI:

    Travis CI is one of the oldest hosted solutions. It is free for all open source projects.Builds are configured using .travis.yml file which contains the build tasks that will be executed on running the build. It supports a variety of different languages and a good documentation to back them up.

    Note: A Mature solution that offers both hosted and On-premises variants, loved and used by many teams, very well documented.

  • 4. Go CD:In Go CD ecosystem,server is the one that controls everything. It provides the user interface to the users of the system and provides work for the agent to do.

    The agents are the ones that do any work (run commands, do deployments, etc) that is configured by the users or administrators of the system. The server does not do any user-specified “work” on its own. It will not run any commands or do deployments. That is the reason you need a GoCD Server and at least one Go CD Agent installed before you proceed. What makes Go stand out from the crowd is the concept of pipelines which makes the modeling of the complex build workflows easy. Go CD supports pipelines from scratch and eliminates build process bottlenecks with the parallel execution of the tasks.

    Note: On-premises solution, great for complex scenarios, free of charge with paid support.

  • 5. Bamboo:Bamboo is a continuous integration and delivery tool that ties automated builds, tests, and releases in a single workflow. Bamboo originally offered both cloud and On-premises solutions, but in the May 2016 the cloud version was discontinued.

    Note: Great On-premises CI tool that originally offered Cloud solution too. Bitbucket Pipelines replaced the cloud solution. Pipelines is a modern and fast cloud CI tool integrated into Bitbucket.

  • 6. GitLab: GitLab CI is an integral part of the open-source Rails project GitLab, which was brought to light by the company GitLab inc. It is hosted on GitLab.com, a free hosted service and it provides detailed git repository management with features like access control, issue tracking, code reviews and much more. GitLab CI integrates seamlessly with GitLab and it can easily hook projects using the GitLab API. GitLab runners that process builds are written in Go language and can run on Windows, Linux, OSX, FreeBSD, and Docker.

    Note: A Phenomenal hosted tool with impressive list of features, offers both free
    and enterprise solutions.

  • 7. CircleCI:CircleClAnother cloud alternative that comes from the company with the same name. CircleCI currently only supports GitHub and the list of supported languages includes Java, Ruby/Rails, Python, Node.js, PHP, Haskell, and Scala.

    Note: Flexible cloud CI tool that offers parallelization up to 16x. Excellent if you need something built fast and money is not the biggest issue

How to decide what CI tool is good for you?

Several factors needs to be considered when choosing the CI tool for the project.

  • On-premises solutions offer a great deal of build process flexibility and store the artifacts locally. This may or may not be important to you, but in some cases and for some companies, it might be mandatory.
  • On the other hand, the hosted solutions offer no hassle setup and greater scalability since you don’t need hardware to host them.
  • Another important thing is the Docker support. Docker revolutionized the way we distribute our apps and has become something you should not ignore. Although the vast majority of the tools support Docker, some take it more seriously than others.
  • And the last and often neglected aspect is the user interface. I found some of the tools from the list much easier to use than others. You cannot say with the clear conscious that the UI is not important because one of the main roles of any good CI tool is to make a build process easier. It should not be hard or complicated.

So, this was it with the CI and CI tools and need for the same.

Continuous Development(CD)

Now that we are very well aware of CI and CI tools, there is one more important thing to learn about for building up a successful project i.e. continuous development.

Continuous development describes a process for iterative software development and is an umbrella over several other processes including continuous integration, continuous testing, continuous delivery and continuous deployment.

It is the new paradigm for creating and improving web applications. Ongoing development and use of incremental changes that can be rolled back easily in case of problems.It has proven to be an effective way of advancing the attractiveness and usability of websites.

Google for instance, develops and releases new features almost daily – using an agile and continuous development process to streamline the launch and deployment of each of their products. Fortunately, continuous development doesn’t only benefit software companies like Google. When the techniques of this approach are applied properly, even new software projects can be developed and deployed in the most effective, efficient and optimal way possible.

Here, we will discuss more about continuous development techniques.

development techniques

Need for Continuous Development

In the beginning of consumer software i.e. early 90s, most softwares were keep updated during months of development and distributed to consumers on a once per year basis. New features were developed and tested heavily over several months and after over aperiod of one year a new version were released. User used to discover and report bugs but had to wait for over an year for the release of updated version. Today however, developers are able to push new software versions live on an immediate basis – updating their software with new features dozens and dozens of times in a single year.

With a continuous approach, developers use ongoing development with smaller incremental changes that can be quickly deployed, and easily withdrawn in case problems arise. Continuous development relies on effective automated application testing; ensuring that a high quality standard is maintained before the code is deployed. By automating testing, developers minimize the amount of manual quality assurance that is typically required for a deployment.

Steps To Setting Up A Continuous Development System

Setting up a continuous development environment can be complex, but proper integration can allow companies to cut down tremendously on the time and effort that it takes to build, test and release new code.

  • 1. Implement an Agile/Scrum system.CD requires an accurate and efficient system for planning and tracking tasks and sprints with the development teams. A proficient agile/scrum system will ensure that each team member is clear on what tasks are involved in each sprint, and how those tasks relate to the entire project.
  • 2. Use Git repositories for code base.Git properly manages the project and files and keep the source code organised in proper manner especially when multiple developers are working on it.
  • 3. Write Tests.Once requirements for a new feature has been given, developers should write a test, which will allow the feature to be automatically tested before it is deployed. If the feature does not pass the test, feedback can be used to make necessary changes to the code.
  • 4. Connect Git repository to DeployBot.Deploy Bot’s features make it simple for developers to automatically deploy their code into a live environment once it has passed required tests.
  • 5. Configure DeployBot.With DeployBot, new code can be deployed manually, or setup to deploy on every push to a new branch.

Even a simple continuous development process introduces a vast number of benefits,
but it does need to be well-thought out and perfectly executed. DeployBot streamlines
the code deployment process, which is critical to implementing an efficient continuous
development system. Not only does DeployBot allow users to watch deployment
progress in real time, it also removes the need to manually track changes and allows
developers to quickly rollback a problematic release.

About Author:

Qss author image Salahuddin Ansari is a Full Stack Engineer working with QSS Technosoft. He has worked on React.js, Redux, GraphQL, Apollo client and many other things in javascript ecosystem. He is always ready to learn new things and try to solve the problems with his skills.

About QSS:

QSS has a proven track executing web and mobile applications for its esteemed customers. The company has strong exposure in developing and delivering Enterprise level applications using different CI/CD tools. To Know More...