Jenkins - Continuous Deployment
Jenkins is used in providing good support for continuous deployment and delivery. The flow of a software development till the deployment is shown below:
The main part of continuous deployment to make sure that the above entire process is automated. Jenkins provides various plugins for all these things. One of them is "Deploy to container" plugin, which was seen in earlier sections.
Jenkins provides various plugins which are used to give a graphical representation of the continuous deployment process.
To understand that, let's first create another project in Jenkins so that we can see how it works and which emulates the QA stage:
Step 1: Go to the Jenkins Dashboard and select New Item.
Step 2: Give the Item name and choose Freestyle project option. Here I have given the item name "demo". Click on OK button.
Step 3: In this example, we are keeping it simple and just using to print HelloWorld.
Select the Git option and enter the GitHub repository of your HelloWorld program in the Repository URL section.
Step 4: Select the Execute Windows batch command option from the add build step button and give the command to run your java program.
Step 5: Click on Apply then Save button.
So our project demo is now created. You can check a build to see if the build is successfully created or not. To check a build, click on the Build Now option.
Step 6: Now, go to your previously created Helloworld project and click on the Configure option.
Step 7: In the Project configuration, select the Add post-build action and choose Build other projects option.
Step 8: In the Projects to build option, enter the "demo" as the project name to build. You can leave the other option as the default. Click on Apply then the Save button.
Step 9: Now, build the HelloWorld project. To do that, click on the Build Now option.
Step 10: Click on the latest build and select the Console Output option.
Now, if you see the Console output, you will also see that after the HelloWorld project is successfully built, the build of the demo project will also happen.
Delivery Pipeline Plugin
Step 11: Let's now install the Delivery pipeline plugin. Select Manage Jenkins option.
Step 12: Select the Manage Plugins option.
Step 13: In the Available tab, search for "Delivery Pipeline" plugin in the filter option. Select Delivery Pipeline plugin and click on Install without Restart.
After successful installation of plugins, click on Go back to the top page link.
Step 14: To see the Delivery Pipeline in action, click on + symbol in the tab next to the All tab on the Jenkins Dashboard screen.
Step 15: Give the View name and select Delivery Pipeline View. Click on OK button.
Step 16: In the next page, leave the default options. Scroll down and change the following settings:
Now you will see a view of the entire delivery pipeline and you will be able to see the status of each project in the entire pipeline.
Build Pipeline Plugin
Another important plugin of Jenkins is the "Build pipeline" plugin. Let's take a look at this plugin:
Step 1: On the Jenkins Dashboard, select Manage Jenkins.
Step 2: Select the Manage Plugins option.
Step 3: In the Available tab, filter for Build pipeline and select Build pipeline plugin, then click on Install without Restart button.
Step 4: Once the installation is completed successfully, click on Go back to the top page link.
Step 5: To see the Build pipeline in action, click on the + symbol in the Tab next to the All tab in the Jenkins Dashboard.
Step 6: In the View name option, enter any name and choose the Build Pipeline View Option.
Step 7: Leave all the default option and scroll down. In the Upstream/downstream config section enter the name of the HelloWorld project for the select initial job option. Then click on the OK button.
Now you can see a view of the entire delivery pipeline, and you will be able to see the status of each project in the whole pipeline.