runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.82k stars 1.06k forks source link

Personal gitlab projects are not properly resolved. #609

Open lukasmrtvy opened 5 years ago

lukasmrtvy commented 5 years ago

Gitlab personal projects are resolved as mypersonalnamespace/mypersonalproject instead of id For example:

Unable to comment on pull request: POST https://gitlab.example.com/api/v4/projects/mypersonalnamespace/mypersonalproject/merge_requests/3/notes: 404 {message: 404 Project Not Found}

Proper POST should be:

https://gitlab.example.com/api/v4/projects/1151/merge_requests/3/notes

Gitlab version: 11.8

Thanks

lkysow commented 5 years ago

The GitLab API allows using the project numerical ID or a url-encoded NAMESPACE/PROJECT_NAME: https://docs.gitlab.com/ee/api/README.html#namespaced-path-encoding

If you make a request to https://gitlab.example.com/api/v4/projects/mypersonalnamespace%2Fmypersonalproject/merge_requests/3/notes (note the url encoded %2F) then it should work. If you're getting a 404 it might be because your token doesn't have access to that project.

lukasmrtvy commented 5 years ago

@lkysow You are right! This 404 response is confusing me.

fourirakbar commented 2 years ago

hi @lkysow , just confused, how to change that URL from using / to %2F in atlantis ? because I also got 404 when hit https://gitlab.example.com/api/v4/projects/mypersonalnamespace/mypersonalproject/merge_requests/3/notes (I also try hit via browser), but when I change to https://gitlab.example.com/api/v4/projects/mypersonalnamespace%2Fmypersonalproject/merge_requests/3/notes via browser, it works fine

ers81239 commented 2 years ago

I'm going to keep looking, but I'm also seeing this issue in a fresh install of Atlantis 0.19.8 in Docker and my proof of concept using a personal repo worked fine. However, now, when I try to use a repo that is within a Gitlab group, it fails as above. If I manually replace the slash that separates the group and the repo name, it works. Interestingly, the personal repo still works, no problem.

PhilippWitzmann commented 1 year ago

We are also looking for a solution to this problem.

@lukasmrtvy can we reopen this please?

jamengual commented 1 year ago

please use 0.26, 0.19 is pretty old.

On Sun, Nov 12, 2023 at 11:10 PM Philipp Witzmann @.***> wrote:

We are also looking for a solution to this problem.

— Reply to this email directly, view it on GitHub https://github.com/runatlantis/atlantis/issues/609#issuecomment-1807577585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ3ERDK3A4IVALJ5ZOWSILYEHBWDAVCNFSM4HJDWOD2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBQG42TONZVHA2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

PhilippWitzmann commented 1 year ago

We are seeing this in atlantis 0.26 as well paired with private gitlab enterprise 16.5.1 (dont know if this happened earlier as well, since we just deployed atlantis for the first time).

musabmirza-amperon commented 2 months ago

Same here