Skip to content

New feature: per-group client repository definition #52

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

fdbastionamio
Copy link
Contributor

@fdbastionamio fdbastionamio commented Jul 23, 2023

Resolves #51
This introduces the notion of 'scope' which is either 'Project' (default) or 'Group'

To pull dependencies from a group package manager, clients use an url with the following cargo/config.toml registries

[registries]
# Per-project registry:
# internal_project_registry = { index = "ssh://my.gitlab:2222/my_group/my_subgroup/my_project" } # per-project repo

# Per-group registry: set the path to the group path, add ?scope=group at the end
internal_group_registry = { index = "ssh://my.gitlab:222/my_group/my_subgroup/?scope=group" }

Limitations

  • The project name and the crate file must match or this will fail on the client's side when performing the http fetch.
  • Packages cannot be fetched for subgroups under the given group.
  • Untested on multi-crates workspaces

This PR also filters packages by type so that only generic packages are being considered as some groups publish heterogenous packages (python / maven / generic)

@w4
Copy link
Owner

w4 commented Jul 26, 2023

Thanks for the MR, last time I attempted this I ran into some issues with the download portion as there's no group-level download API - I attempted to contribute something for that in gitlab!82663 but it was ultimately rejected.

I don't see anything group-level in https://docs.gitlab.com/ee/user/packages/generic_packages/ - are these undocumented APIs?

@fdoyon
Copy link

fdoyon commented Aug 9, 2023

@w4 I am not querying the package per-group but instead asking the users to follow the following convention : have a package name that matches the project name. Then the cargo url template can point to the generic package download URL.

It is very suboptimal, but there is indeed no API to download packages at the group level - I will see if I can submit a patch to gitlab to include an actual package manager.

@w4
Copy link
Owner

w4 commented Nov 10, 2023

The way I've worked around this limitation in our internal fork is a HTTP server that can serve redirects to known crates. Could be another one to upstream, but does mean a greater attack surface for the application.

@loyd
Copy link

loyd commented Dec 4, 2024

@w4, thanks for the shim!

Could be another one to upstream, but does mean a greater attack surface for the application.

Has anything changed since the creation of this PR?

@w4
Copy link
Owner

w4 commented Dec 7, 2024

Hi @loyd, our current implementation uses the original approach from this repo which relies on this patch to Gitlab -- which they ultimately rejected to take into their upstream. Another problem is that CI tokens cannot call group-level endpoints, which would force the use of a root token - we are currently working around this with the GraphQL API, but Gitlab are actively working against us here because 16.11.7 recently put this behind a disabled-by-default feature flag with intent to remove 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support group package repositories
4 participants