[Buildbot-devel] FileUpload and wildcard support?

Greg Ward gerg.ward+buildbot at gmail.com
Sun Apr 6 13:20:26 UTC 2008


On Tue, Apr 1, 2008 at 12:31 PM, Dossy Shiobara <dossy at panoptic.com> wrote:
>  As part of the build output, I generate a .tar.gz or .zip of the
>  resulting binaries.  The archives are generated with a build step like
>  this:
>
>     tar = s(ShellCommand, name="tar", command=["sh", "-c", WithProperties("(cd dist && tar cvf - .) | gzip -c > ../%(buildername)s-build-%(buildnumber)s.tar.gz")], description=["archiving"], descriptionDone=["archive"])
>
>  I don't want the archive uploaded after _every_ build, only the one
>  Nightly build.  Also, since the archive name changes each build (since
>  it includes the build number in the filename), I can't hardcode the
>  filename in the slavesrc= or masterdest= parts of the FileUpload step.

The good news: all is not lost; I think you can do what you want.
The bad news: I don't think you can do it with vanilla Buildbot 0.7.6.

The first problem is fixed in ticket #115
(http://buildbot.net/trac/ticket/115): that allows you to use
WithProperties in the 'filename' of a FileUpload/FileDownload step,
just like you can in the 'command' of a ShellCommand.  That patch is
in 0.7.7, or applies cleanly to 0.7.6.

>  I've created a scheduler that's dependent on the Nightly scheduler,
>  which I'm hoping can perform the "daily build upload":
>
>     sched_upload = Dependent(name="upload", upstream=sched_nightly, builderNames=["upload-tgz", "upload-zip"])

Ugh.  Dependent is ... ummm ... how can I put this nicely ... not very
useful.  IMHO.

>  Conditional build-step execution would be really cool.  Maybe I can hack
>  together a buildbot.steps.conditional.If that could take an expression
>  and a buildbot.process.buildstep.BuildStep and invokes it if the
>  expression evaluates to true?  Then, if I could write an expression that
>  says "scheduler == nightly" ...

Yes, you're on the right track.  Note that you can cobble together
ad-hoc conditional build steps pretty easily.  You just need to
subclass the BuildStep class that you need to conditionalize.  For
example, if you want a ShellCommand that only runs when the build
number is odd:

  from buildbot.status.builder import SKIPPED
  class SillyConditional(ShellCommand):
      def start(self):
          if self.getProperty("buildnumber") % 2 == 0:
              # even build number: skip it
              self.step_status.setColor("green")
              self.step_status.setText(["skipped"])
              return SKIPPED
          else:
              ShellCommand.start(self)

No need to create a generic "conditional" command for just one step.
Now if I had 3 or 4 conditional build steps, I would definitely
consider that!

Greg




More information about the devel mailing list