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=7rWT9i6OHin1bPgwwELJCfripiRvXYD4pA8r/W2ZDBg=; b=aXx7YT/p3QepxQGsq5DBdJOXGvJiIfJs2RiP2dC2QdxdTiflaWjN6Qz21+RZS7AASS dxty/YfAdvGh6FWaxz6wPftdiLj9uzC6+qNLB/kERMCwixvH7Z0WQmMbqSLTqAHyIzhu OHnC07SbSf9ae6D+jIiI3V4jFr54FOSPp4jhXCvRe5GqN2T1oypYNDWj10vxFi4aFcYE jk6bKn2zJ4QUwuWX07ctSlmySpAnFU4bnUUViqY+93NIigeyZUPGhY9JwHUwo1gL1gGD CnZXZR/wJb6CGiu1wkR+AIYhtlDtHtmS7OZQ9Vw8/qPn7FqiPAWOddnBnPP2XDjgk0LM xlkg== From: Guilherme Campos Camargo Date: Wed, 7 Feb 2018 18:46:00 -0200 Message-Id: <20180207204600.21587-2-guicc@profusion.mobi> In-Reply-To: <20180207204600.21587-1-guicc@profusion.mobi> References: <20180207204600.21587-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH 1/1] Allow ftc script to properly use Jenkins configured port List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org With the possibility of configuring jenkins porth through fuego/ro/conf/fuego.conf, a change on ftc script is needed so that it uses the configured port and not the default one (8080). This patch solves that issue by using the ${jenkins_port} environment variable (set on entrypoint.sh) instead of the hardcoded 8080. Signed-off-by: Guilherme Campos Camargo --- engine/scripts/ftc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/engine/scripts/ftc b/engine/scripts/ftc index bde3694..af5a2a7 100755 --- a/engine/scripts/ftc +++ b/engine/scripts/ftc @@ -63,6 +63,8 @@ VERSION = (1,2,1) # define these as globals log = None tail_fd = None +jenkins_port = os.getenv('jenkins_port', 8080) +fuego_url = 'http://localhost:' + str(jenkins_port) + '/fuego' # here's a utility routine to print a variable with it's name and value def pvar(name): @@ -72,7 +74,8 @@ def pvar(name): quiet = 0 verbose = 0 use_statusouput = 1 -server = jenkins.Jenkins('http://localhost:8080/fuego') +server = jenkins.Jenkins(fuego_url) + # keep configuration file in /fuego-ro/conf area config_dir = "/fuego-ro" @@ -413,7 +416,7 @@ class config_class: # fuegotest.com is at: 52.88.166.49 self.SERVER_URL_BASE = "http://52.88.166.49/server/Fuego_Server?action=Fuego." - self.JENKINS_URL = "http://localhost:8080/fuego" + self.JENKINS_URL = fuego_url # end of default configs @@ -1159,7 +1162,7 @@ timeout --signal=9 {timeout} /bin/bash $FUEGO_CORE/engine/scripts/main.sh job_name=board+"."+test.spec+"."+test.name print("Creating job " + job_name) try: - subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego create-job ' + + subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s' + fuego_url + 'create-job ' + job_name + ' < ' + tmp, shell=True) os.unlink(tmp) except Exception as e: @@ -1207,7 +1210,7 @@ def create_batch_job(board, testplan, plan_tests): print("Creating batch job ") try: job_name = board+'.'+testplan+'.batch' - subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego create-job ' + + subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s' + fuego_url + 'create-job ' + job_name + '< ' + tmp, shell=True) os.unlink(tmp) except Exception as e: @@ -3581,7 +3584,7 @@ def user_check(): new_user = "jenkins" if getpass.getuser() == "root": - cmd = ["sudo", "-u", new_user, "python"] + sys.argv + cmd = ["sudo", "-u", new_user, "-E", "python"] + sys.argv rcode = subprocess.call(cmd) sys.exit(rcode) -- 2.16.1