Search code examples
svnjenkinsgroovyworkflowpolling

SCM polling with Jenkins Workflow and variables


I found a solution to poll SVN repository here (How do I configure a Jenkins Pipeline to be triggered by polling SubVersion?).

The thing is, polling the repository works fine if I set the svn path to a valid svn address like, for example https://srvsvn2/svn/xyz. Manual build works fine if I use a Job variable (like IMPL_PATH_SVN_PROJECT with the value https://srvsvn2/svn/xyz) and use it in the pipeline script, but the polling mechanism does not work anymore.

Using this variable is indispensable, because i want to use this pipeline script in many Jenkins Project Build jobs.

#!groovy

stage "checkout trunk"
node {
checkout poll: true, scm: [$class: 'SubversionSCM', additionalCredentials: [[credentialsId: '94a82ac2-8282-486d-b0c1-6cfa1c05c499', realm: '<https://srvsvn2:443>']], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '94a82ac2-8282-486d-b0c1-6cfa1c05c499', depthOption: 'infinity', ignoreExternalsOption: false, local: '.', remote: '${IMPL_PATH_SVN_PROJECT}@HEAD']], workspaceUpdater: [$class: 'CheckoutUpdater']]

...

// Build
node {
    stage "Build Project ${JOB_NAME}"
        bat 'python BuildScripts\\Build.py "%WORKSPACE%"'
    }

Does anyone know a good solution for this problem?

Starting Jobs with the help of a post-commit script, which runs on the SVN Server is not a solution in this case (there are many _externals which should start a complete project build.)

Many thanks in advance!


Solution

  • Ran into the same Problem with git. The solution was to replace the quoting characters when using the variable.

    try

    remote: "${IMPL_PATH_SVN_PROJECT}@HEAD"
    

    instead of

    remote: '${IMPL_PATH_SVN_PROJECT}@HEAD'