-
Bug
-
Resolution: Not A Defect
-
Minor
-
Tested on Jenkins docker images 1.642.4 / 2.0-beta-2
Documentation says "Internally, scripts in the vars directory are instantiated as a singleton on-demand, when used first."
Here is a very basic example to demonstrate it's not the case:
// vars/acme.groovy def setFoo(v) { this.foo = v; } def getFoo() { return this.foo; }
// src/com/foo/Zot.groovy package com.foo def printAcmeFoo() { try { echo acme.foo } catch (e){ echo "acme.foo is undefined" } }
And here is a pipeline:
import com.foo.Zot node{ acme.foo = "5" echo acme.foo; Zot z = new Zot() z.printAcmeFoo() }
Actually it shows 2 issues:
1/ scripts in the vars directory are not singletons
2/ when accessing undefined field pipeline will hang indefinitely
- is duplicated by
-
JENKINS-38795 global variables are not global singletons
- Resolved
- is related to
-
JENKINS-36673 MissingMethodException When Calling Pipeline Library Function
- Resolved
- relates to
-
JENKINS-38021 Accessing unset global variable cause master to hang
- Resolved
- links to