gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
13.01k stars 1.24k forks source link

Two different projects can be added with the same slug #6600

Closed jldec closed 3 years ago

jldec commented 3 years ago

It's quite common to own repos in different GitHub orgs with the same repo name. E.g. website or commonly forked repos.

Adding those as projects under the same user or team results in projects with the same slug.

This creates a variety of problems e.g. clicking on either of the 2 projects in the Projects list, opens the same project tabs in the UI (the other project cannot be opened).

Screenshot 2021-11-08 at 02 34 04

To reproduce

Suggested mitigation

see comment below

JanKoehnlein commented 3 years ago

/schedule

roboquat commented 3 years ago

@JanKoehnlein: Issue scheduled in the meta team (WIP: 0)

In response to [this](https://github.com/gitpod-io/gitpod/issues/6600#issuecomment-963352279): >/schedule Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
laushinka commented 3 years ago

Checked it together with @jldec and it's because of how we structure our url /projects/:projectName/ - it assumes projectName will always be unique. This problem doesn't occur when the same project names are in different teams. We'll write down ideas here on how best to solve this name collision.

jldec commented 3 years ago

Discussed ideas with @laushinka for how to address this issue short term (without redesigning the flow.)

The simplest way may be to block users from creating projects with the same slug in the same team, the same way we block projects which point to the same repo.

In this case, it would be nice to tell users which existing project (in the same team) is using the slug - e.g. with a message like "Name already used by project-x" instead of the rather obscure "already taken" message below.

Screenshot 2021-11-08 at 17 19 12

laushinka commented 3 years ago

Mentioning @AlexTugarev here after a brief mention of this issue earlier today.

laushinka commented 3 years ago

Also looping-in @gtsiolis for the text and design.

jldec commented 3 years ago

A refinement of the above suggested behavior (which simply blocks creation of a duplicate slug) would be somehow to track the GitHub org (or GitLab group) associated with a team, and issue a warning when anyone creates a project which potentially shadows an existing repo in that org.

A variation would be a bulk project creation feature, which helps users to mirror all or some of the repos in the org/group, as projects in the team.

jankeromnes commented 3 years ago

What about using a suffix to guarantee that new Project slugs are always unique within the Team?

E.g. in your example:

jankeromnes commented 3 years ago

Alternatively, we could also use input field validation to enforce uniqueness, and allow users to edit the slug until it is unique, like when creating new GitHub repositories:

Screenshot 2021-11-22 at 18 30 48
jldec commented 3 years ago

Excellent ideas - I like them both.

Let's move forward the automatic addition of -2, -3, ... for the 2nd, 3rd slug etc. if it isn't too much extra work to implement. That's much better than simply blocking the process as proposed earlier.

I don't think we have a good place in the /new UI to prompt for the slug name - but the proposed owner + name + validation input UI would great for a separate enhancement which allows users to modify the project team/owner and slug in the Project settings later. Was that the place where you were imagining it @jankeromnes ?

jankeromnes commented 3 years ago

Let's move forward the automatic addition of -2, -3, ... for the 2nd, 3rd slug etc. if it isn't too much extra work to implement. That's much better than simply blocking the process as proposed earlier.

Sure! Sounds good to me. 👍

/assign

Was that the place where you were imagining it @jankeromnes ?

I was more thinking of a single page that contains the entire Project creation flow (i.e. replacing our current multi-page wizard flow). Such a UI could live in there, although I don't have a very clear picture of what exactly such a single page form should look like.