Ticket #11 (closed enhancement: fixed)
simplify BuildStep construction in master.cfg
| Reported by: | warner | Owned by: | warner |
|---|---|---|---|
| Priority: | major | Milestone: | 0.7.6 |
| Version: | Keywords: | ||
| Cc: |
Description
Stefan Seefeld pointed out that BuildFactory.addStep() could be easier. At the moment it takes (type, **params), because the actual instantiation of the BuildSteps must be delayed until the Build actually starts. The reason for this is twofold. The first is that BuildStep.__init__() takes a 'build' argument, which obviously is different for each build. The second is that BuildSteps are allowed to keep state in their internal attributes, and are likely to get confused if the same instance is re-used from one build to the next.
Implementing BuildStep.clone() might be the cleanest approach. The calls to addStep() (and the 'steps' arg to BuildFactory) in master.cfg would take actual BuildStep instances, which would live for a long time. The only method that would get called on these instances is .clone(), which would be required to return a suitable duplicate of the instance. Each build would get a separate copy, and .start() would only be called on those duplicates. The duplicates would also be where setBuild(), setStepStatus(), and setProgress() get called.
Then the remaining big issue is the transition process: can we arrange for existing config files (which pass classes into addStep) to keep working? Probably yes, we just change addStep to detect that it's being given a class instead of an instance and instantiate it then and there. Allowing old custom BuildStep classes to keep working is trickier, but we can declare that all such custom classes must implement clone() to be useable with the latest version, and without clone() they'll at least fail in a nice and obvious way.
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)