-
Improvement
-
Resolution: Unresolved
-
Major
-
None
Currently EnvStep only accepts String array.
But it would be nice if it could accept Map<String, String> too
and convert it to a String array.
Right now I have to do this in a shared library.
def call(Closure body) {
deleteDir()
def scmVars = checkout scm
def list = []
scmVars.each { k, v -> list << "${k}=${v}" }
withEnv(list) {
body()
}
}
- is duplicated by
-
JENKINS-54930 withEnv should accept Map as well as List
-
- Closed
-
- relates to
-
JENKINS-27901 Standard form control for string collections
-
- Open
-
- links to
[JENKINS-46124] EnvStep convert map to list
Priority | Original: Minor [ 4 ] | New: Major [ 3 ] |
Component/s | New: workflow-scm-step-plugin [ 21717 ] |
Component/s | Original: workflow-scm-step-plugin [ 21717 ] |
Hi,
This would be a great improvement for use with declarative pipeline.
We now have the case where we only perform a checkout in the stages where applicable.
It could help to have some syntax like:
On the other hand, we still have the case that checkout and withEnv are in separate steps.
We would something like the following (not that this example won't work because of the variable assignment!):
Our current workaround is to set the scmVars as a global variable and then "translate" it into a list for use with withEnv:
It would be great to see a solution for the latter case since we use/need it extensively.
With best regards,
Tom.