[Fuego] [PATCH] port: allow users to choose a different port for jenkins

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Wed Feb 20 06:31:03 UTC 2019


The default port (8080) we use for Jenkins is often
used by other server software. Allow users to choose
their desired port.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 scripts/common.sh |  3 ++-
 scripts/ftc       | 12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/scripts/common.sh b/scripts/common.sh
index 6c8b3db..c1fa427 100644
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -138,7 +138,8 @@ function abort_job {
 
   # BUILD_URL should be defined. But if not, use a default
   if [ -z "$BUILD_URL" ] ; then
-    BUILD_URL="http://localhost:8080/fuego/job/$JOB_NAME/$BUILD_NUMBER"
+    PORT=${JENKINS_PORT:8080}
+    BUILD_URL="http://localhost:$PORT/fuego/job/$JOB_NAME/$BUILD_NUMBER"
   fi
   # sync tty data before telling Jenkins to terminate the job
   # so that the abort message will show up in the console log
diff --git a/scripts/ftc b/scripts/ftc
index ee41184..f654885 100755
--- a/scripts/ftc
+++ b/scripts/ftc
@@ -524,7 +524,8 @@ class config_class:
     def __init__(self, config_path):
         # hardcode a few config vars
         self.JENKINS_HOME = "/var/lib/jenkins"
-        self.JENKINS_URL = "http://localhost:8080/fuego"
+        jenkins_port = os.environ["JENKINS_PORT"]
+        self.JENKINS_URL = "http://localhost:"+jenkins_port+"/fuego"
 
         # now read configuration data from a file
         try:
@@ -1453,7 +1454,8 @@ ftc run-test -b $NODE_NAME -t {testdir} -s {testspec} \\
     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 ' +
+        jenkins_port = os.environ["JENKINS_PORT"]
+        subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:'+jenkins_port+'/fuego create-job ' +
             job_name + ' < ' + tmp, shell=True)
         os.unlink(tmp)
     except Exception as e:
@@ -1502,7 +1504,8 @@ 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 ' +
+        jenkins_port = os.environ["JENKINS_PORT"]
+        subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:'+jenkins_port+'/fuego create-job ' +
              job_name + '< ' + tmp, shell=True)
         os.unlink(tmp)
     except Exception as e:
@@ -4938,7 +4941,8 @@ def main():
         do_list_boards(conf)
 
     import jenkins
-    server = jenkins.Jenkins('http://localhost:8080/fuego')
+    jenkins_port = os.environ["JENKINS_PORT"]
+    server = jenkins.Jenkins('http://localhost:'+jenkins_port+'/fuego')
 
     if command.startswith("add-job"):
         # adds Jenkins jobs
-- 
2.7.4



More information about the Fuego mailing list