lab132 / buildbot-gitea

Buildbot plugin for integration with gitea.
MIT License
62 stars 21 forks source link

GiteaStatusPush reporter not working #11

Closed mrstanwell closed 3 years ago

mrstanwell commented 3 years ago

I've been using the webhook part of the plugin for quite some time, and now I'm trying to get the reporter to work but having no success. Gitea is sending hooks on pushes and pull requests, and buildbot is responding and kicking off builds. However, it doesn't look like the reporter callbacks are ever firing... There are no API calls visible in the gitea log, and nothing in the buildbot logs either. I tried sticking in some tracer log messages of my own, and while I can verify that the GiteaStatusPush constructor is being called, none of my log messages in any of the callbacks is being printed. Do you have any suggestions as to where I should start looking? Many thanks in advance!

Here are my stats: Python version: 3.6.9 Buildbot version: 2.8.4 Twisted version: 19.10.0 buildbot-gitea version: 1.2.3 gitea version: 1.12.5

redacted relevant excerpts of master.cfg:

dummy_repo = 'ssh://gitea@git.redacted/redacted/dummy.git'
dummy_factory = util.BuildFactory()
dummy_factory.addStep(steps.Gitea(
     name="src update",
     repourl=dummy_repo,
     branch=util.Property('branch'),
     mode='full',
     method='clobber',
     shallow=True))
...
c['services'].extend(reporters.GiteaStatusPush(
     'https://git.redacted',
     token=util.Secret('giteabuildbot'),
     verbose=True))
pampersrocker commented 3 years ago

I think you need to use codebases for this to work. I have the following in my config file:

all_repositories = {
    u'ssh://git@git.example.com/owner/ExampleRepo1.git': 'ExampleCodebase1',
    u'ssh://git@git.example.com/owner/ExampleRepo2.git': 'ExampleCodebase2',
    u'ssh://git@git.example.com/owner/ExampleRepo3.git': 'ExampleCodebase3',
}

def codebaseGenerator(chdict):
    return all_repositories.get(chdict['repository'])

c['codebaseGenerator'] = codebaseGenerator

and reference it in the source step:

checkout_step = steps.Gitea(
        repourl="ssh://git@git.example.com/owner/ExampleRepo3.git",
        mode='incremental',
        workdir="build",
        branch="master",
        codebase='ExampleCodebase3', # <<<<
        progress=True,
        logEnviron=False,
    )
mrstanwell commented 3 years ago

Oh, man. I set up proper codebases (which I'd been putting off for some time), but that still wasn't working. Then I noticed I was using extend instead of append to add the reporter to c['services']. It was a bad copy/paste. The good news: reporter is working. The bad news: I am filled with shame.