问题
I have a Jenkins pipeline template which uses a Jenkins file in Subversion.
The Jenkins file has the svn checkout method to check out the real application. (The svn url of real application is passed from jenkins env variables)
I need to do the svn polling of the real application and trigger the job when there is a change in real application.
When I use the polling option in jenkins template , it always do the polling of JenkinsFile in Subversion.
Is there any way that I can poll the real application?
回答1:
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.
回答2:
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.
回答3:
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-
来源:https://stackoverflow.com/questions/42513365/jenkins-pipeline-svn-polling