Pergunta

I have a gitPoller set up to run, every 60 seconds, but would rather use the post-commit hook. I am confused on how to accomplish this. I know that I'm supposed to copy the git_buildbot.py file somewhere, but am not sure exactly where.
Also, I don't know what to write for the post-receive file under git hooks.

Foi útil?

Solução

Assuming that you have your base Git repository (on your Git server) at /var/git/yourproject, then you would install the git_buildbot.py file in /var/git/yourproject/hooks. Once you place the (correctly edited) git_buildbot.py file into that directory, you should chmod 755 git_buildbot.py to make sure that it's executable (assuming that your Git server is some flavor of Unix/Linux.)

Once you have done that and tested it, you should probably turn off the gitPoller on your CI server.

Outras dicas

@Tlu: Just for the protocol: I had the same issue and at last I caught myself at installing a client side git hook (in /home/myself/project/.git/hooks like mentioned in in this tutorial ) instead of a server side git hook (which has to lie in somewhere like /srv/git/project/hooks).

So I just accidentally missed to use the right folder because in my buildbot setup both directories where on the same machine and maybe that one bad drink in the bar yesterday ;)

Just a stupid mistake but in case someone runs into the same trap I wanted to let you know.

You could use Buildbot's Change Hooks for this.

Add the poller hook to the www settings in your master.cfg file:

c['www'] = {
    # ...
    'change_hook_dialects': {
        'poller': True,
    },
    # ...
}

Suppose your Git repository is set up in Buildbot like this:

GitPoller(repourl='/path/to/my-project.git',
          project='my-project',
          pollInterval=3600,
          pollAtLaunch=True)

If your Buildbot URL is http://localhost:8010/, then your post-commit hook (.git/hooks/post-commit) can be:

#!/bin/bash

curl -s -F poller="$(pwd)" http://localhost:8010/change_hook/poller

(Make sure that the script is executable: chmod +x post-commit).

This will notify Buildbot to poll the repository immediately after you commit. The script above is also usable as a post-receive hook.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top