Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError (Project 'project_name' ('project_name') has no repository) #38

Closed
Sergey1000 opened this issue Feb 22, 2018 · 6 comments
Closed

Comments

@Sergey1000
Copy link

Hello. I'm try to use your awesome plugin. But I got some problem during the configuring. Here is my situation:

1. Software version (the first one - in Redmine, the seconf - in Gitlab):

Redmine version: 3.4.3.stable
Ruby version: 2.3.1-p112 (2016-04-26) [x86_64-linux-gnu]
Rails version: 4.2.8
Git: 2.7.4
redmine_gitlab_hook: 0.2.0

GitLab: 10.4.4
Ruby: 2.3.6p384
Rails: 4.2.10
Git: 2.14.3

2. Preconfiguration for Redmine:

Enable REST web service - check
Enable WS for repository management - check
Repository management WS API key - FITBJ4rk5j7jIcPQWefx

3. Projects and repositories (the first one - in Redmine, the seconf - in Gitlab):

Project name:
test_project
Repository id (linked to the test_project):
test_repo_mirror
Repository in filesystem:
/var/www/redmine/files/repos/mirror/test_repo_in_gitlab.git
How does the repository was cloning to the filesystem:
git clone --mirror [email protected]:Lastname/test_repo_in_gitlab.git

Gitlab project name:
http://gitlab.lan/Lastname/test_project_in_gitlab
Gitlab repository:
[email protected]:Lastname/test_repo_in_gitlab.git
Webhook (push events):
http://redmine.lan/gitlab_hook?project_id=test_project&key=FITBJ4rk5j7jIcPQWefx

4. What have I done:

  • launch Gitlab's webhook (click "Test -> Push events"). The output is: "Hook executed successfully but returned HTTP 500";
  • send POST request in Advanced REST Client.
    In both cases redmine/log/production.log contains the next (the only difference between Gitlab and ARC in logs - more details for the first one regards to this URL https://docs.gitlab.com/ce/user/project/integrations/webhooks.html in "Push" section):
Started POST "/gitlab_hook?project_id=test_project&key=FITBJ4rk5j7jIcPQWefx" for 192.168.0.50 at 2018-02-22 17:37:25 +0200
Processing by GitlabHookController#index as HTML
  Parameters: {"project_id"=>"test_project", "key"=>"FITBJ4rk5j7jIcPQWefx"}
Completed 500 Internal Server Error in 6ms (ActiveRecord: 1.7ms)

TypeError (Project 'test_project' ('test_project') has no repository):
  plugins/redmine_gitlab_hook/app/controllers/gitlab_hook_controller.rb:131:in `find_repository'
  plugins/redmine_gitlab_hook/app/controllers/gitlab_hook_controller.rb:11:in `index'

The same problem occured when I use ANY key too. Looks like it fails before the authorization;

  • tried to check different checkboxes in redmine_gitlab_hook. No luck.

But when I launch the next command, I can see, that repository is linked to the project:
$ curl -v -u afb7a0addad5b0cf33449512a99879ff2cf40c9d:x "http://redmine.lan/sys/projects.xml?key=FITBJ4rk5j7jIcPQWefx"
[{"id":2,"name":"test_project","is_public":true,"identifier":"test_project","status":1,"repository":{"id":11,"url":"/var/www/redmine/files/repos/mirror/test_repo_in_gitlab.git"}}]

I can't figure out, what's wrong in my situation. Could you, please, help with this? Thank you.

@phlegx
Copy link
Owner

phlegx commented Feb 22, 2018

You have no repository set up in the Redmine project. Please activate module "repository" on project settings and then config a repository under: http://redmine.lan/projects/test_project/settings/repositories.

@Sergey1000
Copy link
Author

Sergey1000 commented Feb 22, 2018

Thank you so much for your extremely quick answer. As I understood, the repository was already setup in the Redmine project (regards to attached images). If I do "git fetch" in Redmine's mirror repo directory, I can see the changes, happened in Gitlab repo. Or I still do something wrong?

151931916172052088
151931916172052088 1

@phlegx
Copy link
Owner

phlegx commented Feb 22, 2018

@Sergey1000 please try out latest master. I have commit a bugfix. If all works fine for you I release a new version.

@Sergey1000
Copy link
Author

Thanks, I've tried it. And got the extended message:
TypeError (Project 'test_project' ('test_project') has no repository or repository not found with identifier 'lastname_test_repo_in_gitlab'):

Looks like I need to set the Redmine's repository id as "lastname_test_repo_in_gitlab"? Or something else?

@Sergey1000
Copy link
Author

Wow! Looks like my dreams comes true. I've changed the repository id to required and "Gotcha!" - "Hook executed successfully: HTTP 200".

@phlegx
Copy link
Owner

phlegx commented Feb 22, 2018

Thx, I will release version 0.2.1. Added description how to set right repository id in repository settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants