How to check Jenkins build status
I'm actually executing my own Jenkins plugin and I have a class that extends from RunListener<Run>
, with the following method onCompleted()
:
@Override
public void onCompleted(Run build, TaskListener listener) {
int number = build.number;
EnvVars env;
String name = "";
try {
env = build.getEnvironment(listener);
name = env.get("JOB_NAME") + "-" + env.get("BUILD_NUMBER");
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
GraphicAction act = new GraphicAction(name);
build.getActions().add((Action) act);
}
Is it possible to execute the last two lines only if the build is successful?
Thank!
+3
source to share