8 Continuous deployment

 

This chapter covers

  • Using GitHub Actions to create automated workflows
  • Creating a CI pipeline to run automated tests for a microservice
  • Creating an automated deployment pipeline to deploy a microservice to Kubernetes

In this chapter, we’ll reap the benefits of the work we’ve done in the previous two chapters. In chapters 6 and 7, you learned how to create infrastructure using code and how to manually deploy our microservices to that infrastructure.

In this chapter, you’ll learn how to put your deployments on automatic. Importantly, you’ll learn how to build an automated, continuous deployment pipeline for a microservice using GitHub Actions. This kind of automation will prove to be a vital part of your success with microservices. To keep things simple, we’ll focus on deploying a single microservice, but that will give us a recipe that we can apply to all of our microservices moving forward.

We’re in very advanced waters now and you might find this quite difficult. It’s not that it’s that difficult to build an automated workflow; I’m sure you’ll find the basics quite easy in the first and second examples of this chapter. But the third example relies on everything that you learned in chapters 3 and 6. If you aren’t yet confident using Docker and kubectl, that will make completing this chapter more difficult.

8.1 New tool

8.2 Getting the code

8.3 Running the examples in this chapter

8.4 What is continuous integration?

8.5 What is continuous deployment?

8.6 Why automate deployment?

8.7 An introduction to automation with GitHub Actions

8.7.1 Why GitHub Actions?

8.7.2 What is a workflow?

8.7.3 Creating a new workflow

8.7.4 Example 1 overview

8.7.5 The “Hello World” shell script

8.7.6 The “Hello World” workflow