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.