Opened 7 years ago

#2800 new enhancement

build is not triggered for new branches on gitlab

Reported by: qsorix Owned by:
Priority: minor Milestone: undecided
Version: 0.8.8 Keywords:
Cc:

Description

This may not be a bug on buildbot, perhaps the proper fix should be done on gitlab.

I've noticed that when I create a new branch on gitlab, the notification from web-hook does not include any commits, so no changes are generated and hence no builds happen.

I've worked around the problem by modifying gitlab's hook. I've pasted the code previously imported from github's hook -- this is bad, but I don't know github's behaviour in this case -- and added some lines to fake a change on new branches.

I'm reporting it, in case someone else finds it useful. Perhaps someone will have enough time to create proper patch and integrate it.

        elif re.match(r"^0*$", oldrev):
            log.msg("Branch `%s' created, faking commit" % branch)
            # new branch notifications has no commits, fake one to trigger build
            change = {
                'author': user,
                'files': [],
                'comments': 'Branch %s created' % branch,
                'revision': newrev,
                'when_timestamp': datetime.datetime.utcnow(),
                'branch': branch,
                'revlink': '',
                'repository': repo_url,
                'project': project
            }
            changes.append(change)

Attachments (1)

gitlab.py (4.4 KB) - added by qsorix 7 years ago.
Updated gitlab hook that triggers builds for new branches

Download all attachments as: .zip

Change History (1)

Changed 7 years ago by qsorix

Updated gitlab hook that triggers builds for new branches

Note: See TracTickets for help on using tickets.