As of version 0.22 of Py.Saunter, it will integrate nicely with the Buildbot CI server. The integration was literally a single line of code, but it took a bit longer to figure out how to get the config wired up to replicate the sort of setup I am used to with doing with Jenkins.
This will create a BuildFactory that will run the ebay example scripts that are tagged as shallow.
shallow = factory.BuildFactory()
shallow.addStep(Git(repourl='git://github.com/Element-34/py.saunter.git', mode='copy'))
shallow.addStep(ShellCommand(command=["git", "checkout", "BUILDBOT_STEP_1"],
shallow.addStep(ShellCommand(command=["pysaunter.py", "-f", "shallow"],
workdir="build/examples/ebay",
haltOnFailure=true))
shallow.addStep(ShellCommand(command=["git", "tag", "-a", "BUILDBOT_STEP_2"]))
shallow.addStep(ShellCommand(command=["git", "push", "--tags"]))
This illustrates a few things here. First, notice how we switch to a tag created in the previous factory. And if the Py.Saunter step ran clean (haltOnFailure doesn’t get triggered) we tag things and push them up to the server.
Now if the above example was for svn, here is what the tagging step would look like.
shallow.addStep(ShellCommand(command=["svn", "copy", "-r", WithProperties("%(revision)s"), "/trunk", "/tags/BUILDBOT_STEP_N"]))
Part of the opinionated part of Saunter is that it should be run outside of Se-Grid when dealing with browser permutations. Instead, the CI server is responsible for the distribution of it. Here we have three agents and assign our factory to each one.
c['slaves'] = [BuildSlave("ie7", "pass"), BuildSlave("ie8", "pass"), BuildSlave("ie9", "pass")]
c['builders'].append(
BuilderConfig(name="ie7",
slavenames=["ie7"],
factory=ebay))
c['builders'].append(
BuilderConfig(name="ie8",
slavenames=["ie8"],
factory=ebay))
c['builders'].append(
BuilderConfig(name="ie9",
slavenames=["ie9"],
factory=ebay))
The last piece of the configuration puzzle is how to do the chaining of things. This is done using the Dependent Scheduler
step_1 = basic.SingleBranchScheduler(
name="step_1",
change_filter=filter.ChangeFilter(branch='master'),
treeStableTimer=None,
builderNames=["ebay"]))
step_2 = basic.Dependent(name="shallow",
upstream=step_1,
builderNames=["ebay"])
c['schedulers'] = [step_1, step_2]
And of course, somewhere in there you need to provision an environment (vagrant?) for your app to run in and the actual app. But that is really just yet another ShellCommand command in the appropriate factory.
And and, authentication on who can trigger builds. You want an increasingly smaller amount of people able to do it as you get closer to and including production.
Post a Comment