Bug 424773 - Hudson couldn't parse URI
Summary: Hudson couldn't parse URI
Status: ASSIGNED
Alias: None
Product: Hudson
Classification: Technology
Component: GIT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 8
: P3 critical with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Winston Prakash CLA
QA Contact:
URL:
Whiteboard: candidate-3.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-31 04:29 EST by Konrad Zielinski CLA
Modified: 2014-02-11 09:42 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konrad Zielinski CLA 2013-12-31 04:29:14 EST
Console output:

"Cleaning workspace
ERROR: Could not parse the URI. Exiting ...
java.net.URISyntaxException: Illegal character in scheme name at index 3: git@mydomain.com:namespace/project.git
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parse(URI.java:3029)
at hudson.plugins.git.GitAPI.fixSubmoduleUrls(GitAPI.java:586)
at hudson.plugins.git.GitAPI.setupSubmoduleUrls(GitAPI.java:689)
at hudson.plugins.git.GitSCM.fetchSubmodulesFrom(GitSCM.java:1723)"

Hudson 3.1.0
GitLab 6.3.0
Hudson GIT plugin 2.2.5
git 1.8.4.1

Console returns error while repository address contains 'at' @ character.
Comment 1 Konrad Zielinski CLA 2013-12-31 06:40:15 EST
Repository have submodule linked by https protocol
Comment 2 Konrad Zielinski CLA 2013-12-31 09:56:05 EST
http://www.eclipse.org/forums/index.php/t/632471/
Comment 3 James Barwick CLA 2014-02-07 06:07:57 EST
I can't even check out top level module (and there are .gitmodules)

The URL is:

ssh://git@bitbucket.org:user/project.git

This fails.

Even changing it to

ssh://git@bitbucket.org/group/project.git

as is indicated in the help/examples throws the same error

the submodule in .gitmodules is

[submodule "project_module"]
    path = project_module
    url = git@bitbucket.org:user2/project_module.git

I don't think it gets this far.  I says in the log:

Started by user anonymous
Checkout:workspace / /var/lib/hudson/jobs/project_job/workspace - hudson.remoting.LocalChannel@718db56
Using strategy: Default
Checkout:workspace / /var/lib/hudson/jobs/project_job/workspace - hudson.remoting.LocalChannel@718db56
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://git@bitbucket.org/user/project.git
Commencing build of Revision fc40aafac7e7aec8e69488ef5c30e49fc4f6bb36 (origin/master)
Checking out Revision fc40aafac7e7aec8e69488ef5c30e49fc4f6bb36 (origin/master)
ERROR: Could not parse the URI. Exiting ...
java.net.URISyntaxException: Illegal character in scheme name at index 3: git@bitbucket.org:user/project.git
	at java.net.URI$Parser.fail(URI.java:2829)

This is a serious problem and basically I'm stuck in the water and blocked.

The only thing left for me to do is write a cron job to checkout the project and sync the modules in one folder, then configure hudson to clone from the local disk with simply referencing a folder as:

git config:   /home/user/myproject/.git

Then hudson will think this is a non-bare project and simply clone it.
Comment 4 James Barwick CLA 2014-02-07 06:20:37 EST
Sorry, this didn't work!!!

You cannot use ssh:// protocols with hudson I guess.  Kinda weird since git started as an ssh tool, then developed to http...

Now I will try http....but this will break my Bamboo as bamboo must use SSH.

frustrating.  I will settle on the CI tool soon...
Comment 5 Winston Prakash CLA 2014-02-07 11:16:22 EST
We were concentrating mostly on github based URLs. Bitbucket is getting traction. We will try to reproduce the issue and fix it soon.

