From f038b2aac9924d74086709b53dff7ef38d58d5d1 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 14 Nov 2016 14:33:52 +0100 Subject: [PATCH] phase2: pass buildbot url to cleanup.sh Instead of hardcoding the REST url in the cleanup script, pass the value derived from the configuration. Signed-off-by: Jo-Philipp Wich --- phase2/cleanup.sh | 9 +++++---- phase2/master.cfg | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/phase2/cleanup.sh b/phase2/cleanup.sh index 989ac5c..cd425d1 100755 --- a/phase2/cleanup.sh +++ b/phase2/cleanup.sh @@ -2,11 +2,12 @@ export LC_ALL=C -current_slave="$1" -current_builder="$2" -current_mode="$3" +buildbot_url="$1" +current_slave="$2" +current_builder="$3" +current_mode="$4" -running_builders="$(wget -qO- "http://phase2.builds.lede-project.org/json/slaves/$current_slave?as_text=1" | sed -ne 's,^.*"builderName": "\(.*\)".*$,\1,p')" +running_builders="$(wget -qO- "${buildbot_url%/}/json/slaves/$current_slave?as_text=1" | sed -ne 's,^.*"builderName": "\(.*\)".*$,\1,p')" is_running() { local running_builder diff --git a/phase2/master.cfg b/phase2/master.cfg index 08c77c1..ea3e0fb 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -11,6 +11,8 @@ from buildbot import locks ini = ConfigParser.ConfigParser() ini.read("./config.ini") +buildbot_url = ini.get("general", "buildbot_url") + # This is a sample buildmaster config file. It must be installed as # 'master.cfg' in your buildmaster's base directory. @@ -180,14 +182,14 @@ for arch in arches: factory.addStep(ShellCommand( name = "cleanold", description = "Cleaning previous builds", - command = ["./cleanup.sh", WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"], + command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"], haltOnFailure = True, timeout = 2400)) factory.addStep(ShellCommand( name = "cleanup", description = "Cleaning work area", - command = ["./cleanup.sh", WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"], + command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"], haltOnFailure = True, timeout = 2400)) @@ -402,7 +404,7 @@ c['titleURL'] = ini.get("general", "title_url") # with an externally-visible host name which the buildbot cannot figure out # without some help. -c['buildbotURL'] = ini.get("general", "buildbot_url") +c['buildbotURL'] = buildbot_url ####### DB URL -- 2.30.2