Easy way to let RhodeCode inform other applications (Fisheye, Jenkins, etc) about pushed changes


#1

Dear Support,

What is the easiest way to configure a kind of hook between RhodeCode and other applications like Jenkins or Fisheye/Crucible, so RhodeCode can inform these other application that someone pushed something.

Currently we have a setup that all these other application are regularly polling all repos in RhodeCode. But that would be much elegant if RhodeCode could inform these others that there is a change.

I’ve managed to setup a hook between Fisheye and Rhodecode, using the ‘changegroup’ hook. It is an entry in the .hgrc file within the repository’s directory on the RhodeCode server.
But I have some problems with this approach:
Giving direct (login) access to the rhodecode server for users is something I will not do. So it is a manual labor for the system admin for all repository, which is cumbersome.

Is there a way to configure these hooks on the web interface?

Or alternatively, if hooks are not the best thing for this, what shall we use?

Kind regards,
Tamas


#2

This is the hook that can trigger a Fisheye/Crucible update if there is a push on a particular repository:

[hooks]
changegroup = /usr/bin/curl -X PUT -H “X-Api-Key: 5ff05a009046--------------------d86dde52” -H “Content-Type: application/json” http://server1/fisheye/rest-service-fecru/admin/repositories/my_repo/incremental-index

API key, server- and repository name changed for confidential reasons.


#3

Jenkins has a dedicated integration in EE edition, so using the integration framework you can just check the push type event, and configure Jenkins endpoint.

The second case can be done via Webhook integration. You simply specify the endpoint URL template:
e.g http://server1/fisheye/rest-service-fecru/admin/repositories/${repo_name}/incremental-index

And this global webhook will call this endpoint replacing repo_name with specific repository name from RhodeCode.

It allows setting a custom Header and also triggering a call using BasicAuth

Hope this helps,


#4

Hi Marcin,

Sorry for the late reply, but I was not able to pick this up sooner…

Anyways, I am not able to make this working :confused:.
I am playing around with the Fisheye/Crucible trigger first (leaving now Jenkins).
I’ve created a webhook
Defined the URL
Defined the Custom Header Key: X-Api-Key
Defined the Custom Header Value:
Call method: POST
Events: repository push

no secret token
no username+password
I don’t think I need these, as the curl way of triggering from the command line works fine without any secret token or user+password.

But pushing to a repo where this webhook is assigned does not trigger a Fisheye/Crucible scan.

I am not sure if the webhook not called at all, or the Fisheye server ignores the incoming stuff. How could I debug this? Is there a dedicated log file for webhooks? Are the webhook calls/executions logged at all?

Thanks,
Tamas


#5

If you enable DEBUG log-level (https://docs.rhodecode.com/RhodeCode-Enterprise/admin/enable-debug.html#debug-and-logging-configuration)

You’ll be able to see the request and response in details. That should help getting this sorted out