Uploaded image for project: 'Bamboo'
  1. Bamboo
  2. BAM-20646

Mercurial remote trigger on Windows Bamboo host fails with HTTPS in Bamboo's URL used for postCommitBuildTrigger.py

    XMLWordPrintable

    Details

      Description

      Issue Summary

      Environment

      Bamboo version 6.8.1 with Mercurial 4.2.1 running on a Windows Bamboo host.

      Steps to Reproduce

      1. Add a Mercurial repository to a Bamboo build plan, either as a Linked repository or plan internally.
      2. Configure this build plan's "Remote trigger" to use the Mercurial repository just by following Repository triggers the build when changes are committed and thus prepare it by copying the SVN postCommitBuildTrigger.py script into your local repository folder and there edit .hg/hgrc adding adding the [hooks]section.
      3. For the postCommitBuildTrigger script use your Bamboo URL with HTTPS protocol.
      4. Now modify at least one of the repository files and then hg add plus hg commit the change.

      Expected Results

      The build should automatically be triggered.

      Actual Results

      Build is mostly not triggered (sporadically tiggering appears to work).

      The Bamboo logs show no errors related to this, however the postCommitBuildTrigger.py script indicates the below (or similar messages) when failing:

      remote: Traceback (most recent call last):
      remote: File "E:\Repositories\postCommitBuildTrigger.py", line 13, in <module>
      remote: fileHandle = urllib.urlopen(remoteCall, proxies=proxies)
      remote: File "E:\Mercurial\Python27\lib\urllib.py", line 87, in urlopen
      remote: return opener.open(url)
      remote: File "E:\Mercurial\Python27\lib\urllib.py", line 208, in open
      remote: return getattr(self, name)(url)
      remote: File "E:\Mercurial\Python27\lib\urllib.py", line 444, in open_https
      remote: 'got a bad status line', None)
      remote: IOError: ('http protocol error', 0, 'got a bad status line', None)
      remote: warning: changegroup.update hook exited with status 1
      

      Notes

      From the Python errors showing up, it seems like the issue is triggered by HTTPS used for Python lib urllib (Mercurial for Windows comes with a Python built-in and thus a PY script needs to be used for postCommitBuildTrigger).

      The affected Mercurial version uses Python 2.7. From Mercurial 5.0 and higher Python 3 is bundled.

      Workaround

      1. Use HTTP instead of HTTPS as Bamboo URL for the postCommitBuildTrigger Python script ( note that you need to potentially first adapt your Connector settings in server.xml so that the default 8085 Connector exists). This workaround made the HG trigger function.
      2. Potentially a Mercurial upgrade to 5.x might do the trick (also see Note above).
      3. Another chance could be to tune the postCommitBuildTrigger script trying to pass by the found Python 2.7 / urllib issue (some WEB posts point to that).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            gforster@atlassian.com Gerhard Forster (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: