Understanding and Practicing Continuous Integration

  

The Troy Coding Club (TCC) met at the E7 offices in December (2017) to review and discuss DevOps and the continuous integration (CI) and deployment of software applications. Attendees were introduced to the practice of CI, which requires developers to integrate code in a shared repository on a regular and frequent basis. Each code integration is verified by an automated build, using a tool like Atlassian's Bamboo, to alert team members to any issues so they can resolve them quickly and move forward with quality code. Commonly used by teams practicing Agile, CI results in a well-informed development team, and also saves time and money by creating a transparent operation with well-defined practices and principles that results in faster and higher-quality deployments.

E7 solutions architect Mike Abdelnour began the meeting by providing a thorough overview of DevOps and how development and operations teams communicate and work together to ensure quality software deployments. Following this introduction, E7 senior developer Bhavin Patel led attendees through a real-world exercise in configuring and using Bamboo to build and deploy Java-based software, hosted in GitHub, with Maven as a build tool.

Patel made sure that TCC members understood the importance of managing and testing artifacts (design documents, data models, workflow diagrams, test plans) in the software development lifecycle. With CI, it's very easy to see the changes between releases and to track the environments to which the software has been deployed. Apache Maven is based on the concept of a project object model (POM), and serves to manage a project's build, reporting, and documentation from a central source. Bamboo adds other metadata, such as related commits and JIRA issues, to each release, which enables reporting and tracking as the project moves through your environments.

As the attendees went through this exercise, they raised some great questions. Here are a few—along with the answers—that we thought you might find of particular interest:

What's the difference between Jenkins, Maven, and Bamboo?

We used Maven and Bamboo for our exercise. Because of their familiarity with the Jenkins product, some participants wondered if and when to use Jenkins. We could write a paper that compares these tools—their advantages and disadvantages—but we'll keep it simple for this explanation.

Jenkins is a continuous-integration tool that runs periodic builds and tests software. Maven is a tool that actually does the build. Bamboo is a continuous integration and delivery tool that ties automated builds, tests, and releases together in a single workflow. Bamboo is our tool of choice for enterprise builds. Jenkins generally requires a number of plug-ins to get the functionality that’s needed, while Bamboo has a lot of these features right out of the box. We also like that Bamboo integrates easily with JIRA and Bitbucket. And because Bamboo is continuous integration and deployment in one package, you can manage deployment environments and permissions alongside CI artifacts.

Is it possible to provide shared workspaces in the CI process? 

By its very nature, the continuous integration process demands that developers check code into their private workspace and, when done, commit the changes to the shared repository. You can define an artifact to use between the different deployment stages. For example, you can have the development stage generate the artifact, and then have the production stage pull it down, and then have developers work on it from there.

How are artifacts shared in Bamboo?

Like any good continuous integration tool, Bamboo has very good support for sharing artifacts between jobs and build plans. To share an artifact from one job to another, first mark it as shareable and then add it as an artifact dependency on another job.

Can Bamboo deploy a single shared artifact to multiple environments, or do I have to rebuild the artifact each time?

Bamboo does have the ability to deploy to multiple environments, or even re-deploy to the same environment. This may be useful if you want to deploy an older artifact for testing.

For more about shared artifacts, we recommend looking at Bamboo Best Practices – Sharing Artifacts.