linniksa / redmine_git_mirror

Adds ability to clone and fetch remote git repositories to redmine
MIT License
35 stars 20 forks source link

canot fetch repos by gitlab hook or cronjob #5

Closed zhongw closed 5 years ago

zhongw commented 5 years ago

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://git@git.site/walrus/test', 'ssh://git@git.site/walrus/test.git', 'git@git.site:walrus/test', 'git@git.site: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
linniksa commented 5 years ago

Can you upgrade git (1.8 releases in 2013)? tests (debian stretch based) uses git 2.11.0

zhongw commented 5 years ago

update git version to 2 resolved my problem.

thanks.