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