课堂PPT
PPT地址
SpringBoot+MyBatis.xmind (88.5 KB)
public static boolean isFinished(Job job1, int number) {
boolean isBuilding = false;
if (number <= 0) {
throw new IllegalArgumentException("jenkins build number must greater than 0!");
}
try {
JobWithDetails job = job1.details();
System.out.println("job:"+job);
// build 如果为空则证明正在构建,走else了
Build buildByNumber = job.getBuildByNumber(number);
System.out.println("buildByNumber:"+buildByNumber);
if (null != buildByNumber) {
BuildWithDetails details = buildByNumber.details();
if (null != details) {
isBuilding = details.isBuilding();
} else {
isBuilding = true;
}
} else {
isBuilding = true;
}
return !isBuilding;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}