7 Defining a pipeline as code for microservices

 

This chapter covers

  • Using a Jenkins multibranch pipeline plugin and GitFlow model
  • Defining multibranch pipelines for containerized microservices
  • Triggering a Jenkins job on push events using GitHub webhooks
  • Exporting Jenkins jobs configuration as XML and cloning Jenkins jobs

The previous chapters covered how to deploy a Jenkins cluster on multiple cloud providers by using automation tools: HashiCorp Packer and Terraform. In this chapter, we will define a continuous integration (CI) pipeline for Dockerized microservices.

In chapter 1, you learned that CI is continuously testing and building all changes of the source code before integrating them into the central repository. Figure 7.1 summarizes the stages in this workflow.

Figure 7.1 Continuous integration stages

Every change to the source code triggers the CI pipeline, which launches the automated tests. This comes with many benefits:

  • Detecting bugs and issues earlier, which results in a dramatic decrease in maintenance time and costs
  • Ensuring that the codebase continues to work and meets the spec requirements as the system grows
  • Improving team velocity by establishing a fast-feedback loop

While automated tests come with multiple benefits, they’re extremely time-consuming to implement and execute. Therefore, we will use a testing framework based on the target service runtime and requirements.

7.1 Introducing microservices-based applications

7.2 Defining multibranch pipeline jobs

7.3 Git and GitHub integration

7.4 Discovering Jenkins jobs’ XML configuration

7.5 Configuring SSH authentication with Jenkins

7.6 Triggering Jenkins builds with GitHub webhooks

Summary

sitemap