[!TIP] references:

usage

load implicitly

@Library( 'library-name' ) _
@Library( 'library-name@library-version' ) _

// or load multiple
@Library([ 'library-name', 'library-name' ]) _

load dynamically

library identifier: 'library-name@library-version',
        retriever: modernSCM([
                 $class : 'GitSCMSource',
                 remote : 'library-git-url',
          credentialsId : 'git-credentials'
        ])

gerrit refspecs

  • refs/changes

    • mandatory:
      • +refs/heads/*:refs/remotes/@{remote}/*
      • +refs/changes/*:refs/changes/*
    • optional:
      • +refs/changes/*:refs/remotes/@{remote}/*
  • pull-request

    • +refs/pull-requests/*/from:refs/remotes/@{remote}/pr/*
    • +refs/pull/*:refs/remotes/@{remote}/pr/*
    • +refs/heads/*:refs/remotes/@{remote}/*
gerrit libs
1.5.8.9.1 -- gerrit libs

gerrit

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'
    )
  )
) _

git

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/*'           ]
        ]
      ]
    ]
  ])
)
Copyright © marslo 2020-2024 all right reserved,powered by GitbookLast Modified: 2024-10-30 04:30:28

results matching ""

    No results matching ""