Fwd: git-daemon access-hook race condition
- From
- Eugene Sajine <euguess@gmail.com>
- Date
- Sep 12, 2013, 18:51 UTC
- Message-ID
- <CAPZPVFbJqbRGQZ+m3-EfahcYegPvVcS-jNTsCXxBqWUsLqyHkg@mail.gmail.com>
- In-Reply-To
- <CAPZPVFa=gqJ26iA6eQ1B6pcbTcQmmnXHYz6OQLtMORnAa5ec2w@mail.gmail.com>
Hi,
We are serving repos in closed netwrok via git protocol. We are using git-daemon access hook (thank you very much for such a great feature) in order to create push notifications for Jenkins. I.e. upon the push the access-hook is called and then the curl command is created and executed. As we have several instances of Jenkins, that we need to notify (three), the execution of the access-hook can take some time.
Sometimes we have a situation when the whole chain works fine but Jenkins git plugin doesn't recognize the changes. I think it happens because we hit a kind of race condition:
1. Incoming push triggers access-hook 2. notify jenkins 1 3. notify jenkins 2 4. jenkins 1 polls repo but sees no changes 5. notify Jenkins 3 6. the push data transfer finishes - consequent pushes will find changes w/o any problem
The question is:
Is there a way to avoid that? Is it possible to have access-hook to be executed after receive? Is it possible to introduce a parameter that would specify if it needs to be executed before receive or after?
Thanks, Eugene