Giter VIP home page Giter VIP logo

redmine_git_mirror's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redmine_git_mirror's Issues

Feature : Fetch changes when redmine show repo

Hi, thanks for the plugin.

Is there a possibility to fetch repo changes when a redmine user ask for a repo in the web interface ?

It could be usefull when redmine is on a host that do not support cron (docker for example) and when the git is not from github.

Any plan to support github?

I installed redmine on my aws ec2 instance, and clone my github repository to instance. So I wanna mirror my github repo to my instance repo by webhook.

Can you help me? "redmine_webhook_github" plugin is outdated(because i installed redmine 4.0.1, and it is not compatible with that plugins)

Repository 404

Redmine 4.0.7
Git 1.8.3.1
Add New repository from gitlab. All OK, no error. In path /ROOT_REDMINE/plugins/redmine_git_mirror/repos/20210207005855371_NAME created repository files.
Goto in repository (https://REDMINE_URL/projects/PROJECT_NAME/repository/REPOSITORY_NAME) - 404 The entry or revision was not found in the repository.
How to solve it?

Having 422 on gitlab system webhook

I'm trying to configure a system webhook on a Gitlab.

While testing the webhook, Gitlab indicates a 422 return.
The payload is:

{
  "event_name": "repository_update",
  "user_id": 10,
  "user_name": "john.doe",
  "user_email": "[email protected]",
  "user_avatar": "http://example.com/avatar/user.png",
  "project_id": 40,
  "changes": [
    {
      "before": "8205ea8d81ce0c6b90fbe8280d118cc9fdad6130",
      "after": "4045ea7a3df38697b3730a20fb73c8bed8a3e69e",
      "ref": "refs/heads/master"
    }
  ],
  "refs": [
    "refs/heads/master"
  ]
}

On redmine logs:

10.11.0.3 - - [12/Jul/2019:16:40:50 UTC] "POST /sys/git_mirror/gitlab HTTP/1.1" 422 0
- -> /sys/git_mirror/gitlab
10.11.0.3 - - [12/Jul/2019:16:43:25 UTC] "POST /sys/git_mirror/gitlab HTTP/1.1" 422 0
- -> /sys/git_mirror/gitlab

looking at code, a "repository_update" should return 200.

Unable to mirror gitlab project

Hi,

currently im not able to mirror a project from my gitlab instance into redmine.

I always get "URL Permission denied, please try again." I read the realy short documentation and there is the section about private Repositories:
"At this moment only ssh access with redmine user ssh key is supported."

What does this mean? My repos in gitlab are accessible via ssh "git@gitlab" or https. Which key do i need to provide to gitlab?
I tried to clone the repo as redmine user and its ssh key and its working (Pubkey as deploykey in the gitlab project - repository).

How should i specify username and or key in the url?

Thank you in advance,
Thomas

Dir.home causes ArgumentError (couldn't find login name -- expanding `~')

Hi,

I have been testing this plugin and it is great. However, I encountered the following error:

ArgumentError (couldn't find login name -- expanding `~')

I am not a ruby/rails developer, but I did some debugging. The error is being caused by the line Dir.home + "/.ssh/known_hosts" on the lib/redmine_git_mirror/ssh.rb file.
The error is caused by the lack of a HOME variable being set on the httpd user installed by the Arch Linux package.
I am not sure if this would occur on other distros, but I added the following to the file in order to get the home directory directly from the etc/passwd file.

require 'etc'
Etc.getpwuid.dir + "/.ssh/known_hosts"

Adding this issue as I am not really sure if this is the best fix for the problem and it might help someone who cannot get the plugin to work.

Thanks a lot for the plugin.

Changes required for Redmine 5.x

Hi, it seems that this plugin is abandoned, just in case I will post required changes for it to work with Redmine 5.x (and maybe save some poor soul that upgrades with this plugin).

In file redmine_git_mirror/init.rb you need to change multiple require_dependency lines to this:

require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/git'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/ssh'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/url'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/settings'

In the same redmine_git_mirror/init.rb file you also need to change require 'redmine_git_mirror/patches/repositories_helper_patch' line to this:

require File.dirname(__FILE__) + '/lib/redmine_git_mirror/patches/repositories_helper_patch'

In file redmine_git_mirror/lib/redmine_git_mirror/ssh.rb you need to replace SSH with Ssh (otherwise it will be throwing errors for some reason).

In file redmine_git_mirror/lib/redmine_git_mirror/git.rb you need to replace all usages of RedmineGitMirror::SSH with RedmineGitMirror::Ssh

In file redmine_git_mirror/lib/redmine_git_mirror/url.rb you need to replace @@schemes['GIT'] = GIT with register_scheme 'GIT', GIT

After that it should migrate without errors

URL uninitialized constant GitMirror

I tried linking a repository of mine on GitHub to a project and after saving it just gives me URL uninitialized constant GitMirror.

screencapture-projects-xdg-ph-projects-sample-project-repositories-2019-01-31-11_06_13

Any ideas? If you need a log file please let me know. I'm not really well-versed in Ruby so I don't know where to start looking.

Gitea-Support

We are switching to the open source git service gitea (https://gitea.io/en-us/) and like to use Redmine Git Mirror plugin to synchronize our git repos with redmine.

In case this feature is not planned, I like to contribute it myself.

canot fetch repos by gitlab hook or cronjob

I have set up gitlab hook to fetch the changesets, HTTP status 202 returned but the repo managed by git_mirror is not updated.
production log:

Creating scope :system. Overwriting existing method Enumeration.system.
Creating scope :sorted. Overwriting existing method Group.sorted.
Creating scope :sorted. Overwriting existing method User.sorted.
DEPRECATION WARNING: Using a dynamic :action segment in a route is deprecated and will be removed in Rails 6.0. (called from instance_eval at /data/redmine/config/routes.rb:355)
DEPRECATION WARNING: Using a dynamic :action segment in a route is deprecated and will be removed in Rails 6.0. (called from instance_eval at /data/redmine/config/routes.rb:355)
Started POST "/sys/git_mirror/gitlab" for 10.109.6.11 at 2019-03-04 22:59:33 +0800
Processing by GitMirrorController#gitlab as HTML
  Parameters: {"object_kind"=>"push", "event_name"=>"push", "before"=>"0f4802fa39996a3d483263c223fe09ad59a6f88a", "after"=>"b4d97cc617baf3d2a3d2ca704b728bf984a2fb27", "ref"=>"refs/heads/master",.......}
   (0.5ms)  SET NAMES utf8mb4,  @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'),  @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
  Repository::GitMirror Load (0.5ms)  SELECT  `repositories`.* FROM `repositories` INNER JOIN `projects` ON `projects`.`id` = `repositories`.`project_id` WHERE `repositories`.`type` IN ('Repository::GitMirror') AND `projects`.`status` = 1 AND `repositories`.`url` IN ('ssh://[email protected]/walrus/test', 'ssh://[email protected]/walrus/test.git', '[email protected]:walrus/test', '[email protected]:walrus/test.git', 'http://git.site/walrus/test', 'http://git.site/walrus/test.git', 'https://git.site/walrus/test', 'https://git.site/walrus/test.git') ORDER BY `repositories`.`id` ASC LIMIT 1000
  Changeset Load (0.7ms)  SELECT `changesets`.* FROM `changesets` WHERE `changesets`.`repository_id` = 41 AND `changesets`.`revision` IN ('4f80e6021c172ec0ec416fcbb971acb78cd86019', '1602e0799e698632fa1733f5a207bb3094d0aeb9', '0e06e5549d26fe1d1277f42befaf58f5650e2463', '1dc71d66adac4622b0174ffa015b5e5ffce9443d', '6e11b5cc36bf4e0e8ba1b49b75d723966a61a0c7', '9f14d97f304221e0dec546de5a5b313e3ffe5612', '2cd6555d40df8c36f72fa4ceee673630c8f61c70', '0fd9d97ae5d172b67ff794fbe72612665a81260e', '20d97cf077f459377256934c6694a7b414691444', 'afd9230b9f07227b6d5d574ec4ba830cbf31b40d', 'b719d27c60737c9f25e0837365c2b78b3b010589', '0ddb1d774cd3de00d00a37c7421c2a1fbe5dc352', '811e3d29a8181359a1fbb6d60b00f00697fdd3ab', '9c5e62f3f17d701a6ad8af265bbb9006b50b3b9d', 'd2abd45e4ad9e5992754d673e7bc10083a34db87', '29709c4270e8644e3bb12b9afd662f10b6e496cc', '5434d968d20bbe83133c4173ffc51ae9f299f93e')
Shelling out: 'git' --version
Shelling out: 'git' '--git-dir' '/data/redmine/plugins/redmine_git_mirror/repos/20190304133311078_git.site_walrus_test' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'branch' '--no-color' '--verbose' '--no-abbrev'
Completed 202 Accepted in 1239ms (ActiveRecord: 5.6ms)

production.scm.stderr.log

fatal: Not a valid object name :

git_mirror is the latest version of 0.8

one more thing: if i fetch the repo manually ,and then push a test from gitlab, the changesets will be cleaned up by git mirror.

env:

Environment:
  Redmine version                4.0.2.stable.17897
  Ruby version                   2.5.3-p105 (2018-10-18) [x86_64-linux]
  Rails version                  5.2.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.7.14
  Git                            1.8.3.1
  Filesystem                     
  GitMirror                      1.8.3.1
Redmine plugins:
  redmine_checklists             3.1.14
  redmine_git_mirror             0.8.0
  redmine_issue_evm              4.2.1
  redmine_lightbox2              0.5.0
  redmine_tags                   4.0.0
  redmine_work_time              0.4.0

Could not add gitlab repo with arbitrary port

I trying to add repo URL like this:
https://gitlab.site:9443/path/project.git
Error says:
URL fatal: unable to access 'https://gitlab.site/path/project.git/': Failed to connect to gitlab.site...

-b and --singlebranch support

for cases that the remote repo has lots of branches, but we only need one branch for project a, and another branch for project b, we should only clone the specific branch for specific project.

Add ssh key

Hello

Could be nice to add an option to define a ssh key by repository.

Thanks a lot

access git-mirror configure facing error 500

Hi,
The error 500 displayed when I trying to access git_mirror configure, the error log is :

Started GET "/settings/plugin/redmine_git_mirror" for 10.109.0.50 at 2019-02-14 12:36:47 +0800
Processing by SettingsController#plugin as HTML
  Parameters: {"id"=>"redmine_git_mirror"}
  Token Update All (2.8ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2019-02-14 12:36:47' WHERE `tokens`.`user_id` = 5 AND `tokens`.`value` = '78c28beefd2e1d2ee3639f21e634ac81b81f3c02' AND `tokens`.`action` = 'session' AND (created_on > '2019-02-07 12:36:47.747991') AND (updated_on > '2019-02-14 04:36:47.748685')
   (0.5ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
  User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 5 LIMIT 1
  Current user: zhongwei (id=5)
  Setting Load (0.4ms)  SELECT  `settings`.* FROM `settings` WHERE `settings`.`name` = 'plugin_redmine_git_mirror' ORDER BY `settings`.`id` DESC LIMIT 1
  Rendering settings/plugin.html.erb within layouts/admin
  Rendered plugins/redmine_git_mirror/app/views/git_mirror/_settings.html.erb (18.7ms)
  Rendered settings/plugin.html.erb within layouts/admin (23.0ms)
Completed 500 Internal Server Error in 40ms (ActiveRecord: 4.6ms)

ActionView::Template::Error (uninitialized constant RedmineGitMirror::Settings
Did you mean?  Setting):
    15:       Allow users to change URL (risky)
    16:     </label>
    17:     <%= hidden_field_tag "settings[url_change_allowed]", 0 %>
    18:     <%= check_box_tag "settings[url_change_allowed]", 1, RedmineGitMirror::Settings.url_change_allowed?,
    19:         :id => 'url_change_allowed'
    20:     %>
    21:   </p>

plugins/redmine_git_mirror/app/views/git_mirror/_settings.html.erb:18:in `_plugins_redmine_git_mirror_app_views_git_mirror__settings_html_erb__970999306419086397_47190957072860'
app/views/settings/plugin.html.erb:6:in `block in _app_views_settings_plugin_html_erb__3892187169558330291_47190963568260'
app/views/settings/plugin.html.erb:4:in `_app_views_settings_plugin_html_erb__3892187169558330291_47190963568260'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

the info of my redmine instance is:

Environment:
  Redmine version                4.0.1.stable.17835
  Ruby version                   2.5.3-p105 (2018-10-18) [x86_64-linux]
  Rails version                  5.2.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.7.14
  Git                            1.8.3.1
  Filesystem                     
  GitMirror                      1.8.3.1
Redmine plugins:
  redmine_checklists             3.1.14
  redmine_git_mirror             0.6.0
  redmine_issue_evm              4.2.1
  redmine_lightbox2              0.5.0
  redmine_tags                   4.0.0
  redmine_work_time              0.4.0

please let me know if anything needed.
thanks.

clone or webhook error

Hi, thanks for the plugin.

redmine_git_mirror in the redmine plugins directory and clone it by setting up repository in redmine.
But, when I run "./bin/rails runner "Repository :: GitMirror.fetch" -e production" command, the following error occurs.


./bin/rails runner "Repository::GitMirror.fetch" -e production

Beginning in Rails 4, Rails ships with a rails binstub at ./bin/rails that
should be used instead of the Bundler-generated rails binstub.

If you are seeing this message, your binstub at ./bin/rails was generated by
Bundler instead of Rails.

You might need to regenerate your rails binstub locally and add it to source
control:

rails app:update:bin # Bear in mind this generates other binstubs
# too that you may or may not want (like yarn)

If you already have Rails binstubs in source control, you might be
inadverently overwriting them during deployment by using bundle install
with the --binstubs option.

If your application was created prior to Rails 4, here's how to upgrade:

bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails executables
git add bin # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

bundle binstubs some-gem-name
git add bin/new-executable

Fetching repo https://github.com/****/*****.git to /opt/redmine-4.0.3-2/apps/redmine/htdocs/plugins/redmine_git_mirror/repos/20190514190004307_github.com_****_*****
Usage:
rails new APP_PATH [options]

Options:
[--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications)
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /opt/redmine-4.0.3-2/ruby/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
[--skip-yarn], [--no-skip-yarn] # Don't use Yarn for managing JavaScript dependencies
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
[--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
-M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
[--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files
-P, [--skip-puma], [--no-skip-puma] # Skip Puma related files
-C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
[--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
[--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem
[--skip-coffee], [--no-skip-coffee] # Don't use CoffeeScript
-J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
[--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
-T, [--skip-test], [--no-skip-test] # Skip test files
[--skip-system-test], [--no-skip-system-test] # Skip system test files
[--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem
[--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
[--rc=RC] # Path to file containing extra configuration options for rails command
[--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
[--api], [--no-api] # Preconfigure smaller stack for API only apps
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
[--webpack=WEBPACK] # Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular/elm/stimulus)

Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend], [--no-pretend] # Run but do not make any changes
-q, [--quiet], [--no-quiet] # Suppress status output
-s, [--skip], [--no-skip] # Skip files that already exist

Rails options:
-h, [--help], [--no-help] # Show this help message and quit
-v, [--version], [--no-version] # Show Rails version number and quit

Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.

You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.

Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.

Example:
rails new ~/Code/Ruby/weblog

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.

Also, I do not seem to be able to recognize paths like /sys/git_mirror/ github. I get a 404 error.

I'm using redmine is bitnami redmine 4.0.3-2.

Thank you for your advice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.