Debian direct deb and udeb upload
What does this MR do and why?
Describe in detail what your merge request does and why.
This is item 5.3 of &6057 (comment 582697034).
How to test
-
Get a private token
$api_token
(with API scope). Example:$ api_token=glpat-ABCDE
-
Create a project, get the
$project id
. Example:$ project_id=28
-
Define distribution variables:
$codename
and$suite
. Example :$ codename=foobar $ suite=baz
-
Enable Debian packages for the project
Feature.enable(:debian_packages, Project.find(28)
-
Create a distribution:
$ curl --request POST --header "PRIVATE-TOKEN: $api_token" "http://localhost:3000/api/v4/projects/$project_id/debian_distributions?codename=$codename&suite=$suite" {"id":1,"codename":"foobar","suite":"baz","origin":null,"label":null,"version":null,"description":null,"valid_time_duration_seconds":null,"components":["main"],"architectures":["all","amd64"]}
-
Upload:
$ curl --request PUT --user "a:$api_token" "http://localhost:3000/api/v4/projects/$project_id/packages/debian/?distribution=$codename&component=main" --upload-file spec/fixtures/packages/debian/sample-dev_1.2.3~binary_amd64.deb {"message":"201 Created"}
-
Verify that the package is visible in the interface and available in the repository
$ sudo mkdir -p /usr/local/share/keyrings $ curl --header "PRIVATE-TOKEN: $api_token" \ "http://localhost:3000/api/v4/projects/$project_id/debian_distributions/$codename/key.asc" \ | \ gpg --dearmor \ | \ sudo tee /usr/local/share/keyrings/$codename-archive-keyring.gpg \ > /dev/null $ echo "machine http://localhost:3000 login noidea password $api_token" \ | sudo tee /etc/apt/auth.conf.d/gitlab_project.conf $ echo "deb [ signed-by=/usr/local/share/keyrings/$codename-archive-keyring.gpg ] http://localhost:3000/api/v4/projects/$project_id/packages/debian $codename main" \ | sudo tee /etc/apt/sources.list.d/gitlab_project.list > /dev/null $ sudo apt-get update [snip] $ apt show sample-dev Package: sample-dev Version: 1.2.3~binary Priority: optional Section: libdevel Source: sample (1.2.3~alpha2) Maintainer: John Doe <john.doe@example.com> Installed-Size: 7 168 B Depends: libsample0 (= 1.2.3~binary) Homepage: https://gitlab.com/ Download-Size: 1 164 B APT-Sources: http://localhost:3000/api/v4/projects/28/packages/debian foobar/main amd64 Packages Description: Some mostly empty development files Used in GitLab tests. . Testing another paragraph.
Edited by Mathieu Parent