Wrong link from Gitlab commit view to Youtrack

Hello

I've posted this message bellow as an comment to very similar problem here : https://youtrack-support.jetbrains.com/hc/en-us/community/posts/115000134324/comments/115000577704

Nevertheless i've decided to create a new topic from that. What i'm interested in is connectivity between gitlab and youtrack (i did ask the same question on gitlab support forum - no response yet. Maybe someone had the same problem and will point me in the right direction)

I've already found ths "custom issue tracker" on Gitlab integrations page. But youtrack documentations says nothing about "how" to configure. There is only this information:

"To set YouTrack issue IDs as links in GitLab commit messages, you need to configure this feature in GitLab. To locate this option, access the Integrations page in your GitLab project settings and select Custom Issue Tracker from the Project services list."

Nothing about values, which should be filled in to the fields on gitlab page. This is my configuration:

 


The problem is : urls are "wrongly" created in gitlab.
When i push commit in schema : [ProjectName]-[Number] e.g. MPR-123 --> url, that is created in gitlab is :

http://[Youtrack_url]/Issue/123 where it should be http://[Youtrack_url]/issue/MPR-123

Anyone know how to fix it ?

I'm using
- GitLab Community Edition 9.5.4
- YouTrack 2017.3 (build #37328)

12 comments
Comment actions Permalink
Official comment

Hello,

 

Please try Porject URL as : https:\\ youtrack_instace.jetbrains.com/youtrack, let me know, if it helps.

Comment actions Permalink

that's the exact issue we have in our environment as well
any solution will be very helpful

 

0
Comment actions Permalink

Lüba Melnikova,

Nothing changes, actually :(

0
Comment actions Permalink

I confirm. Channgin url changes nothing

I've reported similar issue on gitlab support forum. Andrew - you can back me up there. Maybe some will anwser :)

https://forum.gitlab.com/t/custom-issue-tracker-9-5-4-wrongly-filled-in-id/12499

0
Comment actions Permalink

Unfortunately I can not help you further, sorry for the misleading - this integration is performed by the GitLab itself.

0
Comment actions Permalink

Hi Piotr - I'm following up on a related comment that was posted in the YouTrack documentation. Based on the instructions in the GitLab documentation (https://docs.gitlab.com/ee/user/project/integrations/custom_issue_tracker.html#custom-issue-tracker-service), I think the problem lies with the Issues url.

URLs in YouTrack don't follow the same pattern that is assumed by GitLab's Custom Issue Tracker service. Instead of using "https://customissuetracker.com/project-name/143", the project ID is used as a prefix to the issue ID itself. The URL in YouTrack would be "https://customissuetracker.com/issue/projectID-143"

I'm wondering if you could try to configure the Custom Issue Tracker service with the following settings:

  • Ignore the Project url setting.
  • For Issues url, use: https://[Youtrack_url]/issue/MPR-:id. If you're using YouTrack InCloud, your base URL includes the trailing /youtrack/. 
  • Ignore the New issue url setting.

If you can get it to work, please let us know. I would be happy to provide additional detail in the documentation to help other users avoid the pain that you have experienced so far.

 

0
Comment actions Permalink

Scott


You are right. Unfortunately "Issues url" on Gitlab configuration page assumes, that this gitlab project/repository should be connected with exactly one project on Youtrack site :/ So of course - it should work if I would define Issues URL as "https://[Youtrack_url]/issue/MPR-:id"

But the thing is - with my gitlab project/repository, I have multiple projects connected on youtrack site :( And this is what I want to achieve. To be able to pinpoint which project and which issue I'm relating to. It is working on "VCS changes" tab in youtrack.

When I push a commit with "MPR-2" as a comment and this commit is being pinned to https://[Youtrack_url]/issue/MPR-2 issue. When I push commit with "OTHERMPR-3" as comment - this commit is being pinned to https://[Youtrack_url]/issue/OTHERMPR-3

I cannot understand - why it is not the same "case" for Gitlab=>Youtrack integration. Of course, it is not Youtrack fault (as this is something in gitlab) For now, the only solution would be - if there would be some placeholder for the project name. Eg.

https://[Youtrack_url]/issue/:projectName-:id - but I didn't hear anything about such placeholder (unfortunately - Ruby is not my field of expertise - and there is no one who is willing to help us with that matter on gitlab forum :/)

0
Comment actions Permalink

Hi Piotr - I too update issues in several projects, so I understand where you're coming from.

Maybe you can set the Issues url to https://[Youtrack_url]/issue/:id and set the references differently in your commit messages? If I get the instructions in the GitLab docs right, you could pin links to issues in different projects using references like #MPR-2 and #OTHERMPR-3

Please give it a try. I'd love to hear that your integration is up and running.

 

0
Comment actions Permalink

Hi Scott

 

What you wrote, is exactly what is not working right now :)

My commit message is : "MPR-123 Some fixes" (i've tried #MPR-123 and MPR-123) and in gitlab - URL that is being created to link this commit to Youtrack issue is:

https://[Youtrack_url]/issue/123 :(

So the project "part" is beeing recognized and discarded.

0
Comment actions Permalink

Hi Piotr,

Sadly, I have tested the configuration and was not able to find a workaround. At this point, I can only say that you can add links to issues in a single project by hard-coding the project prefix into the issues URL. However, commit messages that reference issues in other projects will generate links that point to the wrong issue (if the issue exists at all).

All of the integration features (VCS changes, commands and issue links in commit messages) are handled properly on the YouTrack side. We're going to look into contributing our own project service that sets the links properly in GitLab. We're terribly sorry for the inconvenience.

0
Comment actions Permalink

For anyone who is looking for this GitLab community edition released April 22 2019 now supports this!

0
Comment actions Permalink

@Acorbin3 - that's excellent news. Thanks for letting everybody know about it.

I've added the setup instructions to our documentation: https://www.jetbrains.com/help/youtrack/standalone/Integration-with-GitLab.html#enable-youtrack-integration-gitlab

1

Please sign in to leave a comment.