How to enable SCM polling with the Jenkins Pipeline plugin

This is a question related to How to make SCM polling work with the Jenkins Workflow plugin. That thread answers how to use SCM polling in a pipeline script once SCM polling is enabled but does not cover how to enable SCM polling.

For example, if you wanted to use the mulit-branch pipeline plugin to create jobs automatically using a Jenkinsfile there is not a way I know of to have the “Poll SCM” option enabled in the job. This makes it difficult to provision on-demand environments such as creating a docker container that has the jobs setup from the beginning. Because you would have to sign-in to Jenkins and go to the configuration and select the “Poll SCM” option once the container was started. Cloudbees offers a template plugin to help solve this problem.

  • Docker Cannot link to a non running container
  • Connect to another container using Docker compose
  • Docker RUN Command
  • Not able to login in docker private repositry
  • How to stop creating extra instances when using google managed vms?
  • How to increment docker tag automatically?
  • However this is not available to Jenkins using the free version. Is there any workaround or solution for users on the free version of Jenkins?

  • Host names are not set in docker compose
  • cannot mount windows directory
  • docker hub api giving No 'Access-Control-Allow-Origin' error
  • Can I run a bash script from a file in a separate docker volume before a container starts?
  • anyway to setup npm credentials over `npm login` without reading input from STDIN?
  • How to update a Docker container from a newer image?
  • 3 Solutions collect form web for “How to enable SCM polling with the Jenkins Pipeline plugin”

    if you wanted to use the multi-branch pipeline plugin to create jobs automatically using a Jenkinsfile there is not a way I know of to have the “Poll SCM” option enabled in the job

    Nor is any needed. Multibranch projects have a configurable polling interval for the branch indexing as a whole, which also serves as a per-branch build trigger, and will also receive webhooks automatically.

    I am thinking about the same problem.

    If you are using a online Git service like Github or Bitbucket, I think you could use their Webhooks features to solve it. I have not been able to test the solution yet, but it should work.

    In your Multibranch Pipeline configuration, enable the Trigger builds remotely option.

    Then you need to enable your Github/Bitbucket Webhook on your repository, using the path (as described in the Jenkins configuration descrition): JENKINS_URL/job/test/build?token=TOKEN_NAME

    To answer the question how to enable SCM polling, you need to do the following.

    Using the Pipeline Syntax generator and “properties: Set job properties” you can generate the following which will enable SCM polling.


    However as Jesse Glick points out for Multibranch pipelines you don’t need to enable SCM polling.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.