I would like to call the next shared library from a pipeline:
[a link] https://github.com/docker/jenkins-pipeline-scripts/blob/master/vars/wrappedNode.groovy
I don't know how to call and populate the vars map and the body closure from the Jenkins 2 pipeline.
My shared library name is "vars/my_shared_library.groovy", and their content is
def call(Map vars, Closure body=null) {
vars = vars ?: [:]
def myParameter = vars.get("myParam1",null)
if (body) { body() }
stuff...
}
The Jenkinsfile content is:
@Library 'my_shared_library'
pipeline {
agent none
stages {
stage ('info') {
node {
my_shared_library {
myParam1 = "myValue1"
}
}
}
}
}