Open markcellus opened 2 years ago
Think I've found a way. Looks like I was incorrectly assuming that what was returned from build.get()
was the job (per code snippet in https://github.com/silas/node-jenkins/issues/102#issuecomment-770305686, which has it assigned to a job
const. I think assigning to a build
const is more accurate. Then we can read from the result
of the build.
const build = await jenkins.build.get('example', 123);
// ... build finishes
if (build.result === 'FAILURE') {
throw new Error('Build failed.');
}
@silas do you mind confirming that my assumptions here are correct? If so, we can close ticket. Thanks!
This is more of a question rather than an "issue". But let's say I'm using the following to retrieve a
job
object from a build that has failed:I tried using the following....
But that doesn't work if some other build (567) has failed before the code above :point_up: runs.
Given this scenario, what is the recommended way to detect the build failure and throw an error?