1. Sebastian Sebastian
  2. scm-manager

Issues

Issue #558 resolved

Redmine plugin does not update issue

Murat Ursavas
created an issue

I'm familiar to SCM Manager but new to redmine plugin. I installed SCM-Manager and Redmine in to a Linux Virtual Machine and they are working well over SSL (With the help of Oracle JRE). I wanted to integrate SCM-Manager with redmine via redmine plugin but it does not work as I expect. Gives a lengthy HTML based "Server Error 500" (the whole error is attached) which was taken with "hg push --verbose --debug" command. The changesets are pushed successfuly but the scm server is havig issues with updating the redmine issue. (Just enabled issue update).

I'm using mercurial on a windows host machine and the certificates of both SCM-Manager and Redmine are self signed. Although I think I successfuly added the certificates in also the linux machine as trusted certificates.

Also resmine is accessible from inside (where SCM server is also running)

What could be wrong?

Comments (54)

  1. Murat Ursavas reporter

    The error is gone with any traces about the redmine plugin. No prompt for redmine update, no updates for the issue, no traces in the log. (By the way the insalled version was 1.36)

    Username and password are the same for redmine and scm-manager.

    Also, what should be the URL parameter for the redmine tab of the project? just the installation path of redmine or including also the project name like "https://the.redmine.domain/projects/foo-project" (Note: REST API is enabled)

    PS: The commit message is something like "(#3) Done foo things".

  2. Murat Ursavas reporter

    The trace level had been enabled by default. But I don't see any log after the push process. Isn't that a bit strange? Please find the startup trace log attached.

  3. Murat Ursavas reporter

    Sure please find the attached log file.It's the client side output. As I said before, it does not leave any traces in the server side log file.

    My guess is the latest dependecy adjustment completely disabled the plugin. It's there but doing nothing.

    P.S: Again, what should be the URL parameter of the redmine tab? Just the domain, or should include the project path?

  4. Murat Ursavas reporter

    I tried with the old setup and it's the same. No logs after a push. To make sure about it I'm deleting the contents of the log file before push (not deleting the file because interestingly scm-server does not create it again).

  5. Sebastian Sebastian repo owner

    Are you sure that you check the right log file? Could you please execute the following command on the machine which runs scm-manager:

    ls -l /proc/$(ps -ef | grep scm-server | grep -v grep | awk '{print $2}')/fd | grep -e '.log$'
    

    And check if the log the same you are check for updates.

  6. Murat Ursavas reporter

    [Back to 1.37 Snapshot]

    Command result:

    ls: cannot access 20237/fd: No such file or directory
    

    What do you mean with "checking updates". If you mean checking updates for scm-server I didn't see something like that. If you mean pulling from repos, it also didn't create any traces in the log.

    The log file I sent is the same I'm looking. It's updated while startup but that's it. No logs for pull or push.

  7. Murat Ursavas reporter

    To see what's going on under the hood I've stopped the daemon and run scm-server manually. Then I have been able to see the real log. (Although the log file still didn't include anything). Here, the push log is attached (taken from the SSH output of scm-server)

  8. Sebastian Sebastian repo owner

    I mean checking the log file for updates (new lines). Did you see new lines, if you access the web interface with a browser? Please execute:

    ls -l /proc/20237/fd | grep -e '.log$'
    
  9. Murat Ursavas reporter
    ls: cannot access /proc/20237/fd: No such file or directory
    

    Unfortunately no new lines. I think after the startup, logging is gone because the link is not there anymore. Somehow scm-server loses the connection with the log file. But I can give you the traces from the SSH output from now on.

  10. Sebastian Sebastian repo owner

    Ok, but here is the exception message for the redmine problem:

    com.taskadapter.redmineapi.RedmineAuthenticationException: Authorization error. Please check if you provided a valid API access key or Login and Password and REST API service is enabled on the server.
    
  11. Murat Ursavas reporter

    OK, the error says "API key OR login details". The login details are the same and REST is enabled. I'm suspecting from the username, it includes a dot, could it be the issue?

  12. Sebastian Sebastian repo owner

    Sorry, but i don't know redmine very good. But i've seen this error before and in that case the url was wrong. You have to insert the url inclusive context url (something like this http://myredmineserver/redmine/). You could check the access log from your webserver (which hosts redmine), which urls are triggered by the scm-manager plugin. You can open the rest urls directly in your browser to see the result.

  13. Murat Ursavas reporter

    Sebastian,

    I've investigated the access logs and seen the line below

    "GET /issues/3.json?include= HTTP/1.1" 401 1388 "-" "-"
    

    I've applied the "https://the.redmine.domain/issues/3.json?include=" from the browser and it asked for credentials. After that I've seen the REST API response successfuly.

    It also can be seen from the log. Webserver is sending "401" which is an authorization request. That means redmine plugin should be accepting self signed certificate and can access to the server.

    But I don't know how to check the authorization result.

  14. Murat Ursavas reporter

    Sebastian,

    I've narrowed down the problem and it really looks like an authorization issue. I've tested the connection with lynx browser inside the server and had seen a certificate common name issue. Fixed that and then approved with a proper username password, I can get all the REST API information I need, using the exact address redmine plugin uses.

    So I need to see the authorization data and actual response from the apache2 server. Setting the LogLevel to debug didn't help, couldn't see the authentication result.

    Do you have any idea how to see these information? It's not related to Redmine, everything is going on between redmine plugin and Apache server. (Maybe you can turn on logging sent username password and taken response. This way we can see the real issue.

    P.S: The same redmine plugin 1.1 is working fine on a windows server with SCM Manager 1.22, without SSL on IIS7.

  15. Sebastian Sebastian repo owner

    I'm do not how to setup the api key method. Perhaps you could write velo he is the author of the redmine-plugin. It is possible that you call redmine over http instead of https, just to be sure that the problem has nothing todo with the ssl setup?

  16. velo

    I'm no longer working using SCM nor redmine (new company, new setup).

    But I can give full access to anyone that wanna maintain this plugin. Just send me the names!

  17. Murat Ursavas reporter

    Sebastian,

    We ruled out the SSL parameter. I've tried plain HTTP and it also failed. I think the only option is really try to make the plugin work from inside. Velo's suggestion is tempting but I don't know whether I can maintain it or not. I'm not familiar wth SCM Manager plugin structure and have very few Java knowledge.

    P.S: I've tried the newly released 1.37 and the issue is still there as expected.

  18. Murat Ursavas reporter

    Another finding: As I suspected, redmine plugin does not really try to authenticate. While trying to update issue, it still uses the "anonymous" user not the scm-manager's user. It's logged in the redmine logs.

    It's the same plugin which works perfectly in the older scm-manager on Windows Server. Why does not work on the newer SCM Server on Linux? It could be somehow related to the log issue of SCM Manager. Don't know.

  19. Murat Ursavas reporter

    Unfortunately it didn't help. Still no authorization. I've looked to the code in the plugin repository and couldn't see any authentication code. How can we be sure that it tries to authenticate?

    Please find the attached push trace log.

    Here, also the redmine log:

    Started GET "/issues/3.json?include=" for 127.0.0.1 at 2014-04-24 07:52:35 +0000
    Processing by IssuesController#show as JSON
      Parameters: {"include"=>"", "id"=>"3"}
      Current user: anonymous
    Filter chain halted as :check_if_login_required rendered or redirected
    Completed 401 Unauthorized in 2.6ms (ActiveRecord: 0.4ms)
    

    Here's the successful inside attempt with lynx browser

    Started GET "/issues/3.json?include=" for 127.0.0.1 at 2014-04-24 08:07:22 +0000
    Processing by IssuesController#show as JSON
      Parameters: {"include"=>"", "id"=>"3"}
      Current user: murat.ursavas (id=3)
      Rendered issues/show.api.rsb (8.2ms)
    Completed 200 OK in 84.9ms (Views: 8.7ms | ActiveRecord: 8.9ms)
    

    Can you add a log trace to the plugin while trying to authenticate?

    PS: There is one good news, though, what you've done, solved the log issue. Now I can see the push log in the log file. So please keep this change in the repo.

  20. Murat Ursavas reporter

    By the way, I've investigated the API Key method and it's not a good idea to use API Key for authentication. This way you have to keep an API Key for every person per project (The projects does not have to be on the same redmine server).

    So, we should keep the username/password usage for authentication.

  21. Murat Ursavas reporter

    I don't know Klingon language, I'll be happy if you can look at the attached extended log :)

    P.S: The logging gone again, I don't understand what happens, the version is still the same.

  22. Sebastian Sebastian repo owner

    No, the server responds with "401 Authorization Required".

    I've done some tests:

    • installed redmine (on linux mint 15)
    • installed scm-server-1.38-20140424.064716-1-app.zip
    • installed scm-redmine-plugin
    • created a user admin with password admin on scm-manager to match the default redmine account
    • created a test repository on scm-manager with write permissions for the user admin
    • configured redmine-plugin to update issues
    • created a redmine project
    • created a sample issue (id=1)
    • submit a push to the test repo with commit message "update issue (#1)"

    The whole process works like expected. Is the user privileged to update issues on the redmine project? Could you test it, with an other user? Does redmine write logs with some informations on permissions?

  23. Murat Ursavas reporter

    I had started to suspect from the redmine installation and your findings made it more definite. I've read also some authentication issues on the web about redmine integration. So this is clearly related to redmine but how does this change. What's inside the HTML header makes this not work. Interesting.

    I have to look deeper for an extended logging for redmine, since I don't know very well the inner gears of it.

    P.S: Yes, the user is eligible to update the issue.

  24. Murat Ursavas reporter

    Something is not right with my setup. Like SCM Manager, Redmine is also losing the connection with the log file after the startup. Do you have any idea about the cause? Maybe log rotation?

  25. Murat Ursavas reporter

    I somehow managed to get the logs of the attempt and looks like the request comes to the redmine as anonymous. I think I have something wrong with my Apache settings.

    Could you post the apache settings you use? Especially authentication. For example I have this:

    AuthUserFile /dev/null
    

    I guess it's not basic authentication. Maybe mod_passenger?

  26. Murat Ursavas reporter

    There is definitely something wrong with the setup but it's very hard to find the malfunctioning part without proper logs. Because the only problematic part is the plugin. Everything else just works. I'm suspecting from the HTTP header redmine plugin uses but I have to find a way to debug it to detect why it differentiates in my setup.

    Again, could you post your apache site settings? Maybe it's the key.

  27. Murat Ursavas reporter

    Finally. It is solved... It was eating me from inside. What was the trick, Sebastian? (I got a hunch about HTTP header)

    By the way I've seen that the issue update has some issues (recursive :)

    Here's the added sample update. (Redmine 2.5.1, latest stable)


    [SCM] <a target="_blank" href="https://rapys.rasatron.com/issues/3">(#3)</a> Just testing SCM Manager Redmine plugin.

    Changes: https://rascom.rasatron.com:8181/scm/index.html#diffPanel;CqOZNBtzP2;6ebdd882c24e48b180a8973210a098d96e21e1b1

    Patch: https://rascom.rasatron.com:8181/scm/api/rest/repositories/CqOZNBtzP2/diff?revision=6ebdd882c24e48b180a8973210a098d96e21e1b1


    As you can see the added link ref can be seen in the issue update. I guess it's because of the redmine link style and HTML character escaping.

    Also could you please change the commit and patch link style? It makes the issue messages too crowded. A simple "Changes, Patch" would be just fine (of course with their links.)

    It is very simple to do. Here:

    "Changes":https://rascom.rasatron.com:8181/scm/index.html#diffPanel;CqOZNBtzP2;6ebdd882c24e48b180a8973210a098d96e21e1b1 "Patch":https://rascom.rasatron.com:8181/scm/api/rest/repositories/CqOZNBtzP2/diff?revision=6ebdd882c24e48b180a8973210a098d96e21e1b1
    

    Thanks for your efforts. I really appreciate it.

  28. Log in to comment