Commit 0282ab15 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'maven_api_event_tracking' into 'master'

Add event tracking to Maven API

See merge request gitlab-org/gitlab!23121
parents b09b5ed6 a95c85ad
......@@ -27,7 +27,7 @@ module API
if %w(md5 sha1).include?(format)
[name, format]
else
[file_name, nil]
[file_name, format]
end
end
......@@ -46,6 +46,10 @@ module API
project_path = path.rpartition('/').first
Project.find_by_full_path(project_path)
end
def jar_file?(format)
format == 'jar'
end
end
desc 'Download the maven package file at instance level' do
......@@ -79,7 +83,9 @@ module API
package_file.file_md5
when 'sha1'
package_file.file_sha1
when nil
else
track_event('pull_package') if jar_file?(format)
present_carrierwave_file!(package_file.file)
end
end
......@@ -117,7 +123,9 @@ module API
package_file.file_md5
when 'sha1'
package_file.file_sha1
when nil
else
track_event('pull_package') if jar_file?(format)
present_carrierwave_file!(package_file.file)
end
end
......@@ -155,12 +163,14 @@ module API
package_file.file_md5
when 'sha1'
package_file.file_sha1
when nil
else
track_event('pull_package') if jar_file?(format)
present_carrierwave_file!(package_file.file)
end
end
desc 'Upload the maven package file' do
desc 'Workhorse authorize the maven package file upload' do
detail 'This feature was introduced in GitLab 11.3'
end
params do
......@@ -215,7 +225,11 @@ module API
.new(package, file_name).execute!
verify_package_file(package_file, uploaded_file)
when nil
when 'md5'
nil
else
track_event('push_package') if jar_file?(format)
file_params = {
file: uploaded_file,
size: params['file.size'],
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment