Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-18252

Push notifications on Windows and a local repository

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: mercurial-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2003
    • Similar Issues:

      Description

      Push notifications do not work well with a Windows server accessing the repo as a local directory.

      It looks like the issue is that, doNotifyCommit in MercurialStatus creates a URL out of the passed in Repo location string. This creates limitations that are not present when the Repository URL is passed into hg.

      Additionally, the string passed into the push notification is processed as a URL when it goes through the web server, then it is processed again in the plugin. As a result, I had to double escape some characters.

      Here is an example:
      The URL I originally had in the settings: E:\Repo\Track App.hg
      The job accesses the repo and updates the working directory properly.

      If I access http://myjenkins:8080/mercurial/notifyCommit?url=E:\RepoApps\Repo\Track App.hg
      I get an illegal character exception.

      I can get it to accept it if I double escape the illegal characters.
      http://myjenkins:8080/mercurial/notifyCommit?url=E:%255CRepoApps%255CRepo%255CTrack%2520App.hg

      This doesn't work because, when looking for a relevant job, it fails on this comparison:
      E:%5CRepoApps%5CRepo%5CTrack%20App.hg == E:\RepoApps\Repo\Track App.hg

      It needs both the URL in the settings to be escaped in the same way as the one passed into the web API. I can't find a way to do this with a local directory.

      This also may not work because it seems to process the string in the settings page as a URL as well, so this may fail with illegal characters.

      The double processing of the string in the API would be OK if it then compared a fully escaped string to the string in the settings page (without trying to escape the settings string as well). I would be able to construct an API call that would make it through processing and match correctly.

      I found a convoluted way to get this to work with the current design. It needs a network share instead of a local directory.
      The URL in settings looks like this:
      file:%5C%5CSERVER%5CRepo%5CTrack%20App.hg
      And the API call:
      http://myjenkins:8080/mercurial/notifyCommit?url=file:%255C%255CSERVER%255CRepo%255CTrack%2520App.hg

      This work-around has one final problem. The convoluted URL in the settings does not match the one hg adds to hgrc. This causes the repo to be cloned for every build. I was able to work around this by manually updating the hgrc file in the workspace with the expected string.

      After all this tweaking, it seems to work OK.

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -
          Show
          jglick Jesse Glick added a comment - @zkhan did you try file://MACHINE_NAME/path/to/repo/ ?
          Hide
          zkhan Zamir Khan added a comment -

          @jglick I should have clarified, but what I meant by Mercurial not accepting file URLs for non-local, is you'll get a message like this from hg: "abort: file:// URLs can only refer to localhost"

          Show
          zkhan Zamir Khan added a comment - @jglick I should have clarified, but what I meant by Mercurial not accepting file URLs for non-local, is you'll get a message like this from hg: "abort: file:// URLs can only refer to localhost"
          Hide
          jglick Jesse Glick added a comment -

          I see. A bug in Mercurial. Pity.

          Show
          jglick Jesse Glick added a comment - I see. A bug in Mercurial. Pity.
          Hide
          djasek Dan Jasek added a comment -

          @zkhan As a workaround, mapping the remote directory to a local drive letter may fix your issue.

          Show
          djasek Dan Jasek added a comment - @zkhan As a workaround, mapping the remote directory to a local drive letter may fix your issue.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/plugins/mercurial/HgExe.java
          src/main/java/hudson/plugins/mercurial/MercurialStatus.java
          src/test/java/hudson/plugins/mercurial/HgExeTest.java
          src/test/java/hudson/plugins/mercurial/MercurialStatusTest.java
          http://jenkins-ci.org/commit/mercurial-plugin/9d41ba0b7ad66b6ddefd87711195c0c3e7843124
          Log:
          Merge pull request #41 from thomedw/path-equal

          [FIXED JENKINS-18252] Added ability to recognize non-URL file paths in /notifyCommit

          Compare: https://github.com/jenkinsci/mercurial-plugin/compare/fc8a1a73b312...9d41ba0b7ad6

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/mercurial/HgExe.java src/main/java/hudson/plugins/mercurial/MercurialStatus.java src/test/java/hudson/plugins/mercurial/HgExeTest.java src/test/java/hudson/plugins/mercurial/MercurialStatusTest.java http://jenkins-ci.org/commit/mercurial-plugin/9d41ba0b7ad66b6ddefd87711195c0c3e7843124 Log: Merge pull request #41 from thomedw/path-equal [FIXED JENKINS-18252] Added ability to recognize non-URL file paths in /notifyCommit Compare: https://github.com/jenkinsci/mercurial-plugin/compare/fc8a1a73b312...9d41ba0b7ad6

            People

            • Assignee:
              jglick Jesse Glick
              Reporter:
              djasek Dan Jasek
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: