[Fuego] [PATCH] fuego: remove create/delete job scripts

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Mon Mar 27 05:49:24 UTC 2017


This scripts are now integrated into the ftc tool.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 README                                  |   8 +-
 fuego-ro/scripts/jobs/fuego-create-jobs | 199 --------------------------------
 fuego-ro/scripts/jobs/fuego-delete-jobs |  32 -----
 3 files changed, 5 insertions(+), 234 deletions(-)
 delete mode 100755 fuego-ro/scripts/jobs/fuego-create-jobs
 delete mode 100755 fuego-ro/scripts/jobs/fuego-delete-jobs

diff --git a/README b/README
index 329da20..398a38e 100644
--- a/README
+++ b/README
@@ -80,10 +80,12 @@ You can use the docker container as a fuego target in order to confirm that
 the installation was successful.
 
 # sudo -u jenkins ftc add-nodes docker
-# fuego-create-jobs --board docker --testplan testplan_docker --distrib nosyslogd.dist
+# sudo -u jenkins ftc add-jobs -b docker -p testplan_docker
 
-Build the job "docker.testplan_docker.batch", it will trigger the rest of
-the jobs. Use fuego-delete-jobs to remove all jobs.
+On the Jenkins interface, build the "docker.testplan_docker.batch" job.
+It will trigger the rest of the jobs. To remove the jobs use:
+
+# sudo -u jenkins ftc rm-jobs docker.testplan_docker.*.*
 
 License
 -------------------------------------------------------------------------------
diff --git a/fuego-ro/scripts/jobs/fuego-create-jobs b/fuego-ro/scripts/jobs/fuego-create-jobs
deleted file mode 100755
index b4df00e..0000000
--- a/fuego-ro/scripts/jobs/fuego-create-jobs
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/usr/bin/python
-#
-# fuego-create-jobs - a tool to create a fuego jobs
-#
-# Copyright 2016 TOSHIBA Corporation
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of version 2 of the GNU General Public License as
-#   published by the Free Software Foundation.  The GNU General Public
-#   License is available online at: http://www.gnu.org/copyleft/gpl.html
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-# Author: Daniel Sangorrin <daniel.sangorrin (at) toshiba.co.jp>
-#
-import subprocess
-import sys
-import argparse
-import json
-
-def create_job(test, timeout, reboot, rebuild, precleanup, postcleanup, jobextralinks, args):
-    # flot only necessary for Benchmarks
-    if str(test).split('.')[0] == 'Benchmark':
-        flot_link = '<flotile.FlotPublisher plugin="flot at 1.0-SNAPSHOT"/>'
-    else:
-        flot_link = ''
-    # prepare links for descriptionsetter. Put a link to log by default
-    template_link = '&lt;a href=&quot;/fuego/userContent/fuego.logs/%s/${NODE_NAME}.${BUILD_ID}.${BUILD_ID}/%%s&quot;&gt;%%s&lt;/a&gt;' % test
-    html_links = template_link % ('testlog.txt', 'log')
-    if jobextralinks != 'None':
-        for key, value in jobextralinks.iteritems():
-            html_links = html_links + ' ' + template_link % (value, key)
-
-    tmp = "/tmp/fuego_tmp_job"
-    fd = open(tmp, "w+")
-    fd.write("""<?xml version='1.0' encoding='UTF-8'?>
-<project>
-    <actions/>
-    <description></description>
-    <keepDependencies>false</keepDependencies>
-    <properties/>
-    <scm class="hudson.scm.NullSCM"/>
-    <assignedNode>{board}</assignedNode>
-    <canRoam>false</canRoam>
-    <disabled>false</disabled>
-    <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
-    <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
-    <triggers/>
-    <concurrentBuild>false</concurrentBuild>
-    <customWorkspace>$FUEGO_RW/buildzone</customWorkspace>
-    <builders>
-    <hudson.tasks.Shell>
-        <command>export Reboot={reboot}
-export Rebuild={rebuild}
-export Target_PreCleanup={precleanup}
-export Target_PostCleanup={postcleanup}
-export TESTDIR={testdir}
-export TESTNAME={testname}
-export DISTRIB="{distrib}"
-export TESTPLAN="{testplan}"
-timeout --signal=9 {timeout} /bin/bash $FUEGO_CORE/engine/tests/${{TESTDIR}}/${{TESTNAME}}.sh
-</command>
-    </hudson.tasks.Shell>
-    </builders>
-    <publishers>
-    {flot_link}
-    <hudson.plugins.descriptionsetter.DescriptionSetterPublisher plugin="description-setter at 1.10">
-        <regexp></regexp>
-        <regexpForFailed></regexpForFailed>
-        <description>{html_links}</description>
-        <setForMatrix>false</setForMatrix>
-    </hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
-    </publishers>
-    <buildWrappers/>
-</project>
-""".format(board=args.board, reboot=str(reboot), rebuild=str(rebuild), precleanup=str(precleanup), postcleanup=str(postcleanup),
-        distrib=args.distrib, testdir=str(test), testname=str(test).split('.')[1],
-        testplan=args.testplan, timeout=timeout, flot_link=flot_link, html_links=html_links))
-    fd.close()
-
-    print("Creating job " + test)
-    try:
-        subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego create-job ' + str(args.board) + '.' + str(args.testplan) + '.' + str(test) + ' < ' + tmp, shell=True)
-        subprocess.call('rm -f ' + tmp, shell=True)
-    except Exception as e:
-        print("Job already exists")
-        print(e)
-        sys.exit(1)
-
-def create_batch_job(alltests, args):
-    tmp = "/tmp/fuego_tmp_batch"
-    prefixed_alltests = [str(args.board) + '.' + str(args.testplan) + '.' + test for test in alltests]
-    fd = open(tmp, "w+")
-    fd.write("""<?xml version='1.0' encoding='UTF-8'?>
-<project>
-  <actions/>
-  <description></description>
-  <keepDependencies>false</keepDependencies>
-  <properties/>
-  <scm class="hudson.scm.NullSCM"/>
-  <assignedNode>{board}</assignedNode>
-  <canRoam>false</canRoam>
-  <disabled>false</disabled>
-  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
-  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
-  <triggers/>
-  <concurrentBuild>false</concurrentBuild>
-  <builders/>
-  <publishers>
-    <hudson.tasks.BuildTrigger>
-      <childProjects>{alltests}</childProjects>
-      <threshold>
-        <name>SUCCESS</name>
-        <ordinal>0</ordinal>
-        <color>BLUE</color>
-        <completeBuild>true</completeBuild>
-      </threshold>
-    </hudson.tasks.BuildTrigger>
-  </publishers>
-  <buildWrappers/>
-</project>
-""".format(board=args.board, alltests=','.join(prefixed_alltests)))
-    fd.close()
-
-    print("Creating batch job ")
-    try:
-        subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego create-job ' + str(args.board) + '.' + str(args.testplan) + '.batch < ' + tmp, shell=True)
-        subprocess.call('rm -f ' + tmp, shell=True)
-    except Exception as e:
-        print("Job already exists")
-        print(e)
-        sys.exit(1)
-
-def parse_testplan(testplan):
-    abspath = '/fuego-core/engine/overlays/testplans/' + testplan + '.json'
-    alltests = []
-    alltimeouts = []
-    allextralinks = []
-    allreboots = []
-    allrebuilds = []
-    allprecleanups = []
-    allpostcleanups = []
-
-    with open(abspath, "r") as f:
-        plan = json.load(f)
-        for test in plan['tests']:
-            alltests.append(test['testName'])
-            if 'timeout' in test:
-                alltimeouts.append(test['timeout'])
-            else:
-                alltimeouts.append('20m')
-            if 'reboot' in test:
-                allreboots.append(test['reboot'])
-            else:
-                allreboots.append('false')
-            if 'rebuild' in test:
-                allrebuilds.append(test['rebuild'])
-            else:
-                allrebuilds.append('true')
-            if 'precleanup' in test:
-                allprecleanups.append(test['precleanup'])
-            else:
-                allprecleanups.append('true')
-            if 'postcleanup' in test:
-                allpostcleanups.append(test['postcleanup'])
-            else:
-                allpostcleanups.append('true')
-            if 'extralinks' in test:
-                allextralinks.append(test['extralinks'])
-            else:
-                allextralinks.append('None')
-    return alltests, alltimeouts, allreboots, allrebuilds, allprecleanups, allpostcleanups, allextralinks
-
-if __name__=="__main__":
-    parser = argparse.ArgumentParser(description='Create a fuego jobs for a node')
-    parser.add_argument('-b', '--board', type=str, help='board name (e.g.: bbb for bbb.board)', required=True)
-    parser.add_argument('-t', '--testplan', default='testplan_default', type=str, help='testplan (e.g.: testplan_docker for testplan_docker.json)')
-    parser.add_argument('-d', '--distrib', default='nosyslogd.dist', type=str, help='DISTRIB file (e.g.: nosyslogd.dist)')
-    parser.add_argument('-c', '--testcase', type=str, help='Testcase (e.g.: Benchmark.Dhrystone)')
-    args = parser.parse_args()
-
-    alltests, alltimeouts, allreboots, allrebuilds, allprecleanups, allpostcleanups, allextralinks = parse_testplan(args.testplan)
-
-    if args.testcase is not None:
-        try:
-            i = alltests.index(args.testcase)
-        except Exception as e:
-            print(e)
-            print("ERROR: " + args.testcase + " not in " + args.testplan)
-            print(alltests)
-            sys.exit(1)
-        create_job(alltests[i], alltimeouts[i], allreboots[i], allrebuilds[i], allprecleanups[i], allpostcleanups[i], allextralinks[i], args)
-    else:
-        for test, timeout, reboot, rebuild, precleanup, postcleanup, jobextralinks in zip(alltests, alltimeouts, allreboots, allrebuilds, allprecleanups, allpostcleanups, allextralinks):
-            create_job(test, timeout, reboot, rebuild, precleanup, postcleanup, jobextralinks, args)
-        create_batch_job(alltests, args)
diff --git a/fuego-ro/scripts/jobs/fuego-delete-jobs b/fuego-ro/scripts/jobs/fuego-delete-jobs
deleted file mode 100755
index ffe26ce..0000000
--- a/fuego-ro/scripts/jobs/fuego-delete-jobs
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/python
-#
-# fuego-create-jobs - a tool to create a fuego jobs
-#
-# Copyright 2016 TOSHIBA Corporation
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of version 2 of the GNU General Public License as
-#   published by the Free Software Foundation.  The GNU General Public
-#   License is available online at: http://www.gnu.org/copyleft/gpl.html
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-# Author: Daniel Sangorrin <daniel.sangorrin (at) toshiba.co.jp>
-#
-import subprocess
-import sys
-
-if __name__=="__main__":
-    print("Deleting jobs")
-    try:
-        jobs = subprocess.check_output('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego list-jobs', shell=True).splitlines()
-        for job in jobs:
-            subprocess.call('java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/fuego delete-job ' + str(job), shell=True)
-            sys.stdout.write(".")
-            sys.stdout.flush()
-    except Exception as e:
-        print(e)
-        sys.exit(1)
-- 
2.7.4




More information about the Fuego mailing list