[ 
https://issues.jenkins-ci.org/browse/JENKINS-13717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=162669#comment-162669
 ] 

Gonzalo Sainz-Trapaga edited comment on JENKINS-13717 at 5/11/12 5:12 AM:
--------------------------------------------------------------------------

Posted trivial patch to correct this behaviour. All it does is stripping the 
{{user:pass@}} or {{user@}} part out of the repository URL before matching 
against the URL in the API request. Therefore posting to {{notifyCommit}} with 
an {{https://server/repo/address}} should trigger a poll on a mercurial repo 
with an {{https://user:pass@server/repo/address}} as well.

Another possibly good change is swapping the line that says:
{{if (url.equals(repository)) urlFound = true; else continue;}}

With:
{{if (repository.startswith(url) urlFound = true; else continue;}}

This would allow for a single API call to {{<jenkins 
root>/mercurial/notifyCommit?url=http://server/}} to trigger a poll on all 
repos on that server, or to specific repository groups located at 
{{http://server/group1/...}}. Good on tools like Rhodecode that only allow you 
to define system-wide hooks, not repo-specific ones.

I tested the regex in the patch above and it does what it's supposed to, but I 
don't have a build system to actually test this out.
                
      was (Author: gomox):
    Trivial patch to correct this behaviour.
                  
> Mercurial URL hook for triggering polling doesn't work with user/pass set in 
> the repository URL
> -----------------------------------------------------------------------------------------------
>
>                 Key: JENKINS-13717
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13717
>             Project: Jenkins
>          Issue Type: Bug
>          Components: mercurial
>    Affects Versions: current
>            Reporter: Gonzalo Sainz-Trapaga
>            Assignee: Kohsuke Kawaguchi
>         Attachments: strip-credentials.patch
>
>
> This is basically the equivalent of JENKINS-13410 for the Mercurial plugin.
> If I set the repo URL to something on the lines of 
> https://user:pass@url/repo, if I use the notifyCommit hook provided since 
> 1.38 I get a "No mercurial jobs found" message from the server.
> Command line is:
> $ curl https://jenkins/mercurial/notifyCommit?url=https://user:pass@url/repo 
> (copy pasted from the actual URL in the job setup)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to