Search code examples
buildbot

Buildbot fails on reset --hard


Buildbot 0.8.6

Periodically the buildbot would fail getting a particular repository. It does this command:

argv: ['/usr/bin/git', 'reset', '--hard', '26d7a2f5af4b777b074ac47a7218fe775d039845']

and then complains:

fatal: Could not parse object '26d7a2f5af4b777b074ac47a7218fe775d039845'.

However, the correct command is actually:

argv: ['/usr/bin/git', 'reset', '--hard', 'FETCH_HEAD']

Not only that. The SHA number used in the failed command is from a different repository.

Anyone knows how to fix this?

Thanks so much.


Update:

We have two repositories. We have a GitPoller watching one of the repositories. I would like to have a build run if the watched repository had a push. However, both repositories are needed for the build. The error specified above occurs on the second, non-watched repository. The SHA number in the error is from the watched repository.


Solution

  • Ok, first, let's make sure we have the right understanding:

    • You're having problem with one builder, that builds 2 repositories
    • Each build has two git steps which clone two different repositories
    • You're polling one of these repositories to trigger builds
    • There is no other scheduler that is triggering builds (or at least not those that fail that way)

    What happens when you're polling a repository to trigger builds is that each new build carries with it the changes that triggered it. The git steps refer to these changes to checkout the correct version. You probably need to use codebases to help the two steps distinguish between changes. Unfortunately, codebases were introduced in 0.8.7, so you should consider upgrading. 0.8.6 is ancient.

    If upgrading is not an option, pass alwaysUseLatest=True to the Git() step of the repository that you are not polling. That will force it to always use FETCH_HEAD. Here's my shot at that setup:

    f = BuildFactory()
    f.addStep(Git(repourl='git://github.com/you/polled_repo.git', mode='copy'))
    f.addStep(Git(repourl='git://github.com/you/other_repo.git', alwaysUseLatest=True))