phlegx / redmine_gitlab_hook

This plugin allows you to update your local Git repositories in Redmine when changes have been pushed to GitLab.
MIT License
218 stars 73 forks source link

Returns OK on git error #8

Closed Jellyfrog closed 9 years ago

Jellyfrog commented 10 years ago

Even if git return an error, OK is returned:

» curl 'https://vscm-test/gitlab_hook' -d 'key=Ek7lMJnrHgZB3wGGV4z1&project_id=test'
OK%
Started POST "/gitlab_hook" for XXX at 2014-04-29 17:09:10 +0200
Processing by GitlabHookController#index as */*
  Parameters: {"key"=>"Ek7lMJnrHgZB3wGGV4z1", "project_id"=>"test"}
  Project Load (0.9ms)  SELECT "projects".* FROM "projects" WHERE "projects"."identifier" = 'test' LIMIT 1
  Repository Load (0.7ms)  SELECT "repositories".* FROM "repositories" WHERE "repositories"."project_id" = 30
GitLabHook: Executing command: '/usr/bin/git --git-dir='/data/test.git' fetch origin'
GitLabHook: Command '/usr/bin/git --git-dir='/data/test.git' fetch origin' didn't exit properly. Full output: ["error: cannot open /data/test.git/FETCH_HEAD: Permission denied\n", "\n"]
Shelling out: '/usr/bin/git' '--git-dir' '/data/test.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'branch' '--no-color' '--verbose' '--no-abbrev'
  Rendered text template (0.0ms)
Completed 200 OK in 35ms (Views: 1.3ms | ActiveRecord: 1.6ms)
octoquad commented 10 years ago

I also get OK returned, but for a different error message (mentioned in #2).

GitLabHook: Command 'git --git-dir='/path/to/redmine/repo/project-repo' fetch origin' didn't exit properly. Full output: ["Could not create directory '/path/to/www/.ssh'.\r\n", "Host key verification failed.\r\n", "fatal: Could not read from remote repository.\n", "\n", "Please make sure you have the correct access rights\n", "and the repository exists.\n"]

octoquad commented 10 years ago

Ensure your repo paths are owned by the relevant web server user and group i.e. www-data:www-data or apache:apache or nginx:nginx. Problem resolved for me.

Jellyfrog commented 10 years ago

Yes ofc, I just wanted report the bug.

On 6 jun 2014, at 02:27, Bruce Pieterse notifications@github.com wrote:

Ensure your repo paths are owned by the relevant web server user and group i.e. www-data:www-data or apache:apache or nginx:nginx. Problem resolved for me.

— Reply to this email directly or view it on GitHub.

Jellyfrog commented 10 years ago

This issue is not fixed. OK is returned even if the git command fails, whatever reason it fails for...

phlegx commented 9 years ago

Solved in version 0.1.0 tag v0.1.0. See here: https://github.com/phlegx/redmine_gitlab_hook/tree/v0.1.0 Please try out this version and give a feedback if all works fine!