Practical Site Reliability Engineering
上QQ阅读APP看书,第一时间看更新

Virtual platform-based deployment using Jenkins or TeamCity

If we have a cloud-based Instance such as AWS EC2 or a virtual machine such as VMware VM or Window's Hyper-V server, we can use Jenkins as a deployment tool instead of others such as GoCD or TeamCity. We can use Jenkins in many different ways, for both normal jobs and for complex pipeline-based deployment jobs.

Jenkins jobs can either be configured manually or we can use a Jenkins's descriptive scripting language (DSL) language that is one of the modified groovy forms, and normally you will find it in form of Jenkinsfile in your project. The following steps give a brief overview of how to create a new Jenkins job for deployment: 

  1. Configure Jenkins jobs using Jenkin's DSL or using pure groovy language, and call the following script from your Jenkinsfile.
  2. Write your deployment steps using a traditional scripting language such as Bash or Python.
  3. The previous two steps will do your most of the work for deployment, and your script steps will define what exactly you would like to achieve in your Jenkins job.
  4. Finally, run your Jenkins deployment jobs.

We aren't showing these steps with screenshots, as there are many examples that can easily be searched for on the internet. We have a Jenkins-based deployment example in Chapter 4, DevOps as a Service, so that you can refer to how to configure and deploy using Jenkins.