@Library( 'library-name' ) _
@Library( 'library-name@library-version' ) _
// or load multiple
@Library([ 'library-name', 'library-name' ]) _
library identifier: 'library-name@library-version',
retriever: modernSCM([
$class : 'GitSCMSource',
remote : 'library-git-url',
credentialsId : 'git-credentials'
])
library (
identifier : "mylibs@" + GERRIT_REFSPEC,
retriever : modernSCM (
gerrit( traits: [[
$class: 'RefSpecsSCMSourceTrait',
templates: [
[ value: '+refs/heads/*:refs/remotes/@{remote}/*' ] ,
[ value: '+refs/changes/*:refs/changes/*' ] ,
[ value: '+refs/changes/*:refs/remotes/@{remote}/*' ]
]
]],
credentialsId: 'SSH_CREDENTIAL',
remote: 'ssh://account@gerrit.sample.com:29418/jenkins/libs'
)
)
) _
library (
identifier : 'devops-libs',
retriever : modernSCM ([
$class : 'GitSCMSource',
credentialsId : 'SSH_CREDENTIAL',
remote : 'ssh://account@gerrit.sample.com:29418/jenkins/libs',
traits : [
gitBranchDiscovery(),
[
$class : 'RefSpecsSCMSourceTrait',
templates : [
[ value : '+refs/heads/*:refs/remotes/@{remote}/*' ] ,
[ value : '+refs/changes/*:refs/remotes/@{remote}/*' ] ,
[ value : '+refs/changes/*:refs/changes/*' ]
]
]
]
])
)