Implement package metadata endpoint on the group level
What does this MR do and why?
This MR is part of #299834 (closed) and adds pull the packages using the group-level endpoint.
Screenshots or screen recordings
None
How to set up and validate locally
-
Create a new npm package that will be installed using the group-level endpoint. For that in rails console run the following:
def fixture_file_upload(*args, **kwargs) Rack::Test::UploadedFile.new(*args, **kwargs) end project = Project.first package = FactoryBot.create(:npm_package, project: project, name: 'hello_world') project.namespace_id # note it down, we'll be using it later project.namespace.path # node it down, we'll be using it later Feature.enable(:npm_group_level_endpoints, Namespace.find(project.namespace_id)) # enable the feature flag for selected namespace
-
Create an empty npm package:
$ mkdir npm-test-group-level && cd $_ $ touch .tool-versions $ echo nodejs 18.16.0 > .tool-versions $ npm init
-
Create
.npmrc
file in the same directory:$ touch .npmrc $ echo @scope:registry=http://gdk.test:3000/api/v4/group/<group_id>/-/packages/npm/ >> .npmrc $ echo //gdk.test:3000/api/v4/groups/<group_id>/-/packages/npm/:_authToken="${TOKEN}" >> .npmrc
Note: Replace
scope
withnamespace.path
and<group_id>
withnamespace_id
from the step 1. -
Install the package:
$ TOKEN=<your_token> npm i hello_world
Note: Replace
<your_token>
with a valid token.When everything goes well, the package gets installed
🎉
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #299834 (closed)
Edited by Dzmitry (Dima) Meshcharakou