Jenkins Pipeline - SVN polling

别说谁变了你拦得住时间么 提交于 2019-12-06 10:51:06

Use a freestyle job to poll (with depth empty) your real application via svn. In this freestyle job add a trigger to start your pipeline job as build step. Do the real work in your pipeline job.

I have the same problem. My SVN url is parameterized and the polling function does not evaluate the variables => build is triggered for sure :-(

But thats not what I want!

My real project is checked out in the Jenkinsfile, so a workaround whould be to exclude the Jenkinsfile repo from polling but theres no option in the ui ...


Edit 1

I have updated my plugins and it seems to be working now. What version of subversion-plugin do you have?

I am using 2.7.1


Edit 2

No it does not.

I have cloned the subversion-plugin-master and changed the functionallity from "BUILD_NOW" to "NO_CHANGES" if the url is not reachable.

With that modified version the build is not triggered from the parameterized pipeline repository. The other repositories inside the Jenkinsfile are monitored correctly.

The issue in my case was I have configured the crone syntax for every 5 hours instead of 5 mins (Its a stupid thing).

If You are using a Pipeline job, where the Pipeline DSL is located in a SCM remote.

Normally you can configure the polling in the job using the crone syntax and can call the checkout method from your jenkins file.It will do the polling of your real application. (Its the magic behind jenkins)

In this configuration, you don't have the polling inside the script (called Jenkinsfile here), but in the job configuration. So it works as in any other jobs: it checks the SCM remote as configured with the cron expression, when it detected a modification, it checkout the Pipeline script from the configured remote.

You can follow the documentation below

https://support.cloudbees.com/hc/en-us/articles/205028534-How-do-I-configure-SCM-Polling-in-a-Pipeline-Template-

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!