[Buildbot-devel] API for staring builds

Andy Howell AndyHowell at austin.rr.com
Mon Mar 21 19:22:38 UTC 2011


On 03/21/2011 11:18 AM, Alexander O'Donovan-Jones wrote:
> I’m looking at the buildbot docs, but I am only seeing API’s for getting information about
> builds, none for actually triggering a build.
> 
> I’m running 0.8.1, and so have the XMLRPC and JSON API’s available.
> 
>  
> 
> Am I missing something here?
> 
> 

I made a python script to post a build request via json. It should be in the
master/contrib/post_build_request.py.

It does not do any authentication.

>From the script help:

Usage: post_build_request.py [options]

This script is used to submit a change to the buildbot master using the
/change_hook web interface. Options are url encoded and submitted
using a HTTP POST. The repository and project must be specified.

This can be used to force a build. For example, create a scheduler that
listens for changes on a category 'release':

releaseFilt    = ChangeFilter(category="release")
s=Scheduler(name="Release", change_filter=releaseFilt,
            treeStableTimer=10,
            builderNames=["UB10.4 x86_64 Release"]))
c['schedulers'].append(s)

Then run this script with the options:

--repostitory <REPOSTORY> --project <PROJECT> --category release


Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -w WHO, --who=WHO     Who is submitting this request. This becomes the
                        Change.who attribute. This defaults to the name of the
                        user running this script
  -f FILE, --file=FILE  Add a file to the change request. This is added to the
                        Change.files attribute. NOTE: Setting the file URL is
                        not supported
  -c COMMENTS, --comments=COMMENTS
                        Comments for the change. This becomes the
                        Change.comments attribute
  -l LINKS, --link=LINKS
                        These are links for the source.  This becomes the
                        Change.links attribute.
  -R REVISION, --revision=REVISION
                        This is the revision of the change.  This becomes the
                        Change.revision attribute.
  -W WHEN, --when=WHEN  This this the date of the change.  This becomes the
                        Change.when attribute.
  -b BRANCH, --branch=BRANCH
                        This this the branch of the change.  This becomes the
                        Change.branch attribute.
  -C CAT, --category=CAT
                        Category for change. This becomes the Change.category
                        attribute, which can be used within the buildmaster to
                        filter changes.
  --revlink=REVLINK     This this the revlink of the change.  This becomes the
                        Change.revlink.
  -p PROP, --property=PROP
                        This adds a single property. This can be specified
                        multiple times. The argument is a string representing
                        python dictionary. For example, {'foo' : [ 'bar',
                        'baz' ]} This becomes the Change.properties attribute.
  -r PATH, --repository=PATH
                        Repository for use by buildbot slaves to checkout
                        code. This becomes the Change.repository attribute.
                        Exmaple: :ext:myhost:/cvsroot
  -P PROJ, --project=PROJ
                        The project for the source. Often set to the CVS
                        module being modified. This becomes the Change.project
                        attribute.
  -v, --verbose         Print more detail. If specified once, show status. If
                        secified twice, print all data returned. Normally this
                        will be the json version of the Change.
  -H HOST, --host=HOST  Host and optional port of buildbot. For example,
                        bbhost:8010 Defaults to localhost:8010
  -u URLPATH, --urlpath=URLPATH
                        Path portion of URL. Defaults to /change_hook/base
  -t, --testing         Just print values and exit.




More information about the devel mailing list