Hi all, I've become bored of setting up Jenkins jobs by hand for feature branches, so I wrote a small script to automate that. It clones the "fusionforge-feature-twig-template-engine" job into a new one named after the current feature/* branch (and starts a build immediately for good measure). Since I have a couple of feature branches up or coming, I expect to make extensive use of that script in the coming weeks, and I wanted to share it just in case it is useful to others (and maybe it could encourage others to write testsuites ;-)
----- #! /usr/bin/python3 import jenkins import re import os import sys srcbranch = 'twig-template-engine' jobtemplate = 'fusionforge-feature-%s' curbranch = os.popen("git branch | awk '/^\*/ { print $2 }'").read().strip() if not re.match('^feature/',curbranch): print ("Not a feature branch") sys.exit(1) oldname = jobtemplate % (re.sub('^feature/','',srcbranch),) newname = jobtemplate % (re.sub('^feature/','',curbranch),) server = jenkins.Jenkins('http://buildbot.fusionforge.org/', username='XXX', password='YYY') oldconf = server.get_job_config(oldname) try: server.get_job_config(newname) except: newconf = re.sub(oldname,newname,oldconf) server.create_job(newname,newconf) server.build_job(newname) ----- Roland. -- Roland Mas Indépendant en informatique libre -- Free software freelance http://www.gnurandal.com/ _______________________________________________ Fusionforge-general mailing list Fusionforge-general@lists.fusionforge.org http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-general