简体   繁体   中英

Build function doesn't return a build object if FAILED or UNSTABLE

I'm using the build flow in my jobs and I would like to get any build result from build object even if the build is failed or unstable. For example:

try{ BUILD_TO_RETURN = build(parameters: newparams, job: jobName, quietPeriod: 5); println("Result is: " + BUILD_TO_RETURN.getResult()); // THIS LINE IS NOT BEING CALLED IF THE BUILD IS UNSTABLE } catch(Exception e) { if (e instanceof InterruptedException || e.getCause() instanceof InterruptedException) { throw e; } else if( e.toString().contains("UNSTABLE") || e.toString().contains("FAILURE")){ println("buildJob : No exception, the job result: ${e}"); // THIS LINE IS BEING CALLED return BUILD_TO_RETURN; }

What actually happening is that BUILD_TO_RETURN returned is null. Which means an exception was thrown for UNSTABLE build. I would like rather to have the UNSTABLE build object in my hands and return it.

Is it possible to "ignore" failure\\unstable build and do not ignore all other exceptions?

Add: propagate: false to your build step to get this behavior. Snippet Generator should be offering that as an option, with an inline help button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM