-
Bug
-
Resolution: Unresolved
-
Major
-
Jenkins version: Enterprise 2.60.1.1-rolling
Java version: 8 update 131, 64-bit for both master and slave
Master OS version: CentOS 6.7 for master, Windows 10 for slave
Web browser: Google Chrome
Plugin versions:
- Pipeline: 2.5
- Pipeline: API: 2.18
- Pipeline: Basic Step: 2.5
- Pipeline: Declarative Agent API: 1.1.1
- Pipeline: Declarative Extension Points API: 1.1.8
- Pipeline: Groovy: 2.36Jenkins version: Enterprise 2.60.1.1-rolling Java version: 8 update 131, 64-bit for both master and slave Master OS version: CentOS 6.7 for master, Windows 10 for slave Web browser: Google Chrome Plugin versions: - Pipeline: 2.5 - Pipeline: API: 2.18 - Pipeline: Basic Step: 2.5 - Pipeline: Declarative Agent API: 1.1.1 - Pipeline: Declarative Extension Points API: 1.1.8 - Pipeline: Groovy: 2.36
We create a Declarative Pipeline script from within a groovy shared variable. The problem is the environment block and options block (specifically the disableConcurrentBuilds option) do not take effect from inside the groovy shared variable.
Top-level jenkinsfile:
#!groovy @Library("OurGroovyLibrary") _ ourGroovySharedFunction([Arg: "SomeValue"])
Groovy shared variable (ourGroovySharedFunction.groovy) :
#!groovy def call(Map templateParams) { pipeline { agent { node { label 'ImportantLabel' } } environment { ImportantPath = 'C:/Some/Important/Path' } options { disableConcurrentBuilds() //BUG: This does not take effect, build still runs concurrently on slaves with more than 1 executor } stages { stage('Checking environment') { steps { echo "${env.getEnvironment()}" //BUG: ImportantPath is not present in env } } } } }
Verified that the expected behavior occurs correctly when the declarative pipeline script is in the Jenkinsfile, but would prefer to have it in the groovy shared variable for scalability reasons.
- is related to
-
JENKINS-42224 Need ability to create reusable chunks of Declarative Pipeline
- Open