The below Jenkinsfile executes the script in helmCloudPipeline.groovy file which presents in vars folder.
Using Blue Ocean, the new UI for jenkins, you can easily create a new project and connect it to the Github repository, following these steps:
Click on Blueocean
Create a new pipeline and select GitHub as your code store.
Enter a Personal Access Token from GitHub (which can be generated for the first time using GitHub New Personal Access Token page), so that Jenkins can access your private repositories.
Choose your Github repository that contains the code.
Give your pipeline a name and save the changes.
Jenkins automatically will detect the branches and the Jenkinsfile if present. It will also trigger the job.
After it finishes, you should see a view similar to this, in which you can see the details of each stage (time it took, success or failure, logs) along with the Console Output of the build.
12.8. Summary
Now successfully created a CI/CD multi-branch pipeline for a containerized spring-boot java application on Kubernetes using Jenkins.
Docker is a great tool to create isolated micro services and environments. However, over time the number of images and containers size of log files used by the images and containers increases which can take up considerable disk space. Besides, dangling images and old images/containers which we do not use anymore are not automatically removed. Fortunately, docker has some options which can help us reclaim disk space.
For example, Check the system disk space using command df -h and check the output
Now we can see that we have about 5.373GB still held up in images and the larger amount of 52GB in local volumes. To clean up all these use docker image prune -a --force command in Jenkinsfile to run as a pipeline job in Jenkins.