All Projects → koppen → Redmine_github_hook

koppen / Redmine_github_hook

Licence: mit
Allow your Redmine installation to be notified when changes have been pushed to a Github repository.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Redmine github hook

kanban
Kanban plugin for redmine
Stars: ✭ 68 (-84.58%)
Mutual labels:  redmine
redmine issue checklist
Checklist Plugin creates simple checklists for Redmine issues. Downloaded from http://www.redminecrm.com/projects/checklist/
Stars: ✭ 55 (-87.53%)
Mutual labels:  redmine
Redmine Theme Gitmike
This is github-like theme for Redmine.
Stars: ✭ 333 (-24.49%)
Mutual labels:  redmine
docker-redmine-orchestration
🐳 An easy docker-compose for Redmine (Nginx + Unicorn + MariaDB)
Stars: ✭ 18 (-95.92%)
Mutual labels:  redmine
redmine user specific theme
Redmine user specific theme plugin
Stars: ✭ 30 (-93.2%)
Mutual labels:  redmine
redmine preview office
Plugin for Redmine. Preview Microsoft Office Documents in Redmine's preview pane
Stars: ✭ 27 (-93.88%)
Mutual labels:  redmine
redmine tracker
Multi platform application to track time and synchronize it into Redmine.
Stars: ✭ 14 (-96.83%)
Mutual labels:  redmine
Purplemine2
A free Redmine theme for modern browsers
Stars: ✭ 440 (-0.23%)
Mutual labels:  redmine
redmine-vote on issues-plugin
Redmine Plugin Which Allows Users to Up- or Down-vote Issues
Stars: ✭ 17 (-96.15%)
Mutual labels:  redmine
Redmine dashboard
This redmine plugin adds an issue dashboard that supports drag and drop for issues and support various filters and groups.
Stars: ✭ 322 (-26.98%)
Mutual labels:  redmine
redmine postgresql search
PostgreSQL full text search plugin for Redmine
Stars: ✭ 14 (-96.83%)
Mutual labels:  redmine
redmine-theme-minimalflat
Minimal and flat design Redmine theme.
Stars: ✭ 12 (-97.28%)
Mutual labels:  redmine
toggl2redmine
Import time from Toggl 2 Redmine.
Stars: ✭ 23 (-94.78%)
Mutual labels:  redmine
redmine issue todo lists
Organize Redmine issues in to-do lists by manually ordering their priority.
Stars: ✭ 20 (-95.46%)
Mutual labels:  redmine
Php Redmine Api
A simple PHP Redmine API client, Object Oriented
Stars: ✭ 392 (-11.11%)
Mutual labels:  redmine
redminetoolbar
Firefox add-on to improve handling of Redmine projects
Stars: ✭ 27 (-93.88%)
Mutual labels:  redmine
redmine-view-customize-scripts
Code examples for "Redmine View Customize Plugin"
Stars: ✭ 67 (-84.81%)
Mutual labels:  redmine
Python Redmine
Python Redmine is a library for communicating with a Redmine project management application
Stars: ✭ 440 (-0.23%)
Mutual labels:  redmine
Redmine knowledgebase
A knowledgebase plugin for Redmine
Stars: ✭ 416 (-5.67%)
Mutual labels:  redmine
Flatly light redmine
Flatly light redmine theme
Stars: ✭ 296 (-32.88%)
Mutual labels:  redmine

Redmine GitHub Hook

This plugin allows you to update your local Git repositories in Redmine when changes have been pushed to GitHub.

Description

Redmine has supported Git repositories for a long time, allowing you to browse your code and view your changesets directly in Redmine. For this purpose, Redmine relies on local clones of the Git repositories.

If your shared repository is on a remote machine - for example on GitHub - this unfortunately means a bit of legwork to keep the local, Redmine-accessible repository up-to-date. The common approach is to set up a cronjob that pulls in any changes with regular intervals and updates Redmine with them.

That approach works perfectly fine, but is a bit heavy-handed and cumbersome. The Redmine GitHub Hook plugin allows GitHub to notify your Redmine installation when changes have been pushed to a repository, triggering an update of your local repository and Redmine data only when it is actually necessary.

Getting started

1. Install the plugin

  1. Add the gem to your Gemfile.local: gem "redmine_github_hook"
  2. bundle
  3. Restart your Redmine

2. Add the repository to Redmine

Adding a Git repository to a project (note, this should work whether you want to use Redmine GitHub Hook or not).

  1. Simply follow the instructions for keeping your git repository in sync.
  • You don't need to set up a cron task as described in the Redmine instructions.

3. Connecting GitHub to Redmine

  1. Go to the repository Settings interface on GitHub.
  2. Under "Webhooks & Services" add a new "WebHook". The "Payload URL" needs to be of the format: [redmine_url]/github_hook (for example http://redmine.example.com/github_hook).
    • By default, GitHub Hook assumes your GitHub repository name is the same as the project identifier in your Redmine installation.
      • If this is not the case, you can specify the actual Redmine project identifier in the Post-Receive URL by using the format [redmine_url]/github_hook?project_id=[identifier] (for example http://redmine.example.com/github_hook?project_id=my_project).
      • GitHub Hook will then update all repositories in the specified project. Be aware, that this process may take a while if you have many repositories in your project.
      • If you want GitHub Hook to only update the current repository you can specify it with an additional parameter in the Post-Receive URL by using the format [redmine_url]/github_hook?project_id=[identifier]&repository_id=[repository] (for example http://redmine.example.com/github_hook?project_id=my_project&repository_id=my_repo).
    • In most cases, just having the "push" event trigger the webhook should suffice, but you are free to customize the events as you desire.
    • Note: Make sure you're adding a Webhook - which is what Redmine Github Hook expects. GitHub has some builtin Redmine integration; that's not what you're looking for.

That's it. GitHub will now send a HTTP POST to the Redmine GitHub Hook plugin whenever changes are pushed to GitHub. The plugin then takes care of pulling the changes to the local repositories and updating the Redmine database with them.

Assumptions

  • Redmine 2 running on a *nix-like system. Redmine versions before 2.0 should use the redmine_1.x branch.
  • Git 1.5 or higher available on the commandline.

Troubleshooting

Check your logfile

If you run into issues, your Redmine logfile might have some valuable information. Two things to check for:

  1. Do POST requests to /github_hook show up in the logfile at all? If so, what's the resulting status code?
  2. If the git command used to pull in changes fails for whatever reason, there should also be some details about the failure in the logfile.

The logfile is usually found in your Redmine directory in log/production.log although your webserver logs may contain some additional clues.

Permissions problems

As for permissions, whatever user Redmine is running as needs permissions to do the following things:

  • Read from the remote repository on GitHub
  • Read and write to the local repository on the Redmine server

What user you are running Redmine as depends on your system and how you've setup your Redmine installation.

GitHub

This means you need to add its SSH keys on GitHub. If the user doesn't already have an SSH key, generate one and add the public SSH key as a Deploy Key for the repository on GitHub (or as one of your own keys, if you prefer that).

Local repository

The user running Redmine needs permissions to read and write to the local repository on the server.

What happens

The interactions between the different parts of the process is outlined in the following sequence diagram:

sequence

(Diagram made with js-sequence-diagrams).

License

Copyright (c) 2009-2019 Jakob Skjerning

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].