Skip to content

Commit

Permalink
Changed to use effective build host when updating build info
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Aldinger committed Mar 22, 2019
1 parent 2ff8638 commit 285d657
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.io.PrintStream;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -831,7 +833,22 @@ public RemoteBuildInfo updateBuildInfo(@Nonnull RemoteBuildInfo buildInfo, @Nonn
}
QueueItemData queueItem = getQueueItemData(queueId, context);
if (queueItem.isExecuted()) {
buildInfo.setBuildData(queueItem.getBuildNumber(), queueItem.getBuildURL());
URL effectiveRemoteBuildURL = queueItem.getBuildURL();
try {
URI effectiveUri = new URI(context.effectiveRemoteServer.getAddress());
String effectiveHostname = effectiveUri.getHost();
URL remoteURL = queueItem.getBuildURL();
if (remoteURL != null) {
URI remoteUri = remoteURL.toURI();
String remoteHostname = remoteUri.getHost();
String effectiveRemoteAddress = remoteUri.toString().replaceAll(remoteHostname,effectiveHostname);
effectiveRemoteBuildURL = new URL(effectiveRemoteAddress);
}
} catch (URISyntaxException ex) {
throw new AbortException(
String.format("Unexpected syntax error: %s.", ex.toString()));
}
buildInfo.setBuildData(queueItem.getBuildNumber(), effectiveRemoteBuildURL);
}
return buildInfo;
}
Expand Down

0 comments on commit 285d657

Please sign in to comment.