The CD pipeline
We have all the required tools and the Docker image is ready. In this section, we will create a pipeline in Jenkins that will describe our CD process.
Writing the Jenkinsfile for CD
We will build on the CI pipeline that we created earlier. Let's first revisit our CI pipeline, and then we will add some new stages to it as part of the CD process.
Revisiting the pipeline code for CI
The following is the complete combined code that was part of the CI:
node('docker') { stage('Poll') { checkout scm } stage('Build & Unit test'){ sh 'mvn clean verify -DskipITs=true'; junit '**/target/surefire-reports/TEST-*.xml' archive 'target/*.jar' } stage('Static Code Analysis'){ sh 'mvn clean verify sonar:sonar -Dsonar.projectName=example-project -Dsonar.projectKey=example-project -Dsonar.projectVersion=$BUILD_NUMBER'; } stage ('Integration Test'){ sh 'mvn clean verify -Dsurefire.skip=true'; junit '**/target/failsafe-reports/TEST-*.xml' archive...