title: Calling functions in jenkinsfile with variables
body: <p>I need some help in calling a function in <code>Jenkinsfile</code> along with a variable.<br>
  I have created a bash function to copy certain test results from jenkins slave to Jenkins master's <code>userContent</code> directory.<br>
  I want to use this function across diff jobs. Different jobs might have different report path, instead of hardcoding the path inside the function i want to use a variable in jenkinsfile to pass along with the function.<br>
  Here is my function:</p>
  
  <pre><code>def call() {
    sh '''
      mkdir -p $JOB_NAME
      foldername="$BUILD_NUMBER.$(date '+%d-%m-%Y')"
      echo ${foldername}
      mkdir -p $JOB_NAME/${foldername}
      pwd
      reportPath=""
      dest="./$JOB_NAME/${foldername}"
      cp -R ${reportPath}/*.xml ${dest}
      scp -r $JOB_NAME jenkins@master_ip:/var/lib/jenkins/userContent/
      '''   
  }
  </code></pre>
  
  <p>How do i call the function in jenkinsfile and have a variable with report path?</p>