-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: pipeline-model-definition-plugin
-
Declarative backlog
It would be extremely useful to be able to share variables between stages ; currently, environment variables are overriden per-stage only, given the following example :Â
Â
stages {
stage('Setup profile') {
environment {
MVNARGS = "-P${params.profile}"
}
when {
expression {
params.profile != ''
}
}
steps {
echo "deploying as args:${env.MVNARGS} - env:${MVNARGS} - pprofile:${params.profile} - ..."
}
}
stage('Build') {
steps {
sh "mvn ${env.MVNARGS} xxxxxxx"
}
}
}
In Build, MVNARGS is null because the override from the Setup profile is stage scoped.
I did not find a workaround for this, I've tried to share using the params Map but it's an unmodifiable read-only map.Â
Any ideas ?
Â
Thanks
Â
Â
- is duplicated by
-
JENKINS-43408 Provide a standardized way of dealing with variables
-
- Fixed but Unreleased
-
-
JENKINS-55771 Assign variable from shell output using declarative pipeline
-
- Closed
-