1

I want to dynamically load a library for my Jenkins pipeline. The docs say to do this:

library identifier: 'custom-lib@master', retriever: modernSCM(
  [$class: 'GitSCMSource',
   remote: 'git@git.mycorp.com:my-jenkins-utils.git',
   credentialsId: 'my-private-key'])

But I use Perforce instead of Git, and I don't know how to translate that code accordingly. Jenkins' Pipeline Syntax tool spits out a snippet that doesn't look at all similar (and no, putting this in doesn't work).

p4 credential: 'p4creds', workspace: streamSpec(charset: 'none', format: '', pinHost: false, streamName: '//stream')

I think what needs to happen is that I need to convert that p4() incantation to something that looks more like modernSCM([ $class: 'PerforceSCM' ]). However, I can't find any documentation on modernSCM() so I don't know how to achieve this. Do I have to use legacySCM() instead? So many questions!

For now, the Library is 'hard coded' into the Jenkins global config, but this is sub-optimal for a few reasons.

Jay Spang
  • 2,013
  • 7
  • 27
  • 32
  • 1
    That was it! I don't think my question is a duplicate, but that linked question had an example of the code I was able to cut&paste to fix my issue. – Jay Spang Aug 05 '19 at 21:01

0 Answers0