DevOps Tools Introduction #05: Continuous Delivery
Turning source code into running services requires a series of steps. Continuous Integration (CI) and Continuous Delivery (CD) are key concepts behind automating, as much as possible, build and deployment processes. LPI covers CI/CD in objective 701.4. Martin Fowler offers an introduction to Continuous Delivery as well as some more background on Continuous Integration and Deployment Pipelines.
The deployment of artifacts that are built and tested in a CI/CD pipeline is a key process for supporting a DevOps environment. Besides the design of the CI/CD pipeline, several release and deployment models exist that try to further limit the risk of deployments and provide ways to roll back to previous versions. Some of these models which are extremely powerful when used with microservers and containers are Canary releases and Blue-green deployments. Christian Posta’s blog offers another great comparision of these models.
The LPI DevOps Tools Engineer objectives expect you to be able to implement CI/CD with Jenkins. To quickly get a Jenkins playground, you can install Jenkins locally as described in the Getting Started Guide that we’ll open in a minute. Alternatively, you can give the jenkins Docker image a try. Given that you have Docker running, use the following command to start the container and forward port 8080 from your host system:
docker run -p 8080:8080 jenkins
During the startup of the container you’ll see a lot of logging information. Amongst this information is the initial password. Copy this password and navigate to http://localhost:8080/. You’ll find Jenkins asking you for that password. Choose ‘Install suggested plugins’ and wait a few minutes while Jenkins is set up. You can follow Jenkins’ progress in the terminal where you started your container.
In the meantime, open the Guided Tour offered by the Jenkins project. This tutorial walks you through the setup of a build pipeline in Jenkins. Note that this tutorial sets up a Multibranch Pipeline which requires you to keep your Jenkinsfile in an SCM repository. If you want to make your first steps without involving SCM, create a Pipeline project instead and specify the content of your Jenkinsfile during the setup of the project. To simplify your setup even more, get started by using echo jobs in your Pipeline instead of real jobs which require additional files and configuration. Then, you can extend your pipeline with real functionality as you proceed.
In addition to following the Guided Tour, read some general instructions about how to use a Jenkinsfile, learn about the Pipeline Syntax and the language elements that the Pipeline plugin provides. Both documents might answer a lot of questions that may arise during the Guided Tour.
Finally, make sure you understand how Jenkins integrates with an SCM such as Git. Most of this functionality is provided by Jenkins Plugins. Jenkins hosts a plugin catalogue. Here you can find additional information on Jenkins plugins, such as those mentioned in the exam objectives (Git, Docker Pipeline, Docker Build and Publish, Copy Artifact, Fingerprint and Credentials). Next week, when you'll become familiar with Docker, come back to Jenkins and explore how to use Docker container within your CI pipeline.