Build Trigger using Poll SCM in Jenkins
Welcome to my blog!!
If you are here reading this blog it means you already have setup Jenkins, if not please go through detail blog for Jenkins setup : https://www.numpyninja.com/post/step-by-step-implementation-cucumber-bdd-framework-using-java-selenium-jenkins-git-allure-part-3 and come back to set configuration for GIT polling.
In this blog we will setup configuration for GIT Polling!!
What is SCM in Jenkins?
SCM = Source Control Management.
What is polling the SCM?
"Poll SCM" polls the SCM periodically for checking if any changes/ new commits were made and shall build the project if any new commits were pushed since the last build.
To implement CI (Continues integration) all the configuration in Jenkins makes it more convenient , This is one of the configuration Let's look more in to it,
Configure Poll SCM in Jenkins:
After you have created your project in Jenkins.
Step 1: Go to Dashboard --> Click Project -->Configure
Step 2: Go to Build Triggers
Step 3: Select option "Poll SCM"
Step 4: Set schedule (click "?" to get more information about format )
Here we have set < H/2 * * * * > it will poll every 2 minutes
Note : There is some existing issue in format for schedule, please checkout if u face any https://issues.jenkins.io/browse/JENKINS-22129
Step 5: Configuration is done for Git Polling, Now you have to test the setting
Now "Git Polling Log" will appear under Project where you can check the polling logs, if there are no new changes while poll happened the logs will look like ,
Now , Do any changes to your project for which your GIT repo is linked with Jenkins and do Git commit and Git push to the same repository.
Once poll start and detect changes it will start the Build run on Jenkins for the latest code from the GIT repository. Check logs, it will look like,
And Console output for the Build Run which trigger after Poll SCM:
Still there are many options for build trigger from Jenkins if you have public IP address or DNS for allowing GitHub to trigger your Jenkins build.
As we have Jenkins running on localhost we used Poll SCM setting to trigger build!!
Hope this helps, Please provide your valuable comments to improve the blog.
Happy Learning !!