Create Packages::Go::Package class for golang packages
Context
Step by step we want to complete the refactoring and extract every package format from Packages::Package
to its own class.
What does this MR do and why?
This MR introduces Packages::Go::Package
class for rubygems packages.
Go Proxy is in alpha https://docs.gitlab.com/ee/user/packages/go_proxy/
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
No.
How to set up and validate locally
Prerequisites
-
Enable the feature flag
Feature.enable(:go_proxy)
-
Create a go module and push it to the repository.
The steps to create a simple go module are described here
-
Add a new tag to the project. For example
v0.1.0
-
Trigger the sync service in the
rails console
to create a new Go package.Packages::Go::SyncPackagesService.new(<project>, <tag_name>).execute_async
Verification
Since pulling the Go module requires HTTPS
setup I listed the API endpoints that might be used to verify the changes using curl
module_name
is equal to host + project's full path. For example: gdk.test/packages/greetings
-
Get all tagged versions for a given Go module
curl --header "Authorization: Bearer <PAT>" http://gdk.test:3000/api/v4/projects/<project_id>/packages/go/<module_name>/@v/list
The response should contain the module's version.
-
Get all tagged versions for a given Go module
curl --header "Authorization: Bearer <PAT>" http://gdk.test:3000/api/v4/projects/<project_id>/packages/go/<module_name>/@v/<version>.info
The response should contain the module's version with a timestamp.
-
Get the module file of a given module version
curl --header "Authorization: Bearer <PAT>" http://gdk.test:3000/api/v4/projects/<project_id>/packages/go/<module_name>/@v/<version>.mod
The response should contain the module's information.
-
Get a zip of the source of the given module version
curl --header "Authorization: Bearer <PAT>" http://gdk.test:3000/api/v4/projects/<project_id>/packages/go/<module_name>/@v/<version>.zip > mod.zip
The
mod.zip
should contain the packed Go module.
Related to #435830 (closed)