jenkins - How do I get/set property on loaded scripts in Jenkinsfile -


i have jenkinsfile load external files, not know how manage fields on it:

main script:

node {     deletedir()     git credentialsid: 'git-credentials', url: 'git@git-hostname:project/ci-cd.git'     load 'pipeline.groovy' }() 

pipeline.groovy:

def pipe = load 'pipeline-utils.groovy'  pipe.deployat << env.branch_name echo "foo -> ${pipe.deployat}"  { ->     echo 'hello there'     pipe.deploy() } 

pipeline-utils.groovy:

def deployat = []  def deploy() {     echo 'do it' }  

it says groovy.lang.missingpropertyexception: no such property: deployat class: groovy.lang.binding, if echo ${pipe.class} says script2, , if remove deployat lines says do it expected. not right, if can call methods why can not access fields?

my jenkins version 2.19.1.


Comments

Popular posts from this blog

Formatting string according to pattern without regex in php -

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -