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.

  • Mupx deployment fails. Why?
  • Tensorflow: unable to navigate to tensorflow folder using docker [Windows 10 Home edition]
  • Virtualize my VPS
  • docker disk space grows faster than container's
  • Unable to run gcloud docker push from google compute engine instance
  • npm install error with kurento - docker
  • 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?

  • Get Docker Container Names
  • Same location with different proxy urls nginx
  • Mocking 3rd party API calls without changing code
  • Boot2Docker - Access webserver as localhost
  • What is causing these directories to be hidden?
  • docker swarm 1.12 auto stop service
  • 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.

    properties([pipelineTriggers([pollSCM('')])])
    

    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.