Adds field public_package to package details graphql
What does this MR do and why?
Adds a field public_package
which indicates if there is public access to package. I've decided to call it public_package
based on similar fields like public_jobs
Why
In #329253 (closed), we introduced a new option allow anyone to pull
to the Package Registry.
With that option, users can configure private project to let anonymous users to download packages from that project.
The problem is that the package details have some instructions presented and those instructions are currently presenting that a token is mandatory.
Screenshots or screen recordings
N/A
How to set up and validate locally
-
rails c
- Open the rails console -
p = Project.find(1)
- Find a public project within GDK. Project id can be found on the project home page -
FactoryBot.create_list(:npm_package, 5, project: p, name: p.name)
- Creates 5 npm packages -
Add this line if above fails during the creation of files
def fixture_file_upload(*args, **kwargs) Rack::Test::UploadedFile.new(*args, **kwargs) end
-
Packages::Package.last.id
- Get the package id of the last created package -
Open the
http://172.16.123.1:3000/-/graphql-explorer
and query for one of the above created packages{ package(id: "gid://gitlab/Packages::Package/<id>") { id publicPackage } }
-
Visit
Settings > General > Visibility, project features, permissions
of the project in a new tab. -
If project is public, then
publicPackage
should returntrue
-
Set project to private/internal, then
publicPackage
should returnfalse
-
Check the
Allow anyone to pull from Package Registry
checkbox, thenpublicPackage
should returntrue
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 #387822 (closed)