lotk lotk - 1 year ago 317
Git Question

Poll SCM option gets overriden with every run build (with pipeline)

I recently changed my build to use Jenkins Pipeline plugin. And it's really cool. I configured it to store Jenkins file in Git repository. I checked "Poll SCM" option and configured it to poll SCM every 15 minutes.

The problem is that the job is never run... And if I run it manually (click on the button) the Poll SCM option gets unchecked and the schedule field is emptied. I checked that with every run the config.xml file is overriden.


In "Build Triggers" section I have "Poll SCM" selected with

H/15 * * * *
in schedule field

In Pipeline section I chose "Pipeline script from SCM"

In Jenkinsfile I tried:

git url: 'ssh://git@.../repo.git'


git poll: true, url: 'ssh://git@.../repo.git'

but neither of options worked.

Answer Source

I finally resolved the issue. The properties were overriden because I had another properties definition in the script: It looks like Jenkins will override whole set of properties nevermind if all of them are defined in the script or not.

/* Only keep the 10 most recent builds. */
properties([[$class  : 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '10']]])

Thank you all for the help.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download