Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/debian_project_packages.rb')
-rw-r--r--lib/api/debian_project_packages.rb33
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/api/debian_project_packages.rb b/lib/api/debian_project_packages.rb
index 353f64b8dd1..21c0c219046 100644
--- a/lib/api/debian_project_packages.rb
+++ b/lib/api/debian_project_packages.rb
@@ -14,10 +14,6 @@ module API
file_name: API::NO_SLASH_URL_PART_REGEX
}.freeze
- before do
- not_found! if Gitlab::FIPS.enabled?
- end
-
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
helpers do
def project_or_group
@@ -69,6 +65,7 @@ module API
format :txt
content_type :json, Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE
+ # PUT {projects|groups}/:id/packages/debian/:file_name
desc 'Upload Debian package' do
detail 'This feature was introduced in GitLab 14.0'
success code: 201
@@ -80,12 +77,14 @@ module API
]
tags %w[debian_packages]
end
-
- # PUT {projects|groups}/:id/packages/debian/:file_name
params do
requires :file, type: ::API::Validations::Types::WorkhorseFile, desc: 'The package file to be published (generated by Multipart middleware)', documentation: { type: 'file' }
+ optional :distribution, type: String, desc: 'The Debian Codename or Suite', regexp: Gitlab::Regex.debian_distribution_regex
+ given :distribution do
+ requires :component, type: String, desc: 'The Debian Component', regexp: Gitlab::Regex.debian_component_regex
+ requires :file_name, type: String, desc: 'The filename', regexp: { value: Gitlab::Regex.debian_direct_upload_filename_regex, message: 'Only debs and udebs can be directly added to a distribution' }
+ end
end
-
route_setting :authentication, deploy_token_allowed: true, basic_auth_personal_access_token: true, job_token_allowed: :basic_auth, authenticate_non_public: true
put do
authorize_upload!(authorized_user_project)
@@ -95,10 +94,18 @@ module API
file: params['file'],
file_name: params['file_name'],
file_sha1: params['file.sha1'],
- file_md5: params['file.md5']
+ file_md5: params['file.md5'],
+ distribution: params['distribution'],
+ component: params['component']
}
- package = ::Packages::Debian::FindOrCreateIncomingService.new(authorized_user_project, current_user).execute
+ package = if params[:distribution].present?
+ ::Packages::CreateTemporaryPackageService.new(
+ authorized_user_project, current_user, declared_params.merge(build: current_authenticated_job)
+ ).execute(:debian, name: ::Packages::Debian::TEMPORARY_PACKAGE_NAME)
+ else
+ ::Packages::Debian::FindOrCreateIncomingService.new(authorized_user_project, current_user).execute
+ end
::Packages::Debian::CreatePackageFileService.new(package: package, current_user: current_user, params: file_params).execute
@@ -114,12 +121,20 @@ module API
detail 'This feature was introduced in GitLab 13.5'
success code: 200
failure [
+ { code: 400, message: 'Bad Request' },
{ code: 401, message: 'Unauthorized' },
{ code: 403, message: 'Forbidden' },
{ code: 404, message: 'Not Found' }
]
tags %w[debian_packages]
end
+ params do
+ optional :distribution, type: String, desc: 'The Debian Codename or Suite', regexp: Gitlab::Regex.debian_distribution_regex
+ given :distribution do
+ requires :component, type: String, desc: 'The Debian Component', regexp: Gitlab::Regex.debian_component_regex
+ requires :file_name, type: String, desc: 'The filename', regexp: { value: Gitlab::Regex.debian_direct_upload_filename_regex, message: 'Only debs and udebs can be directly added to a distribution' }
+ end
+ end
route_setting :authentication, deploy_token_allowed: true, basic_auth_personal_access_token: true, job_token_allowed: :basic_auth, authenticate_non_public: true
put 'authorize' do
authorize_workhorse!(