[users at bb.net] Looking for help on creating Mercurial repo change hook with Buildbot

Alvaro Erickson aerickson at xkl.com
Tue Apr 18 23:33:29 UTC 2017


Hi Louis,

Thanks again for your help, I apprecaite it. Unfortunately, I am still 
not having much luck with the Mercurial hook. Now, here is the error I 
see from the hg push -v --debug (from Mercurial's debug output):

loading changegroup.buildbot hook failed:
abort: cannot import name newbytes!

Now, I looked at the hgbuildbot.py code and I didn't see any mention of 
newbytes. I tried doing research about the Python newbytes, but the only 
relevant site I could find was about the future.utils module:

http://python-future.org/_modules/future/utils.html

And I tried importing the future.utils. Also, I tried doing a:

from future.types import newbytes

But, none of them fixed the error.

Do you have any other ideas or advice for me?

Regards,

Alvaro

On 04/17/2017 08:26 PM, Louis Opter wrote:
> The strip and baseurl parameters are irrelevant here.
>
> One more thing coming to my mind: the hook has to be configured on the
> destination repo not on the source repo, is this what you did?
>
> And have you tried getting more info from Mercurial's debug output? (hg
> -v --debug).
>
> Otherwise I don’t see why it wouldn’t work, I personally push over ssh,
> but I don’t think that’s relevant either.
>
>> On Apr 17, 2017, at 4:50 PM, Alvaro Erickson <aerickson at xkl.com
>> <mailto:aerickson at xkl.com>> wrote:
>>
>> Hi Louis,
>>
>> Thank you again for the help, unfortunately I have not any luck using
>> the changes you suggested. Here is what I tried:
>>
>> 1) In my hgrc, I changed the venv parameter to point to the Buildbot's
>> virtual environment as you suggested
>> 2) I moved the hgbuildbot.py to the site-packages directory (as seen
>> below in a portion of my hgrc)
>> 3) In my hgrc, I updated the changegroup.buildbot parameter to match
>> the same format as yours (as you suggested and as seen below in a
>> portion of my hgrc)
>> 4) I tried using the project and branch parameters to no effect too
>> 4) Note: I am testing on two local repos to trigger the change hook.
>> One I commit too. The other I do sample pushes too from the first
>> local one. So, I don't know if this is why I'm not seeing any of the
>> change hook being triggered
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> [hooks]
>> changegroup.buildbot =
>> python:/srv/home/.virtualenv/lib/python2.7/site-packages/hgbuildbot.py:hook
>>
>> [hgbuildbot]
>> venv = /srv/home/.virtualenv
>> master = http://<ip address of Buildbot>:8020/change_hook/base
>> codebase = my_local_repo
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Should I try using strip and baseurl parameters next?
>>
>> On 04/15/2017 05:51 PM, Louis Opter wrote:
>>> Hello Pierre, hello Alvaro,
>>>
>>> Sorry for the slow response time, here is an excerpt from one of my hgrc
>>> where I’ve setup the buildbot hook:
>>>
>>> ----8<----
>>>
>>> [hooks]
>>> changegroup.buildbot =
>>> python:/stash/envs/mercurial/lib/python2.7/site-packages/hgbuildbot.py:hook
>>>
>>> [hgbuildbot]
>>> venv = /stash/envs/mercurial
>>> master = http://<some_internal_ip>:8020/change_hook/base
>>> codebase = lightsd
>>> strip = 5
>>> baseurl = https://hg.kalessin.fr/
>>>
>>> ---->8----
>>>
>>> One thing I can notice is how my value for venv points to the virtualenv
>>> rather than Python’s site-packages. On a second look I can also see that
>>> we’ve set-up changegroup.buildbot differently.
>>>
>>> Have you tried to bump Mercurial’s verbosity too? It might be helpful to
>>> debug what’s going on.
>>>
>>> Let me know if that helps!
>>>
>>>> On Apr 13, 2017, at 1:57 PM, Pierre Tardy <tardyp at gmail.com
>>>> <mailto:tardyp at gmail.com>
>>>> <mailto:tardyp at gmail.com>> wrote:
>>>>
>>>> Hi Alvaro,
>>>>
>>>> This looks more like a problem for a Mercurial expert.
>>>> I am adding Louis here, who is the latest contributor on hgbuildbot
>>>> Perhaps he will have more ideas
>>>>
>>>> On Thu, Apr 13, 2017 at 10:51 PM Alvaro Erickson <aerickson at xkl.com
>>>> <mailto:aerickson at xkl.com>
>>>> <mailto:aerickson at xkl.com>> wrote:
>>>>
>>>>    Hi Pierre and all,
>>>>
>>>>    So, I was able to get the base change hook enabled. And verified it
>>>>    using the post_build_request.py which I found in the following
>>>>    directory:
>>>>
>>>>    master/contrib/
>>>>
>>>>    Unfortunately, when I try to setup the change hook for a Mercurial
>>>>    repository, nothing is sent to Buildbot. And I see no record of the
>>>>    change hook in the Buildbot's twisted.log.
>>>>
>>>>    Following the directions and documentation in the following:
>>>>
>>>>    * In the Buildbot manual about how to setup a Mercurial Change hook:
>>>>    http://docs.buildbot.net/current/manual/cfg-wwwhooks.html
>>>>
>>>>    * Also, using the inline documentation in the post_build_request.py
>>>>
>>>>    I did the following:
>>>>
>>>>    1) Copied the post_build_request.py into the .hg folder of the repo I
>>>>    wanted to notify Buildbot of any changes
>>>>
>>>>    2) Modified the repo's hgrc by adding the following to it:
>>>>
>>>>    [hooks]
>>>>    changegroup.buildbot = python:.hg/hgbuildbot.py:hook
>>>>
>>>>    [hgbuildbot]
>>>>    venv = /srv/home/.virtualenv/lib/python2.7/site-packages
>>>>    master = http://<ip address of Buildbot>:8020/change_hook/base
>>>>    branch = default
>>>>    project = my-project-name
>>>>
>>>>    Note: I tried removing the 'branch' and 'project' parameters to no
>>>>    effect. Also, I tried setting the master to the following by removing
>>>>    the "http://":
>>>>
>>>>    master = <ip address of Buildbot>:8020/change_hook/base
>>>>
>>>>    3) Ensured that hgbuilder.py had the executable permission.
>>>>
>>>>    And nothing got to Buildbot as far as I could tell when I:
>>>>
>>>>    a) Did a commit of a change
>>>>
>>>>    b) Then a push of the change
>>>>
>>>>    Any help or advice would be appreciated.
>>>>
>>>>    On 04/11/2017 04:39 PM, Alvaro Erickson wrote:
>>>>    > Hi Pierre,
>>>>    >
>>>>    > Apologies for not replying earlier, thanks for the help and
>>>>    advice on
>>>>    > modifying the c['www']. I found the second line where it was being
>>>>    > modified. And I added the change_hook_dialects line there.
>>>>
>>>>    > On 04/08/2017 02:26 AM, Pierre Tardy wrote:
>>>>    >>
>>>>    >>
>>>>    >> On Fri, Apr 7, 2017 at 6:58 PM Alvaro Erickson
>>>>    <aerickson at xkl.com
>>>> <mailto:aerickson at xkl.com> <mailto:aerickson at xkl.com>
>>>>    >> <mailto:aerickson at xkl.com <mailto:aerickson at xkl.com>>> wrote:
>>>>    >>
>>>>    >>     Greetings,
>>>>    >>
>>>>    >>     I am using Buildbot version 0.9.1.
>>>>    >>
>>>>    >> Please upgrade. There has been a lot of important fixes since
>>>>    0.9.1 (not
>>>>    >> that I know for your specific problem, though)
>>>>    >>
>>>>    >>
>>>>    >>     And I am trying to use a Mercurial
>>>>    >>     change hook to notify Buildbot of when there is a change in a
>>>>    >> Mercurial
>>>>    >>     meta repository. So, I followed what is written in the
>>>> Buildbot
>>>>    >> manual
>>>>    >>     for change hooks (URL:
>>>>    >>     http://docs.buildbot.net/current/manual/cfg-wwwhooks.html)
>>>>    and the
>>>>    >> help
>>>>    >>     documentation in the hgbuildbot.py script documentation.
>>>>    And here are
>>>>    >>     the steps I performed for setting up the change hook (Note:
>>>>    I changed
>>>>    >>     the IP address info to protect my project):
>>>>    >>
>>>>    >>     1. Enabling the base dialect in Buildbot's master.cfg by
>>>>    adding the
>>>>    >>     following code:
>>>>    >>
>>>>    >>     c['www'] = dict(change_hook_dialects={'base': True})
>>>>    >>
>>>>    >>
>>>>    >> Don't you have another line in your master.cfg which configures
>>>>    c['www']?
>>>>    >> This would explain 'base' is not configured messages.
>
> --
> Louis Opter
>



The information contained in this e-mail message may be privileged, confidential and protected from disclosure.
 If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited.
 If you think that you have received this e-mail message in error, please e-mail the sender at the above e-mail address.



More information about the users mailing list