WebHooks Repository URL

73 views
Skip to first unread message

Justin Smith

unread,
Jan 6, 2014, 11:43:20 AM1/6/14
to gito...@googlegroups.com
I am trying to use the Web-Hooks with Jenkins-CI. Jenkins has a plugin to do this, see the source: https://github.com/jenkinsci/gitorious-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitorious/GitoriousStatus.java

After not being able to get this to work, I checked out the plugin source, and debugged through it.

It turns out, that even though I have the git:// and http:// protocol's disabled for checking out (private repo), that the web-hook is reporting the repository url how I would see it in a web browser. In my case https://gitorious.myserver.net/project/repo

Since I use the ssh url (g...@git.myserver.net) for everything, I this seems to be an issue for me. Is this the desired, proper, behavior for the webhook and URL? Or should it report the push url as well?

If this is how it is SUPPOSED to work, I can try to patch the jenkins plugin somehow (not sure how at this moment). If not, could the web-hook possibly return the available URL's for accessing the actual repository?

Ken Dreyer

unread,
Jan 6, 2014, 12:07:29 PM1/6/14
to gito...@googlegroups.com
This is an unfortunate problem with the current code for the Jenkins
plugin. As is currently stands, the Jenkins plugin only supports the
URL that Gitorious' web hook sends over JSON, and this happens to be
HTTP.

It would be ideal if the Jenkins plugin provided a "preferred Git URL
scheme" radio box in the user-interface, so that you could easily
change this yourself. The plugin could take the Git URL from JSON and
automatically rewrite the URL scheme to be one of "http://",
"https://", "git://", or "SSH", depending on the setting.

Unfortunately I don't know enough of Jenkins' API to implement this
feature. In my work environment, I ended up using this fork of the
Jenkins plugin: https://github.com/Infinidat/gitorious-plugin, which
at least re-writes the URLs to git://. If you study the patches in
that fork you may be able to write your own patch for SSH support.

The Jenkins plugin could certainly use some love :)

- Ken

Justin Smith

unread,
Jan 6, 2014, 12:12:26 PM1/6/14
to gito...@googlegroups.com
I don't mind making this patch, and will update when I do.  Hopefully it can get pushed to active.

I asked because I didnt know if this was desired behavior in the web-hook, which it appears to be.

The git plugin (for Jenkins) does let you set the gitorious web location for the project.  Perhaps I can use this as well. 

Thanks for the quick reply!



--
--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to
gitorious+...@googlegroups.com

---
You received this message because you are subscribed to a topic in the Google Groups "Gitorious" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gitorious/y4vGEZiijHQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gitorious+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Justin Smith
Summit Management Systems, Inc
(615) 281-9454
Skype: jwsmith22

People demand freedom of speech as a compensation for the freedom of thought which they seldom use.  ~ Soren Kierkegaard

Justin Smith

unread,
Jan 6, 2014, 3:09:01 PM1/6/14
to Justin Smith, gito...@googlegroups.com
Ken (and anyone who needs this),

I forked the gitorious-plugin (https://github.com/magno32/gitorious-plugin) and added the following functionality:

The plugin will now look at all projects and see if a gitoriousBrowser is registered for the Git SCM.  If so, it will also compare this url to the url passed back by the web-hook. 
This means you will need to configure the "gitoriousweb" Repository Browser for your projects that you want to enable, and also enable SCM polling. You don't have to set a polling schedule, just turn it on.

I did not look at adding this as a setting (its another good idea to fix this though) since we need the gitorious browser anyway to link in the projects.  Also, our Gitorious web host and git repositories exist on separate sub-domains.  I could not think of a "catch-all" for all the different situations that could come up with rewriting a url.

I did submit a pull request (https://github.com/jenkinsci/gitorious-plugin/pull/1) so hopefully it will make it as an update. 

gitorious.hpi
Reply all
Reply to author
Forward
0 new messages