title: Jenkins variable in groovy script
body: <p>I'd like to use "$WORSKPACE" variable into a groovy file called by jenkins script. But all solutions found on SO failed :</p>
  
  <pre><code>// KO : Wks = build.getEnvironment(listener).get('WORKSPACE')
  // KO : Wks = "${WORKSPACE}"
  /* KO :
  def thr = Thread.currentThread()
  def build = thr?.executable
  def envVarsMap = build.parent.builds[0].properties.get("WORKSPACE")
  */
  
  // KO : def build = this.getProperty('binding').getVariable('build')
  // KO : Wks = "%WORKSPACE%"
  </code></pre>
  
  <p>Message I got :
  Scripts not permitted to use method groovy.lang.GroovyObject setProperty java.lang.String java.lang.Object (JenkinsHelper.name). Administrators can decide whether to approve or reject this signature.</p>
  
  <p><strong>Any idea of code or option to set to allow Jenkins script to work ?</strong></p>
  
  <p>My sample case :</p>
  
  <p>File JenkinsHelper.groovy :</p>
  
  <pre><code>    class JenkinsHelper {
       def init(String sln) { 
        Wks = "%WORKSPACE%"
       }
      }
  return new JenkinsHelper();
  </code></pre>
  
  <p>Call from jenkins script :</p>
  
  <pre><code>def helper = load 'C:/.../test.groovy'
  helper.init("Mon SLN")
  </code></pre>
  
  <p>Thanks :)</p>