Jenkins git build trigger issue for pipeline as a code

I am using Jenkins declarative pipeline as a code (Pipeline script for SCM setup) for running CI/CD pipeline. In my pipeline code I have a Git Checkout configuration for my project to be build and deploy.

My pipeline is configured with pollSCM property, pipeline polls my project's git repository every 1 minute, if any, change is found in the project CI/CD pipeline is triggered.

The issue I am facing currently is pollSCM is working fine, but If I make any change in my pipeline CI/CD gets triggered for the project.

I am using Jenkins shared libs design for building my project, let's say my pipeline name is SpringBootV2Jenkins.txt. The issue I am facing is

Any commit in SpringBootV2Jenkins.txt is triggering the CI/CD pipeline. Any commit in shared libs groovy files is triggering the CI/CD pipeline. My requirement is CI/CD pipeline should trigger only when there is a change in the project git repository, not in the CI/CD pipeline as code repository.

The same thing used to work before we used shared lib config. Any help would be appreciated as this is causing issue with CICD.

1 comment

  • 0
    Denys Digtiar

    Shared library configuration includes an option "Include @Library changes in job recent changes". If it is checked the library changes are included on all the builds that use it and it takes part in the polling. Uncheck, to disable SCM polling on the library.

Please sign in to leave a comment.