GitLab bridge: URL param unclear and runtime error

Labels: lifecycle/rotten

Timeline

Timothée Mazzucotelli (pawamoy) opened (edited)

git-bug v0.7.2 linux adm64

Is it the server URL or a project URL?

When I run the command shown in the example of the help message, providing the server URL, git-bug asks me again the server URL, and then crashes:

$ git bug bridge configure --name=default --target=gitlab --url=https://my-private-gitlab.fr --login=mylogin --token=mytoken
Gitlab server URL [https://gitlab.com/]: https://my-private-gitlab.fr
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/MichaelMure/git-bug/bridge/gitlab.getProjectPath(0xc0000a0000, 0x18, 0x7ffd555304cb, 0x18, 0xc00019f9f8, 0x8d8c215f, 0x59256ae20b047479, 0xc0000b2480)
        /home/michael/dev/git-bug/bridge/gitlab/config.go:244 +0x315
github.com/MichaelMure/git-bug/bridge/gitlab.validateProjectURL(0xc0000a0000, 0x18, 0x7ffd555304cb, 0x18, 0xc0000aa000, 0x0, 0x0, 0x2)
        /home/michael/dev/git-bug/bridge/gitlab/config.go:267 +0x59
github.com/MichaelMure/git-bug/bridge/gitlab.(*Gitlab).Configure(0x113e120, 0xc000020100, 0x7ffd555304cb, 0x18, 0x0, 0x0, 0x7ffd555304ec, 0x8, 0x0, 0x0, ...)
        /home/michael/dev/git-bug/bridge/gitlab/config.go:113 +0x1cc
github.com/MichaelMure/git-bug/bridge/core.(*Bridge).Configure(0xc00007e900, 0x7ffd555304cb, 0x18, 0x0, 0x0, 0x7ffd555304ec, 0x8, 0x0, 0x0, 0x7ffd555304fd, ...)
        /home/michael/dev/git-bug/bridge/core/bridge.go:208 +0xb5
github.com/MichaelMure/git-bug/commands.runBridgeConfigure(0x10fe720, 0xc00022b400, 0x0, 0x5, 0x0, 0x0)
        /home/michael/dev/git-bug/commands/bridge_configure.go:83 +0x278
github.com/spf13/cobra.(*Command).execute(0x10fe720, 0xc00022b3b0, 0x5, 0x5, 0x10fe720, 0xc00022b3b0)
        /home/michael/go/pkg/mod/github.com/spf13/cobra@v0.0.6/command.go:840 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x1100e80, 0x0, 0x0, 0x0)
        /home/michael/go/pkg/mod/github.com/spf13/cobra@v0.0.6/command.go:945 +0x336
github.com/spf13/cobra.(*Command).Execute(...)
        /home/michael/go/pkg/mod/github.com/spf13/cobra@v0.0.6/command.go:885
github.com/MichaelMure/git-bug/commands.Execute()
        /home/michael/dev/git-bug/commands/root.go:54 +0x2d
main.main()
        /home/michael/dev/git-bug/git-bug.go:14 +0x25

Michael Muré (MichaelMure) commented

Would you mind checking if that bug still exist in master? v0.7.2 is very old. I need to make a new release, working my way there.

Timothée Mazzucotelli (pawamoy) commented

Latest says "Error: bad project url" for the GitHub bridge, nothing for the GitLab one, so I guess --url should be given the project URL and not the server URL. Using the GitLab bridge, I'm prompted again to enter the server URL, and it doesn't crash once I've entered it :+1:

Michael Muré (MichaelMure) commented

This is what the doc says: -u, --url string The URL of the remote repository

However, we could use something a bit more robust, giving more useful feedback. If you care for it, that'd be welcome.

Rauno Ots (Rots) commented (edited)

The URLs are not clear at all... --url=https:/xxx/gitlab/group/subgroup/repo --base-url https://xxx/gitlab gives me: Error: project validation: wrong token scope ou non-existent project: GET https://xxx/gitlab/api/v4/projects/gitlab/group/subgroup/repo: 404 {message: 404 Project Not Found}

git-bug version: 0.8.0

github-actions (github-actions) commented

This bot triages untriaged issues and PRs according to the following rules:

  • After 90 days of inactivity, the lifecycle/stale label is applied
  • After 30 days of inactivity since lifecycle/stale was applied, the issue is closed

To remove the stale status, you can:

  • Remove the lifecycle/stale label
  • Comment on this issue

github-actions (github-actions) added label lifecycle/stale

github-actions (github-actions) commented

This bot triages issues in order to help the maintainers identify what needs attention, according to the following lifecycle rules:

  • After 90 days of inactivity, lifecycle/stale is applied
  • After 90 days of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied

This bot will not automatically close stale issues.

To remove the stale status, you can:

  • Remove the stale label from this issue
  • Comment on this issue
  • Close this issue
  • Offer to help out with triaging

To avoid automatic lifecycle management of this issue, add lifecycle/frozen.

github-actions (github-actions) added label lifecycle/rotten

github-actions (github-actions) removed label lifecycle/stale

Timothée Mazzucotelli (pawamoy) closed the bug