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

GitLab: Error when generating URL for Commit Status #1979

Closed
syphernl opened this issue Jan 6, 2022 · 4 comments
Closed

GitLab: Error when generating URL for Commit Status #1979

syphernl opened this issue Jan 6, 2022 · 4 comments
Labels
bug Something isn't working provider/gitlab

Comments

@syphernl
Copy link
Contributor

syphernl commented Jan 6, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Since 0.18.0 (added in #1937) Atlantis attaches an URL to the PR for viewing the real-time status.
However, when using GitLab this results in an error likely due to the fact that the repo's can have a nested names (org/project/repo or even org/project/subproject/subproject/repo rather than org/repo on GitHub) which is not expected.

Reproduction Steps

  • Use Gitlab & Atlantis 0.18.0+
  • Create a MR
  • See the error in the Atlantis console

Logs

Logs
"level":"error","ts":"2022-01-06T07:30:54.802Z","caller":"events/project_command_runner.go:156","msg":"updating project PR status%!(EXTRA *errors.withStack=creating job url for ORG/PROJECT/infra/17/staging-global-cloudfront/staging_global_cloudfront: mux: variable \"ORG/PROJECT\" doesn't match, expected \"^[^/]+$\")","json":{"repo":"ORG/PROJECT/infra","pull":"17"},"stacktrace":"github.com/runatlantis/atlantis/server/events.(*ProjectOutputWrapper).updateProjectPRStatus\n\tgithub.com/runatlantis/atlantis/server/events/project_command_runner.go:156\ngithub.com/runatlantis/atlantis/server/events.(*ProjectOutputWrapper).Plan\n\tgithub.com/runatlantis/atlantis/server/events/project_command_runner.go:129\ngithub.com/runatlantis/atlantis/server/events.runProjectCmdsParallel.func1\n\tgithub.com/runatlantis/atlantis/server/events/project_command_pool_executor.go:28"}

Environment details

If not already included, please provide the following:

  • Atlantis version: 0.18.1
  • If not running the latest Atlantis version have you tried to reproduce this issue on the latest version: yes
  • Atlantis flags:
@syphernl syphernl added the bug Something isn't working label Jan 6, 2022
@nishkrishnan
Copy link
Contributor

Yeah it's likely because the repo field is "PROJECT/infra" and URL generation fails here:
https://github.com/lyft/atlantis/blob/1f44d2ffd190abf9cc5e4a6b286fba1567ce11eb/server/router.go#L45-L46

We should probably sanitize the repo name and replace the "/" with "-". similar to what we do for directories with no project names.

@Delorien84
Copy link

The linked MR does not fix the problem. I have upgraded to 0.18.2 and still have same error originally described by @syphernl

@PertsevRoman
Copy link
Contributor

PertsevRoman commented Jan 29, 2022

Hi @Delorien84 @syphernl ,
I fixed the issue for GitLab #2021 , pls take a look. I'm not sure about the process how it can be included into the trunk, so let's wait :)

@syphernl
Copy link
Contributor Author

Hi @Delorien84 @syphernl , I fixed the issue for GitLab #2021 , pls take a look. I'm not sure about the process how it can be included into the trunk, so let's wait :)

I've tested #2021 locally and it now indeed generates a valid URL which gets attached to a GitLab Pipeline status.
The resulting page however shows an empty console, but this is probably not related to the URL generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider/gitlab
Projects
None yet
Development

No branches or pull requests

6 participants