Update jenkins to handle invalid builds better
This commit is contained in:
parent
05c7a21884
commit
54f2896255
@ -49,7 +49,8 @@ public class LDJenkins {
|
|||||||
try {
|
try {
|
||||||
DisguiseUtilities.getLogger().info("Now looking for update on Jenkins..");
|
DisguiseUtilities.getLogger().info("Now looking for update on Jenkins..");
|
||||||
// We're connecting to md_5's jenkins REST api
|
// We're connecting to md_5's jenkins REST api
|
||||||
URL url = new URL("https://ci.md-5.net/job/LibsDisguises/api/json?tree=builds[changeSet[items[msg]],id,result]");
|
URL url = new URL(
|
||||||
|
"https://ci.md-5.net/job/LibsDisguises/api/json?tree=builds[changeSet[items[msg]],id,result]");
|
||||||
// Creating a connection
|
// Creating a connection
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setDefaultUseCaches(false);
|
con.setDefaultUseCaches(false);
|
||||||
@ -87,14 +88,6 @@ public class LDJenkins {
|
|||||||
for (Map map : (List<Map>) lastBuild.get("builds")) {
|
for (Map map : (List<Map>) lastBuild.get("builds")) {
|
||||||
String result = (String) map.get("result");
|
String result = (String) map.get("result");
|
||||||
|
|
||||||
if (!"SUCCESS".equalsIgnoreCase(result)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changelog.isEmpty()) {
|
|
||||||
version = (String) map.get("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object items = ((Map) map.get("changeSet")).get("items");
|
Object items = ((Map) map.get("changeSet")).get("items");
|
||||||
boolean release = false;
|
boolean release = false;
|
||||||
|
|
||||||
@ -112,10 +105,16 @@ public class LDJenkins {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("SUCCESS".equalsIgnoreCase(result)) {
|
||||||
|
if (version == null) {
|
||||||
|
version = (String) map.get("id");
|
||||||
|
}
|
||||||
|
|
||||||
if (release) {
|
if (release) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (changelog.isEmpty()) {
|
if (changelog.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user