Skip to content

Commit ad6dbbe

Browse files
pyoo47brianchandotcom
authored andcommitted
LRCI-6534 Simplify isCINode() to avoid infinite loop
1 parent 2efee06 commit ad6dbbe

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

modules/test/jenkins-results-parser/src/main/java/com/liferay/jenkins/results/parser/JenkinsResultsParserUtil.java

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,38 +3771,14 @@ public static JSONObject invokeJenkinsBuild(
37713771
}
37723772

37733773
public static boolean isCINode() {
3774-
if (_ciNode != null) {
3775-
return _ciNode;
3776-
}
3777-
3778-
if (!isNullOrEmpty(System.getenv("JENKINS_HOME"))) {
3779-
_ciNode = true;
3780-
3781-
return _ciNode;
3782-
}
3783-
3784-
String hostName = getHostName("");
3785-
3786-
try {
3787-
List<String> jenkinsNodes = getJenkinsNodes();
3788-
3789-
String hostNameSuffix = ".lax.liferay.com";
3790-
3791-
if (hostName.endsWith(hostNameSuffix)) {
3792-
hostName = hostName.substring(
3793-
0, hostName.length() - hostNameSuffix.length());
3794-
}
3795-
3796-
if (jenkinsNodes.contains(hostName)) {
3797-
_ciNode = true;
3774+
if (_ciNode == null) {
3775+
if (isNullOrEmpty(System.getenv("JENKINS_URL"))) {
3776+
_ciNode = false;
37983777
}
37993778
else {
3800-
_ciNode = false;
3779+
_ciNode = true;
38013780
}
38023781
}
3803-
catch (Exception exception) {
3804-
_ciNode = false;
3805-
}
38063782

38073783
return _ciNode;
38083784
}

0 commit comments

Comments
 (0)