Redirect GitLab API calls when necessary, after a project transfer or rename

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

Say you transfer/rename a GitLab project. Subsequent calls to the GitLab API using the old URL should automatically redirect to the new URL and return a valid response.

For instance, after transferring
https://gitlab.mydomain.org/MyOldGroup/MyProject
to
https://gitlab.mydomain.org/MyNewGroup/MyProject

The following call will return a valid response
https://gitlab.mydomain.org/api/v4/projects/MyNewGroup%2FMyProject
while
https://gitlab.mydomain.org/api/v4/projects/MyOldGroup%2FMyProject
will return a 404

(Redirection appears to be handled for both git commands and project page access in a web browser.)

Intended users

Further details

Here’s our use case:

  • We have a GitLab project. From it, we build .NET assemblies and publish them in a NuGet package.
  • Later on, when we fetch and extract the NuGet package locally, we have a tool that needs to retrieve some of the project’s attributes stored in GitLab.
  • To determine what that project is, the tool reads in the <projectUrl> from the nuspec file (embedded in the NuGet package).
  • The tool then makes calls to the GitLab API, using the project URL.

Now the problem is that old NuGet packages reference the old URL, but we still want our tool to be able to extract info about those packages.

Proposal

When making a request to the GitLab API about a transferred/renamed project, using the old group and/or project name, the user should obtain valid info. Internally, GitLab should use the new group and/or project name.

Permissions and Security

Documentation

Testing

What does success look like, and how can we measure that?

Links / references

Edited by 🤖 GitLab Bot 🤖