Hey all !!!
This article describes Jenkins which is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed. Interesting part is : Jenkins X is a project which rethinks how developers should interact with CI/CD in the cloud with a focus on making development teams productive through automation, tooling and DevOps best practices. we will talk on Jenkins X features in some other future blogs.
In this blog, The CI CD pipeline creation and automated testing for Software Engineer who are at beginner level. CI means Continuous Integration and CD means Continuous Delivery and Continuous Deployment. This is how SDLC works for dev-ops. CI/CD is now a days a key component of a DevOps strategy, allows developer to shorten the development lifecycle while maintaining quality by automating tasks like testing. In short, a successful implementation will help you to test more often and deploy faster with high quality. Look at life cycle in images below:
Lets understand the concept by one demonstration step by step.
Step: 1 Refer https://www.jenkins.io/doc/book/installing/docker/ guideline Start docker and container having Jenkins Image.
Step:2 Go to localhost:8080 to view Jenkins dashboard & Create a new Job for automated testing.
Step: 3 Giving an appropriate name to our job and project style as freestyle:
Step: 4 Visit Job configuration & go to General tab (leave as it is or add some description about your project or demo)
Step: 5 Go to next tab – Source Code Management: (feed it correct details of your GitHub Repository for the project) For demo ,We have used calc.py file source code in my GitHub repo.
Step: 6 Now configure the build triggers where we setup polling of SCM to every minute. Meaning every minute, it will check the SCM for new commits and it find a new commit it will trigger the build.
Step: 7 Leave the build environment as it is for now, inside Build add the commands to test your application, leave post build actions as it is for now.
Step: 8 Inside Build tab select “Execute Shell”
Add following commands to test our python calculator API. Here 1 will perform addition, 2 will perform subtraction, 3 will multiplication, 4 will perform division.
python calc.py 10 20 1
python calc.py 10 20 2
python calc.py 10 20 3
python calc.py 10 20 4
Step:9 Click on Apply and See your Jenkins Dashboard as below.
Step: 10 Clicking on build now will trigger the build. You can see proper output from console:
Reference: https://www.jenkins.io/doc/
Prepared by:
- Prof. Rahul Shrimali, Assistant Professor, ICT, GUNI
- Abhay Ruparel – 19162101029, 5th Semester , B Tech CSE( Cloud Based Applications)