Opened 13 years ago

Closed 10 years ago

#2 closed enhancement (fixed)

bzr_buildbot.py: bzr needs a BzrPoller

Reported by: warner Owned by: somebody
Priority: major Milestone:
Version: Keywords:
Cc: ijon

Description

we don't yet have a way to generate Changes from bzr. We need to find out how to write commit scripts for a bazaar repository and then implement one.

Attachments (2)

bzrpoller.py (3.0 KB) - added by warner 12 years ago.
removed the obvious MultiService? bug
bzrpoller-working.patch (2.4 KB) - added by ijon 12 years ago.
changes to get it work (in simplest scenario -- single branch)

Download all attachments as: .zip

Change History (12)

comment:1 Changed 13 years ago by warner

some useful links:

I think the path here is to create a Bzr plugin for buildbot, distributed with buildbot, and then provide instructions for enabling the plugin from within a Bzr repository.

comment:2 Changed 13 years ago by warner

  • component changed from website to changesources

comment:3 Changed 13 years ago by warner

some more notes:

~/.bazaar/locations.conf:
[/home/warner/full/path/to/tree]
post_commit = bzrlib.plugins.buildbot.sendchange
buildmaster = host.example.com:12345

post_commit is a space-separated list of fully-qualified function names. Each will be eval()ed in a way that calls sendchange(branch, revision_id).

~/.bazaar/plugins/buildbot.py:

def sendchange(branch, revision_id):
    pass

However, this hook doesn't seem to be triggered when I push a change in via something like bzr push sftp://host/home/warner/path/to/repo. I don't know if push triggers commit or not.

comment:4 Changed 13 years ago by warner

  • Summary changed from bzr_buildbot.py: bzr needs a hook script to bzr_buildbot.py: bzr needs a BzrPoller

I spent some time chatting with <lifeless> on IRC today. Some things I learned:

  • most of the existing access schemes (file, sftp, http) do not run any code on the "master" host at all. Any post_commit hooks would be run on the client machine. This could be made to work, but you'd have to have buildbot and the hook plugin installed on all developers machines, which would be a nuisance.
  • the "Smart Server" that is under development now will make it much easier to run code like this on the central machine after each commit.
  • he recommends using 'import bzrlib' to get at things like 'bzr revno', rather than spawning 'bzr' as a shell command. He says they try hard to maintain API compatibility.

So I think we need to write a BzrPoller? first, and defer writing a hook script until after the "smart server" is implemented. The only thing we could implement now (using post_commit=) would be too much of a nuisance to deploy.

comment:5 Changed 12 years ago by warner

  • Milestone changed from 0.7.6 to 0.7.7

comment:6 Changed 12 years ago by warner

some comments from an IRC chat a few weeks (months?) ago:

<spiv> warner: that seems ok, but I think you can make the common case of no
new revisions faster by first checking b.last_revision() [01:41]
<spiv> warner: and really you want to use revision ids rather than revnos, in
case someone e.g. did an uncommit.
<spiv> warner: also, if you do b.lock_read()/b.unlock() around the whole
thing, it should be a little faster because it will be able to cache some
things. [01:42]
<spiv> warner: also "# NOTE: b.revision_history() does network IO, and is
blocking." is a strange comment, given that that's true of the previous line
too, but you didn't comment it :)
<spiv> (and of the line before)>
<spiv> warner: "# branch= ?"... that's just self.location. [01:51]
<spiv> warner: "# revision= ?"... either the revno or the revision ID,
whichever you prefer. [01:52]
<spiv> warner: No other comments spring to mind... if you have specific
questions, let me know.
<lifeless> whats revision_history ised for? [01:59]
<lifeless> if its to get the revno, use get_revision_info, its cheaper
<spiv> lifeless: it's to get the all the new revisions since the last poll
<lifeless> isn't that update ? :)
<spiv> Presumably so that it can send updates or whatever about them.
<spiv> Well, I assume the buildmaster doesn't actually need or want to have an
actual checkout or branch.
<spiv> warner: please feel free to chime in here :)
<lifeless> if its just caching metadata about where the branch got to; sure.
                                                                        [02:03]

Changed 12 years ago by warner

removed the obvious MultiService? bug

comment:7 Changed 12 years ago by warner

  • Milestone changed from 0.7.7 to 0.7.8

not making enough progress on this one, bumping it to 0.7.8

Changed 12 years ago by ijon

changes to get it work (in simplest scenario -- single branch)

comment:8 Changed 12 years ago by ijon

  • Cc ijon added

comment:9 Changed 11 years ago by dustin

  • Milestone changed from 0.8.0 to 0.7.+

Any thoughts on this? Since it's going into contrib/, I'm happy to use it if someone says "yeah, it works".

comment:10 Changed 10 years ago by krajaratnam

  • Milestone 0.8.+ deleted
  • Resolution set to fixed
  • Status changed from new to closed

The BzrPoller? went into contrib/ in commit 0da76648effcfbf8e82100b349871b992f02216e and Dustin recently created #708 to promote BzrPoller? to first class citizen, so I'll go ahead and close this ticket.

Note: See TracTickets for help on using tickets.