diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index 0d89db59..6f3c789b 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -5,9 +5,6 @@
-
-
-
diff --git a/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher.java b/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher.java
index 26dc9d3d..7d6c870a 100644
--- a/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher.java
+++ b/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher.java
@@ -169,13 +169,15 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
final DockerCloud dockerCloud = dockerComputer.getCloud();
// Objects.requireNonNull(dockerCloud, "Cloud not found for computer " + computer.getName());
if (isNull(dockerCloud)) {
- listener.error("Cloud not found for computer " + computer.getName());
- throw new NullPointerException("Cloud not found for computer " + computer.getName());
+ listener.error("Cloud not found cloud for computer " + computer.getName());
+ throw new IllegalStateException("Cloud not found cloud for computer " + computer.getName());
}
- final DockerClient connect = dockerCloud.getClient();
+ final DockerClient client = dockerCloud.getClient();
final DockerSlave node = dockerComputer.getNode();
if (isNull(node)) {
- throw new NullPointerException("Node can't be null");
+ listener.error("Failed to run container for %s", computer.getName());
+ printLog(client, listener, containerId);
+ throw new IllegalStateException("Node can't be null, probably remote node disappeared.");
}
final DockerSlaveTemplate dockerSlaveTemplate = node.getDockerSlaveTemplate();
final DockerComputerJNLPLauncher launcher = (DockerComputerJNLPLauncher) dockerSlaveTemplate.getLauncher();
@@ -183,7 +185,7 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
final String rootUrl = launcher.getJenkinsUrl(Jenkins.getInstance().getRootUrl());
// Objects.requireNonNull(rootUrl, "Jenkins root url is not specified!");
if (isNull(rootUrl)) {
- throw new NullPointerException("Jenkins root url is not specified!");
+ throw new IllegalStateException("Jenkins root url is not specified!");
}
// exec jnlp connection in running container
@@ -208,7 +210,7 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
"`$NO_RECONNECT_SLAVE='" + isNoReconnect() + WNL +
"\"@ | Out-File -FilePath c:\\config.ps1";
- response = connect.execCreateCmd(containerId)
+ response = client.execCreateCmd(containerId)
.withTty(true)
.withAttachStdin(false)
.withAttachStderr(true)
@@ -230,7 +232,7 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
"NO_RECONNECT_SLAVE=\"" + isNoReconnect() + NL +
"EOF" + "\n";
- response = connect.execCreateCmd(containerId)
+ response = client.execCreateCmd(containerId)
.withTty(true)
.withAttachStdin(false)
.withAttachStderr(true)
@@ -242,7 +244,7 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
LOG.info("Starting connection command for {}...", containerId);
logger.println("Starting connection command for " + containerId);
- try (ExecStartResultCallback exec = connect
+ try (ExecStartResultCallback exec = client
.execStartCmd(response.getId())
.withDetach(true)
.withTty(true)
@@ -257,7 +259,7 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
} catch (Exception ex) {
listener.error("Can't execute JNLP connection command: " + ex.getMessage().trim());
LOG.error("Can't execute JNLP connection command: '{}'", ex.getMessage().trim());
- printLog(connect, listener, containerId);
+ printLog(client, listener, containerId);
node.terminate();
throw ex;
}
@@ -281,7 +283,7 @@ public void launch(@Nonnull SlaveComputer computer, TaskListener listener) throw
if (!dockerComputer.isOnline()) {
LOG.info("Launch timeout, terminating slave based on '{}'", containerId);
logger.println("Launch timeout, terminating slave.");
- printLog(connect, listener, containerId);
+ printLog(client, listener, containerId);
node.terminate();
throw new IOException("Can't connect slave to jenkins");
}
diff --git a/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerSingleJNLPLauncher.java b/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerSingleJNLPLauncher.java
index 1d6b6c87..a5559ddc 100644
--- a/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerSingleJNLPLauncher.java
+++ b/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/launcher/DockerComputerSingleJNLPLauncher.java
@@ -236,9 +236,13 @@ private void provisionWithWait(DockerComputerSingle computer, TaskListener liste
containerLifecycle.getRemoveContainer().exec(client, cId);
throw new IllegalStateException("Jenkins root url is not specified!");
}
+
final DockerSlaveSingle node = computer.getNode();
if (isNull(node)) {
- throw new NullPointerException("Node can't be null for " + computer.getName());
+ listener.error("Failed to run container for %s", imageId);
+ printLog(client, listener, containerId);
+ throw new IllegalStateException("Node for computer: '" + computer.getName() +
+ "' can't be null, probably remote node disappeared.");
}
// exec jnlp connection in running container