Skip navigation

To get up-to-date activity on Redmine every time user pushed something on git repository managed by Gitblit without refresh redmine repository page, all you need to do are:

  1. Generate API key for your redmine repository. You can do it by go to Administration -> Settings -> Repositories:

    Once you click Generate a key link, you will get your API key. (do not forget to check Enable WS for repository management check box.
  2. Go to your Gitblit groovy folder and create one groovy script there. I named my script as redmine.groovy (do not forget to put groovy as your script file extension):
    import org.slf4j.Logger
    
    // Indicate we have started the script
    logger.info("redmine hook triggered by ${user.username} for ${repository.name}")
    
    // define the trigger url
    def triggerUrl = "http://<redmine url>/sys/fetch_changesets?key=<your service key>"
    
    // trigger the build
    new URL(triggerUrl).getContent()

     

    Modify triggerUrl to your proper Redmine URL and API key as your service key.

  3. Go to your gitblit server, pick project that you want to hook it to your Redmine server. Go to Edit menu, scroll down and you will see hook scripts section in there. You should see your new groovy script (in my end is redmine) on your available script both on pre-receive scripts and post-receive scripts. Just move it from available to selected:

    You don’t need to restart anything. Just try to push something on your git repository from hooked project then you will see the changes on redmine activity.

For more information about hooking redmine repository this link should helps a lot 🙂

Thanks for reading and hope this helps!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: