Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug "Problems occurs on injecting env vars as a build wrap: null"

Tags:

jenkins

groovy

I use Groovy to inject variables into the build process using "EnvInject Plugin" plugin:

https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

My script is saved under "Evaluated Groovy script" text area.

If the script is working, everything is fine. But if some error occurs, I always get the same error message:

[EnvInject] - [ERROR] - [EnvInject] - [ERROR] - Problems occurs on injecting env vars as a build wrap: null

Is there any way to get the actual exception or even exception message?

like image 412
Boris Brodski Avatar asked Mar 04 '16 14:03

Boris Brodski


2 Answers

Another solution, that I found is to wrap your code into

try {

  // CODE HERE

} catch (Throwable t) {
  println(t)
  throw t;
}
like image 123
Boris Brodski Avatar answered Oct 29 '22 10:10

Boris Brodski


If you put the script in the 'Prepare an environment for the run' section rather than down at the 'Build Environment' level in 'Inject environment variable to the build process' it will give you the exception error and the stack trace.

like image 34
pcort Avatar answered Oct 29 '22 10:10

pcort