0

Before update to 2.7.x version of Jenkins, I used this code to create build variable in job using 'Execute System Groovy Script':

import hudson.model.*
build.addAction(new ParametersAction(new StringParameterValue("var_name", 'foo')))

After update it doesn't work, in log I see:

WARNING hudson.model.Run getEnvVars
deprecated call to Run.getEnvVars
    at sun.reflect.GeneratedMethodAccessor1108.invoke(Unknown Source)

Is there any workaround, or how to create variable using Groovy now?

fred05
  • 53
  • 1
  • 9
  • I think the problem you are seeing is not related to the code you provided. Are you using the method call `Run.getEnvVars()`? – Benjamin Muschko Sep 08 '16 at 14:48
  • Nope. Used this solution: http://stackoverflow.com/questions/10413936/creating-a-jenkins-environment-variable-using-groovy – fred05 Sep 12 '16 at 09:40
  • Are you saying that use the code from the linked question and that could is failing for you with the upgrade of Jenkins? Or are you saying that you used the code from the linked question and it solved your issue? – Benjamin Muschko Sep 12 '16 at 22:11
  • I use this - "java -Dhudson.model.ParametersAction.keepUndefinedParameters=true -jar jenkins.war", to solve my problem, but I don't like it. – fred05 Sep 19 '16 at 09:55

0 Answers0