Just got it, after some trial-and-error attempts. Basically I'm splitting 
the definition of the SCM object from the "checkout" command, and later 
re-use the SCM for both checkout and JiraIssueUpdater. Here's my small 
HOWTO:


   1. Use Jenkins' Snippet Generator: (Choose a Pipeline Job) -> Pipeline 
   Syntax -> Snippet Generator -> Sample Step -> checkout: General SCM
      - Fill in the required fields for your SVN configuration
      - Click "Generate Pipeline Script".
      - You should get something like: 
      - checkout(*[$class: 'SubversionSCM', additionalCredentials: [], 
      excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', 
      excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, 
      includedRegions: '', locations: [[credentialsId: 'My-Credentials-Id', 
      depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 
      'https://mysvn.mydomain']], workspaceUpdater: [$class: 'UpdateUpdater']]*
      )
   2. Convert the single line generated above into the following Groovy 
   code (the common part copied from the generated snippet is marked in 
   *green*):


       def svnScm = *[$class: 'SubversionSCM', additionalCredentials: [], 
excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', 
excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, 
includedRegions: '', locations: [[credentialsId: 'My-Credentials-Id', 
depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 
'https://mysvn.mydomain']], workspaceUpdater: [$class: 'UpdateUpdater']]*
       checkout(scm: svnScm)
       echo "Updating related JIRA items..."
       step([$class: 'hudson.plugins.jira.JiraIssueUpdater', issueSelector: 
[$class: 'hudson.plugins.jira.selector.DefaultIssueSelector'], scm: svnScm])
       svnScm = null

Hopefully, this saves someone else some time :-)

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1810cf53-ada1-4a29-86f5-1c3519e67cad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to