[Buildbot-devel] triggerable example?

Aleksandr Kuzminsky aleksandr.kuzminsky at percona.com
Tue Mar 9 04:56:29 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Hi Tom,


> Would anyone be so kind as to send me a full master.cfg that is
> using scheduler.Triggerable && trigger.Trigger?

Not full example, but let me explain you how it works in my setup.

There is a poller which watches the changes in the source code:
poller = BzrPoller("lp:~percona-dev/percona-patches/" + mysql_version,
        poll_interval = 60*60,
        branch_name = mysql_version)


There is a defined scheduler. It starts the builder "bldr_main" when
the change in the source code happens:
main_scheduler = scheduler.Scheduler(name="main_scheduler",
                builderNames=["bldr_main"],
                branch=mysql_version,
                treeStableTimer=60,
                properties={'mysql_version': mysql_version,
                        'patchset': patchset})


The builder "bldr_main" starts triggerable schedulers, one by one:
bldr_main = {'name': "bldr_main",
      'slavename': "CentOS-5-x86-64",
      'builddir': "bldr_main",
      'factory': f_main,
     }

The builder uses factory f_main:
f_main = factory.BuildFactory()
f_main.addStep(trigger.Trigger(schedulerNames=["schdl_CentOS_5"],
waitForFinish=True))
f_main.addStep(trigger.Trigger(schedulerNames=["schdl_Debian"],
waitForFinish=True))
f_main.addStep(trigger.Trigger(schedulerNames=["schdl_OpenSolaris"],
waitForFinish=True))
f_main.addStep(trigger.Trigger(schedulerNames=["schdl_FreeBSD"],
waitForFinish=True))

The scheduler "schdl_CentOS_5" and others are triggerable:
schdl_CentOS_5 = scheduler.Triggerable(name="schdl_CentOS_5",
                     builderNames=[
        "CentOS_5_x86_64",
        "CentOS_5_i386"
        ])
schdl_Debian = scheduler.Triggerable(name="schdl_Debian",
                     builderNames=[
        "Debian_lenny_amd64",
        "Debian_lenny_i386",
        "Debian_etch_amd64",
        "Debian_etch_i386"
        ])

Builders like "CentOS_5_x86_64" do actual work:
CentOS_5_x86_64 = {'name': "CentOS_5_x86_64",
      'slavename': "CentOS-5-x86-64",
      'builddir': "CentOS_5_x86_64",
      'factory': f_make,
      'env': {'CC': 'gcc', 'CXX': 'gcc',
        'mysql_version': mysql_version,
        'patchset': patchset}
      }

The factory f_make:
f_make = factory.BuildFactory()
f_make.addStep(Bzr(baseURL="lp:~percona-dev/percona-patches/"))
f_make.addStep(SetProperty(command="echo $mysql_version",
property="mysql_version"))
f_make.addStep(SetProperty(command="echo $patchset", property="patchset"))
f_make.addStep(ShellCommand(description= "Patch MySQL",
        command=["bash", "-c", WithProperties("\
cd .. && \
rm -rf mysql-%(mysql_version)s ; \
tar zxf mysql-%(mysql_version)s.tar.gz ; \
cd mysql-%(mysql_version)s ; \
for p in `cat ../build/series`; \
        do patch -p1 < ../build/$p; \
done\
")], haltOnFailure = 1))
f_make.addStep(ShellCommand(description= "Configure MySQL",
        command=["bash", "-c", WithProperties("\
cd ../mysql-%(mysql_version)s ; \
./configure " + configure_options + " \
")], haltOnFailure = 1))
f_make.addStep(ShellCommand(description= "Compile MySQL",
        command=["bash", "-c", WithProperties("\
cd ../mysql-%(mysql_version)s ; \
MAKE_CMD=make ; \
if [ \"`uname -s`\" = \"FreeBSD\" ] ; then MAKE_CMD=gmake; fi ; \
$MAKE_CMD clean all ; \
")], haltOnFailure = 1))


Hope this helps.

Reagrds,
Aleks
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iEYEARECAAYFAkuV1P0ACgkQQ6p+ZxjCGwVRRgCeIy2p+m2lCVroIqLZ/+XvIkBV
L/8AniTadXrFU7f2wn1WZe1L4uXRC9tx
=g7yQ
-----END PGP SIGNATURE-----





More information about the devel mailing list