1 Star 0 Fork 1

redmines/redmine_gitlab_hook

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Redmine GitLab Hook

Contributors Release Issues License

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

Features

  • Multiple repositories per Redmine project
  • Supports Gitlab repository namespaces
  • Fetches all branches from all remotes
  • Auto create repository if not exist
  • Set path for auto-created repositories
  • Set Git command prefix
  • Fetch updates from repository
  • Fetch with prune mode

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 GitLab - 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 GitLab Hook plugin allows GitLab 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.

Installation

  1. Installing the plugin

    1. Follow the plugin installation procedure at http://www.redmine.org/wiki/redmine/Plugins.
    2. Restart Redmine instance.
    3. If you already have a local Git repository set up and working from Redmine go to step 3., otherwise continue at step 2.
  2. Setup Git repository sync

    1. Adding a Git repository to a project (note, this should work whether you want to use Redmine GitLab Hook or not). Simply follow this instructions. If the repository was cloned with clone --mirror please turn on the option all_branches in the plugin config page.
    2. Restart Redmine instance.
  3. Setup Redmine repository

    • In the project settings, activate repository module and add a new repository. Repository identifier is composed with {repository_namespace}_{repository_name}.
    • Project identifier test in repository namespace business with repository name redmine results in business_redmine as repository identifier.
    • If no repository namespace is used, use only the repository name as repository identifier. E.g. redmine.
    • If no repository name is given, the repository identifier is the same as the project identifier. E.g. test.
    • If no project identifier is given, the project identifier is the same as the repository name. E.g. redmine.
  4. Setup GitLab Web hook

    1. Go to the repository interface on GitLab.
    2. Under Web Hooks add a new Post-Receive URL of the format: {redmine_installation_url}/gitlab_hook?key={redmine_repository_API_key}&project_id={redmine_project_identifier}
    3. Required parameters
      • project_id or repository_name parameter
      • key = Redmine repository API key
    4. Additional optional parameters
      • project_id = Redmine project identifier
      • repository_name = Name of the Git repository
      • repository_namespace = Namespace of the Git repository
      • repository_git_url = Git Repository URL for auto create repository

    Example:

    https://redmine.example.com/gitlab_hook?key=j2g7kds9341hj6sdk&project_id=test&repository_name=redmine&repository_namespace=business

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

Debug

To debug the API interface of redmine_gitlab_hook try out RESTClient a nice add-on for Chrome, Firefox and Safari. Please keep in mind, that the request method must be of type POST!

Assumptions

  • GitLab >= 5.x.
  • Redmine 3.x running on a *nix-like system. Older versions of Redmine will not work.
  • Git 1.7.10 or higher available on the commandline. Also supports Git 1.8 repositories which are mirrored with the new clone --mirror command (default: off, please turn on in options when new mirror command was used).

Contributing

  1. Fork it ( https://github.com/[your-username]/redmine_gitlab_hook/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

The MIT License

Copyright (c) 2019 Phlegx Systems OG

The MIT License (MIT) Copyright (c) 2013 Phlegx Systems 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.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/redmines/redmine_gitlab_hook.git
git@gitee.com:redmines/redmine_gitlab_hook.git
redmines
redmine_gitlab_hook
redmine_gitlab_hook
master

搜索帮助