_Online documentation for Pipeline Library_
A guide on how to access Pipeline libraries versioned in Perforce Helix.
Open the Jenkins Configuration (Manage Jenkins
> Configure System
) and scroll down to Global Pipeline Libraries
:
Depot path: //depot/myLibrary/src/org/foo/lib.groovy
Library content:
package org.foo;
def testFunc ()
{
echo "HELLO FROM testFunc"
}
return this;
An example Pipeline Script:
@Library('my-shared-library')
import org.foo.lib.*
pipeline {
agent { label 'master' }
stages {
stage("Run script") {
steps {
script {
def z = new org.foo.lib()
z.testFunc()
}
}
}
}
}
_Online documentation for [Pipeline Library](https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/library.html#Global_Pipeline_Library_guide)_ # Global Pipeline Library Guide A guide on how to access Pipeline libraries versioned in Perforce Helix. ## Global Setup Open the Jenkins Configuration (`Manage Jenkins`> `Configure System`) and scroll down to `Global Pipeline Libraries`: ![Global Libraries](images/global_lib.png) ## Sample library structure Depot path: `//depot/myLibrary/src/org/foo/lib.groovy` Library content: package org.foo; def testFunc () { echo "HELLO FROM testFunc" } return this; ## Importing a library in a Pipeline script An example Pipeline Script: @Library('my-shared-library') import org.foo.lib.* pipeline { agent { label 'master' } stages { stage("Run script") { steps { script { def z = new org.foo.lib() z.testFunc() } } } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 25631 | Paul Allen | Docs update | ||
#1 | 24139 | Paul Allen |
Merge pull request #72 from p4kevin/master Updates to Freestyle documentation. |
||
//guest/perforce_software/p4jenkins/main/LIBRARY.md | |||||
#1 | 23016 | Paul Allen | Draft docs for Global Library and file for MultiBranch. |