Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profusion-mobi.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uxq0EK5GRzsrJ2bDMiShF+MGdR0EalIuB3ruMJblu5s=; b=EHetEvVfwcaHsSCg/qOBi9qgI3ydNH3AtO6UGUyhnIZEm6aYq0XZhRt5LAm/iE5Hea KSgJG8G3utuY/v7/OovDj+bfUHsFXD/lioX19NaL57r1+92lFmeuDHR75piIUH4ND4ez Eonhakqf6RZVqfh7BB+hm8BNt1UXa52/qPX9XRDRXxKav+KPzb9T+wIF11AWdKZEzgvU RZfZQH3M63kol1bwYKqofBbeHnHmyLt4JAlF3/M05UXgxl/gKFAeHMsdNp9TvAfujeYp ZHJtjROjPqyAMj7d2O4YLTWh8SCD4gVgiAAzMlkk0daRF5FnKE1pe1nYnbRYhwnFoKU7 IVnQ== From: Guilherme Campos Camargo Date: Fri, 26 Jan 2018 15:35:44 -0200 Message-Id: <20180126173545.16424-9-guicc@profusion.mobi> In-Reply-To: <20180126173545.16424-1-guicc@profusion.mobi> References: <20180126173545.16424-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH 8/9] Refactor plugin installation script List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org On this patch we're trying to remove the explicit sleeps from the plugin installation script, that are necessary for waiting for Jenkins start/restart and the installation of the plugins. With this change we hope that faster hosts (or hosts with faster networks) will be able to finish Jenkins plugins installation sooner. We also took the chance to remove the call to sudo, that are not necessary for using jenkins-cli. Signed-off-by: Guilherme Campos Camargo --- frontend-install/setup/jenkins/plugins/install.sh | 44 +++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/frontend-install/setup/jenkins/plugins/install.sh b/frontend-install/setup/jenkins/plugins/install.sh index 0db8bf2..37e8948 100755 --- a/frontend-install/setup/jenkins/plugins/install.sh +++ b/frontend-install/setup/jenkins/plugins/install.sh @@ -2,20 +2,42 @@ set -e +function install_jenkins_plugin { + echo "Waiting for Jenkins update center..." + while ! ret=$(java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego install-plugin "$1" 2>/dev/null); do + sleep "$2" + done + echo "${ret}" +} + +function wait_for_jenkins { + echo "Waiting for Jenkins..." + while ! curl --output /dev/null --silent --head --fail http://localhost:8080/fuego/ ; do + sleep "$1" + done +} + +readonly sleep_time_s=1 +readonly required_plugins=" + description-setter + pegdown-formatter + flot-plotter-plugin/flot.hpi + " + service jenkins start -sleep 30 -sudo -u jenkins java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego install-plugin description-setter -sudo -u jenkins java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego install-plugin pegdown-formatter -sudo -u jenkins java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego install-plugin flot-plotter-plugin/flot.hpi -sleep 10 +wait_for_jenkins ${sleep_time_s} + +for plugin in ${required_plugins}; do + install_jenkins_plugin "${plugin}" "${sleep_time_s}" +done # Let Jenkins install flot before making the symlink service jenkins restart -sleep 30 -rm $JENKINS_HOME/plugins/flot/flot/mod.js -ln -s /fuego-core/engine/scripts/mod.js $JENKINS_HOME/plugins/flot/flot/mod.js -ln -s /fuego-rw/logs $JENKINS_HOME/userContent/fuego.logs -ln -s /fuego-core/engine/scripts/ftc /usr/local/bin/ +wait_for_jenkins 1 -chown -R jenkins:jenkins $JENKINS_HOME/ +rm "$JENKINS_HOME/plugins/flot/flot/mod.js" +ln -s /fuego-core/engine/scripts/mod.js "$JENKINS_HOME/plugins/flot/flot/mod.js" +ln -s /fuego-rw/logs "$JENKINS_HOME/userContent/fuego.logs" +ln -s /fuego-core/engine/scripts/ftc /usr/local/bin/ +chown -R jenkins:jenkins "$JENKINS_HOME/" -- 2.15.1