JL 6BerYeti
2016-11-30 13:26:07 UTC
Dear All,
I am trying to setup (many) environment variables for a set of stages
within a pipeline by reading a property file and then passing the result to
withEnv.
As far as my understanding is correct, I thought that withEnv waits for a
map, and readProperties returrns a map.
So, I try this :
def localProps=[:]
localProps=["moduleName=Communicator","versionNbr=1.0"]
def pipeProps=readProperties([
defaults : localProps,
file : "Pipeline/lib/tutoFile.properties"
])
echo "${pipeProps}"
withEnv(pipeProps) {
... pipeline stages
}
I am sure that the file is read within pipePros.
But the withEnv step fails with the following error :
java.lang.UnsupportedOperationException: must specify $class with an implementation of interface java.util.List at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:442) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:371) at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:313) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:257) at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:194) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:181) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
I don't understand what is wrong in the code (as you can imagine, I am not a groovy guru...), and I'd like to know how to get out of there.
Thanks for your help.
J-L
I am trying to setup (many) environment variables for a set of stages
within a pipeline by reading a property file and then passing the result to
withEnv.
As far as my understanding is correct, I thought that withEnv waits for a
map, and readProperties returrns a map.
So, I try this :
def localProps=[:]
localProps=["moduleName=Communicator","versionNbr=1.0"]
def pipeProps=readProperties([
defaults : localProps,
file : "Pipeline/lib/tutoFile.properties"
])
echo "${pipeProps}"
withEnv(pipeProps) {
... pipeline stages
}
I am sure that the file is read within pipePros.
But the withEnv step fails with the following error :
java.lang.UnsupportedOperationException: must specify $class with an implementation of interface java.util.List at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:442) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:371) at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:313) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:257) at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:194) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:181) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
I don't understand what is wrong in the code (as you can imagine, I am not a groovy guru...), and I'd like to know how to get out of there.
Thanks for your help.
J-L
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7be471c6-df0b-410e-8b5e-31322c931f64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7be471c6-df0b-410e-8b5e-31322c931f64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.