Browse Source

buildbot/master: Add OBSD bot, and support for environment variable config

* master.cfg: Add OpenBSD buildbot.
  Add an "env" key to the configuration dictionary, allowing for a
  JSON string of env variables, to be passed into the properties of
  BuildSlaves.
  Add a get_config_env Renderer, to allow build Steps to convert
  JSON env variable property to a python dictionary and give to
  the env= argument of some steps.
Paul Jakma 4 years ago
parent
commit
2226d40650
1 changed files with 55 additions and 45 deletions
  1. 55 45
      infra/buildbot/master/master.cfg

+ 55 - 45
infra/buildbot/master/master.cfg

@@ -1,6 +1,8 @@
 # -*- python -*-
 # ex: set syntax=python:
 
+import json
+
 from buildbot.plugins import *
 from buildbot.plugins import buildslave, util
 
@@ -20,7 +22,7 @@ execfile("pass.cfg")
 # suitable for public display
 def workers2publicprops (worker):
 	publicprops = [ "os", "version", "vm", "pkg", "texi", "cc",
-			"latent", ]
+			"latent", "env" ]
 	return  { k:worker[k] for k in worker if k in publicprops }
 
 # vm: non-VM are assumed faster and used for initial build
@@ -29,8 +31,12 @@ def workers2publicprops (worker):
 # cc: List of tuples of installed compilers, with:
 #     (<tag>, <version>, <command>)
 #     tag: gcc, clang, sunpro
+# env: JSON dictionary of environment variables to be passed to shell
+#      commands as a dictionary via json.load.
 # latent: VM spun up on demand via LatentSlave, uses "session" for
 #         the libvirt URI.
+#
+# When latent is true:
 # session: libvirt URI to use for latent workers. Default will be set on
 #          latent VMs if not specified.
 # hd_image: libvirt image to use
@@ -99,6 +105,16 @@ workers = {
   	  "latent": True,
   	  "hd_image": "/var/lib/libvirt/images/freebsd110.qcow2",
   	},
+  	"openbsd-6": { 
+	  "os": "OpenBSD",
+	  "version": "6.0",
+	  "vm": True,	
+  	  "pkg": "",
+  	  "cc": [ ("gcc", "4.2.1") ],
+  	  "latent": False,
+  	  "hd_image": "/var/lib/libvirt/images/openbsd-6.qcow2",
+	  "env": ' { "AUTOMAKE_VERSION": "1.15", "AUTOCONF_VERSION": "2.69" } ',
+  	},
   	"oi-hipster": {
   	  "os": "OpenIndiana",
   	  "version": "hipster",
@@ -285,31 +301,42 @@ c['builders'] = []
 # what steps, and which slaves can execute them.  Note that any particular build will
 # only take place on one slave.
 
-common_setup = [
-	steps.Git(repourl=quaggagit, mode='incremental'),
-	steps.ShellCommand(command=["./update-autotools"],
-				    description="generating autoconf",
-				    descriptionDone="autoconf"),
+# Renderer to extract simple JSON dictionary object from the configuration
+# via the 'env' property, and return as a python dictionary, so it can
+# be passed to the 'env=' argument that some Steps allow.
+@util.renderer
+def get_config_env (props):
+	jsonenv = props.getProperty('env')
+	env = None
+	if jsonenv:
+		env = json.loads (jsonenv)
+	return env
+
+step_git = steps.Git(repourl=quaggagit, mode='incremental')
+step_autoconf = steps.ShellCommand(command=["./update-autotools"],
+			   description="generating autoconf",
+			   descriptionDone="autoconf",
+			   haltOnFailure=True,
+			   env=get_config_env)
+
+git_and_autoconf = [
+	step_git, step_autoconf,
+]
+configure_and_clean = [
 	steps.Configure(command="../build/configure"),
 	steps.ShellCommand(command=["make", "clean"],
-				    description="cleaning",
-				    descriptionDone="make clean"),
+				description="cleaning",
+				descriptionDone="make clean"),
 ]
 
+common_setup = git_and_autoconf + configure_and_clean
+
 ### Default 'check' build, builder instantiated for each OS
 
 factory = util.BuildFactory()
-# check out the source
-factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
-factory.addStep(steps.ShellCommand(command=["./update-autotools"],
-				   description="generating autoconf",
-				   descriptionDone="autoconf"))
-factory.addStep(steps.Configure())
-factory.addStep(steps.ShellCommand(command=["make", "clean"],
-				   description="cleaning",
-				   descriptionDone="clean"))
-
-#factory.addSteps(common_setup)
+
+factory.addSteps(common_setup)
+
 factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
 factory.addStep(steps.ShellCommand(command=["make", "check"],
 				   description="checking",
@@ -325,15 +352,9 @@ for kw in workers:
 
 ### distcheck Builder, executed on any available bot
 factory = util.BuildFactory()
-# check out the source
-factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
-factory.addStep(steps.ShellCommand(command=["./update-autotools"],
-				   description="generating autoconf",
-				   descriptionDone="autoconf"))
-factory.addStep(steps.Configure())
-factory.addStep(steps.ShellCommand(command=["make", "clean"],
-				   description="cleaning",
-				   descriptionDone="make clean"))
+
+factory.addSteps(common_setup)
+
 factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
 				   description="run make distcheck",
 				   descriptionDone="make distcheck"))
@@ -346,16 +367,8 @@ c['builders'].append(
 ### LLVM clang-analyzer build, executed on any available non-VM bot
 
 f = util.BuildFactory()
-# check out the source
-f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
-		    getDescription=True))
-f.addStep(steps.ShellCommand(command=["./update-autotools"],
-			     description="run autotools",
-			     descriptionDone="autoconf"))
-f.addStep(steps.Configure())
-f.addStep(steps.ShellCommand(command=["make", "clean"],
-			     description="cleaning",
-			     descriptionDone="make clean"))
+
+factory.addSteps(common_setup)
 
 f.addStep(steps.SetProperty(property="clang-id",
 	value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
@@ -396,10 +409,9 @@ f = util.BuildFactory ()
 
 # check out the source
 f.addStep(steps.Git(repourl=quaggagit, mode='full'))
-f.addStep(steps.ShellCommand(command=["./update-autotools"],
-				   description="run autotools",
-				   descriptionDone="autotools"))
-f.addStep(steps.Configure())
+
+f.addSteps(git_and_autoconf)
+
 f.addStep(steps.ShellCommand(command=["make", "dist"],
 				     description="run make dist",
 				     descriptionDone="make dist"))
@@ -430,9 +442,7 @@ def build_is_nightly (step):
 
 f = util.BuildFactory ()
 f.addStep(steps.Git(repourl=quaggagit, mode='full'))
-f.addStep(steps.ShellCommand(command=["./update-autotools"],
-				   description="run autotools",
-				   descriptionDone="autotools"))
+f.addStep(step_autoconf)
 f.addStep(steps.Configure(command=["../build/configure"],
 			  workdir="docs"))
 f.addStep(steps.ShellCommand(command=["make", "V=99", "quagga.html"],