Underneath, the git plugin uses java.net.URL, that relies on standard URL pattern. May be some manual parsing required.
Comment 6 Winston Prakash CLA 2014-02-07 11:18:13 EST
(In reply to James Barwick from comment #4)
You can use SSH protocol with Hudson git plugin as long as the the private key corresponding to the public key is on the same machine where the checkin happens
Comment 7 James Barwick CLA 2014-02-08 09:16:59 EST
(In reply to Winston Prakash from comment #6)
> (In reply to James Barwick from comment #4)
> You can use SSH protocol with Hudson git plugin as long as the the private
> key corresponding to the public key is on the same machine where the checkin
> happens

Well, no you can't.  I went through the process of 'not authenticating', then setting up the private keys, then 'successful authentication'.

So, in theory, yes you can use ssh URL.  Example, this does NOT work:

URL: git@bitbucket.org:group/project.git
URL: ssh://git@bitbucket.org:group/project.git

This DOES work

URL: ssh://git@bitbucket.org/group/project.git

Presumably because of the issue of Comment 5 relating to java URL class.

Ok.  So, let's get past the whole Java URL class thing...let's talk about 'valid git url's' (and perhaps URL's are not a proper usage for them).

In standard GIT syntax, the following will work just fine

bash# git clone git@bitbucket.org:group/project.git

So, in reality the Hudson plugin should work as well.  This is a valid git syntax line (albeit not really a URL)

So, in my example where 'it worked' only got me so far.  Because, at the git plugin parsed the .git/config settings and the .gitmodule file, it failed because you are forcing me to enter a Java URL, were the syntax or SSH really may not be a URL.

Example, at the the .gitmodule file the line:

url = ssh://git@bitbucket.org:group/project.git

this will cause /usr/bin/git submodule init  to FAIL.  also,

url = ssh://git@bitbucket.org/group/project.git

Still causes the command to FAIL

however

url = git@bitbucket.org:group/project.git

Works just fine in the .gitmodule file

Therefore, if the hudson plug-in is really trying to be 'GIT' compatible (forget about github vs bitbucket), the plug-in should comply with valid GIT URL syntax options.

So, I think those of us out there that are stuck with SSH requirements should not be excluded from using hudson.

IMHO, you should remove the "Java URL" object from the source code and simply let us pass in strings.  Don't try to validate the URL, let it succeed or fail based on what we type in.  (I haven't read the source, so I don't know how far-reaching this is).

Anyway, thanks for you attention.
Comment 8 Winston Prakash CLA 2014-02-10 12:39:49 EST
(In reply to James Barwick from comment #7)

From your comment #7 I gather the URL git@bitbucket.org:group/project.git  (doesn't work)



I just tried with URL both form github & bitbucket


git@github.com:hudson3-plugins/git-plugin.git, it seems to work fine



Started by user anonymous
Checkout:workspace / /Users/wjprakash/.hudson/jobs/test/workspace - hudson.remoting.LocalChannel@14a40e04
Using strategy: Default
Checkout:workspace / /Users/wjprakash/.hudson/jobs/test/workspace - hudson.remoting.LocalChannel@14a40e04
Cloning the remote Git repository
Cloning repository origin
Fetching upstream changes from git@github.com:hudson3-plugins/git-plugin.git
Commencing build of Revision 267286d8b13940cfccff09ec97eef32c8082b775 (origin/master)
Checking out Revision 267286d8b13940cfccff09ec97eef32c8082b775 (origin/master)
No change to record in branch origin/master
Finished: SUCCESS

git@bitbucket.org:edburns/hudson_lifestyle.git, this worked fine too though slow


Started by user anonymous
Checkout:workspace / /Users/wjprakash/.hudson/jobs/test/workspace - hudson.remoting.LocalChannel@14a40e04
Using strategy: Default
Last Built Revision: Revision 267286d8b13940cfccff09ec97eef32c8082b775 (origin/master)
Checkout:workspace / /Users/wjprakash/.hudson/jobs/test/workspace - hudson.remoting.LocalChannel@14a40e04
Fetching changes from the remote Git repository
Fetching upstream changes from git@bitbucket.org:edburns/hudson_lifestyle.git
Commencing build of Revision f8d42d3155ddc8b02665b394afc11ecd2e65385e (origin/master)
Checking out Revision f8d42d3155ddc8b02665b394afc11ecd2e65385e (origin/master)
Finished: SUCCESS

 
I can see that it is failing for you from your exception, I need to find the exact format that is failing before start fixing the issue.
Comment 9 James Barwick CLA 2014-02-11 09:42:23 EST

I have set my URL's to https:// and added my private passwords to bitbucket in the .netrc file (agggh!). It is working and builds are running!!!!

I will try ssh again soon.

Note that I think I got it to work with sub module 

URL=ssh://git@bitbucket.org/forrest/bubbagump.git

Not 

URL=git@bitbucket.org:forrest/bubbagump.git

I have tried so manny things it is now confusing.  

Also, bitbucket has "user keys" and "deployment keys".  The latter is read-only to the repo.  I just switched to the former.

Changing more than one thing now....impossible to track.  Sorry.  

Also...on my previous comments, the workspace was cached even though I selected delete before build... URL's we're not being updated between configurations (it appears)... Just want to note that for someone else if they experience this.