s

Buildbot how to auto compile multi git projects


1 Description

Note: this guide has been verified on Buildbot 0.9.7.

My targets:

  • monitor two git repositories A and B
  • Any commit will trigger the Nightly compile job, commit to A will compile A,
    commit to B will compile B

2 Current Issue

When there are commits in A and B repositories, only A builder can
do the pull && compile job for A repository, the B builder will failed on
the pull B repository step.

my key configs on `master.cfg' as below:

c['change_source'] = []
c['change_source'].append(changes.GitPoller(
    repourl='git@192.168.1.21:HO/ap1.git',
    workdir='gitpoller-workdir',
    branches=['master'],
    pollInterval=300))

c['change_source'].append(changes.GitPoller(
    repourl='git@192.168.1.21:HO/ap2.git',
    workdir='gitpoller-workdir',
    branches=['master'],
    pollInterval=300))

from buildbot.plugins import schedulers

os30_nightly = schedulers.Nightly(
    name = 'Nightly1',
    builderNames = ["runrobot_1"],
    branch='master',
    change_filter=util.ChangeFilter(branch='master'),
    onlyIfChanged=True,
    hour = 23,
    minute = 35)

homeap_nightly = schedulers.Nightly(
    name = 'Nightly2',
    builderNames = ["runrobot_2"],
    branch='master',
    change_filter=util.ChangeFilter(branch='master'),
    onlyIfChanged=True,
    hour = 23,
    minute = 50)

The error info as below:

fatal: could not parse object 'f938c434fa08514bc8d22fbdde4e37205f59d2ed'

2.1 analysis

the SHA1 code in the error log only exist in repository A! That's why B builder
failed on the pull step.

3 fix

By using the `project' parameter can we fix the issue.

The `project' parameter definition:

project:
Set the name of the project to be used for the GitPoller.
This will then be set in any changes generated by the GitPoller,
and can be used in a Change Filter for triggering particular builders.

change the key configs in `master.cfg' as below can fix this issue.

c['change_source'] = []
c['change_source'].append(changes.GitPoller(
    repourl='git@192.168.1.21:HO/ap1.git',
    workdir='gitpoller-workdir',
    branches=['master'],
    project='prj_1',
    pollInterval=300))

c['change_source'].append(changes.GitPoller(
    repourl='git@192.168.1.21:HO/ap2.git',
    workdir='gitpoller-workdir',
    branches=['master'],
    project='prj_2',
    pollInterval=300))

from buildbot.plugins import schedulers

os30_nightly = schedulers.Nightly(
    name = 'Nightly1',
    builderNames = ["runrobot_1"],
    branch='master',
    change_filter=util.ChangeFilter(project='prj_1', branch='master'),
    onlyIfChanged=True,
    hour = 23,
    minute = 35)

homeap_nightly = schedulers.Nightly(
    name = 'Nightly2',
    builderNames = ["runrobot_2"],
    branch='master',
    change_filter=util.ChangeFilter(project='prj_2', branch='master'),
    onlyIfChanged=True,
    hour = 23,
    minute = 50)