0
0
Jenkinsdevops~30 mins

What is Continuous Integration in Jenkins - Hands-On Activity

Choose your learning style9 modes available
What is Continuous Integration
📖 Scenario: You are working as a developer in a team. Your team wants to make sure that every change made to the code is tested automatically to avoid bugs. This helps the team deliver better software faster.
🎯 Goal: Learn the basic concept of Continuous Integration (CI) by setting up a simple Jenkins pipeline that runs a test command automatically whenever code changes are made.
📋 What You'll Learn
Create a Jenkins pipeline script with a basic structure
Add a stage to run a simple shell command simulating tests
Configure the pipeline to trigger on code changes
Print a message showing the test result
💡 Why This Matters
🌍 Real World
Continuous Integration helps teams catch bugs early by automatically testing code changes. Jenkins is a popular tool to automate this process.
💼 Career
Understanding CI pipelines is essential for DevOps roles and software developers to ensure code quality and faster delivery.
Progress0 / 4 steps
1
Create a basic Jenkins pipeline
Create a Jenkins pipeline script with a pipeline block and an empty stages section.
Jenkins
Need a hint?

Start by writing the pipeline block with agent any and an empty stages block.

2
Add a test stage to the pipeline
Inside the stages block, add a stage named Test that runs a shell command echo Running tests.
Jenkins
Need a hint?

Use stage('Test') with steps and inside it run sh 'echo Running tests'.

3
Configure the pipeline to trigger on code changes
Add a triggers block inside the pipeline that uses pollSCM('* * * * *') to check for code changes every minute.
Jenkins
Need a hint?

Inside pipeline, add triggers { pollSCM('* * * * *') } to poll for changes every minute.

4
Print a message showing the test result
Add a post block inside the pipeline that prints echo 'Tests completed successfully' when the pipeline succeeds.
Jenkins
Need a hint?

Use post { success { echo 'Tests completed successfully' } } inside the pipeline to print after success.