Re: Problem defining global variables

2017-01-05 Thread Sverre Moe
Must be a way in Jenkinsfile to access variables set within a Shared Library script. I could set a return variable for execute(), not a good solutions if I want to access more than one variable. def build = new com.company.ci.Build() def foo = build.execute() Unless I can return the variables o

Re: Problem defining global variables

2016-12-19 Thread Sverre Moe
Is it a problem with scope perhaps? Tried setting foo first before calling build.execute() variables.setFoo(true) def build = new com.company.ci.Build() build.execute() def foo = variables.isFoo() if (foo) { println "We got foo" } else{ println "No foo" } Within build.execute() it sets foo t

Problem defining global variables

2016-12-15 Thread Sverre Moe
https://github.com/jenkinsci/workflow-cps-global-lib-plugin#defining-global-variables #vars/variables.groovy def setFoo(f) { this.foo = f } def isFoo() { return this.foo } #src/com/company/ci/Build.groovy void execute() { def foo = false if (env.BRANCH_NAME.equals("master")) { foo =