我实际上在做我自己的Jenkins插件,我有一个从RunListener<Run>
延伸的类,使用下一个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);
}
只有在构建成功的情况下才能执行最后两行吗?
谢谢!