I've been trying to separate my code into two different files: callTheFunction.groovy and theFunction.groovy.
As you can see from the name of the file:
callTheFunction.groovycalls the function defined intheFunction.groovy, passing random values in as parameters.theFunctionis a shell script - inside groovy function - which is supposed to use the parameters passed fromcallTheFunction.
PROBLEM:
The shell script does not recognize/understand the arguments, the variables are empty, no value.
theFunction.groovy
def call(var1, var2) {
  sh '''
    echo "MY values $var1 and $var2"
  '''
}
callTheFunction.groovy
def call {
  pipeline {
    stages {
      stage ('myscript') {
        steps {
          theFunction("Value1", "Value2")
        }
      }
    }
  }
}
OUTPUT FROM PIPELINE:
MY values  and
I am aware that there are similar issues out there:
