From fade58db89040a1ff70848e55ea88c89cae6fb81 Mon Sep 17 00:00:00 2001 From: Nicolas Dessart Date: Fri, 5 Apr 2019 16:54:01 +0200 Subject: [PATCH] Add a slave container configuration timeout This should fix the following issue. When a JobDSL seed job is executed while a container is waiting for its configuration YAD plugin may loose track of the container. The container is left behind indefinitely waiting for its configuration. With this change, the container eventually exit in error and the jenkins master is able to provision another container. --- .../yad/launcher/DockerComputerJNLPLauncher/init.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yet-another-docker-plugin/src/main/resources/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher/init.sh b/yet-another-docker-plugin/src/main/resources/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher/init.sh index c4903e2a..6a64e078 100644 --- a/yet-another-docker-plugin/src/main/resources/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher/init.sh +++ b/yet-another-docker-plugin/src/main/resources/com/github/kostyasha/yad/launcher/DockerComputerJNLPLauncher/init.sh @@ -2,8 +2,14 @@ set -uxe +config_timeout=60 export CONFIG="/tmp/config.sh" while [ ! -f "$CONFIG" ]; do + config_timeout=$(($config_timeout-1)) + if [ $config_timeout -le 0 ]; then + echo "No config file found after 60s! Exiting." + exit 1 + fi echo "No config, sleeping for 1 second" sleep 1 done