Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0621c581
Commit
0621c581
authored
Sep 07, 2020
by
Giorgenes Gelatti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor pkg event publication
Introduce the `package_event` helper to unify package tracking logic.
parent
fa85ec72
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
16 deletions
+20
-16
lib/api/composer_packages.rb
lib/api/composer_packages.rb
+1
-1
lib/api/conan_packages.rb
lib/api/conan_packages.rb
+1
-1
lib/api/helpers/packages/conan/api_helpers.rb
lib/api/helpers/packages/conan/api_helpers.rb
+2
-2
lib/api/helpers/packages_helpers.rb
lib/api/helpers/packages_helpers.rb
+4
-0
lib/api/maven_packages.rb
lib/api/maven_packages.rb
+4
-4
lib/api/npm_packages.rb
lib/api/npm_packages.rb
+2
-2
lib/api/nuget_packages.rb
lib/api/nuget_packages.rb
+3
-3
lib/api/pypi_packages.rb
lib/api/pypi_packages.rb
+3
-3
No files found.
lib/api/composer_packages.rb
View file @
0621c581
...
...
@@ -123,7 +123,7 @@ module API
bad_request!
end
track
_event
(
'push_package'
)
package
_event
(
'push_package'
)
::
Packages
::
Composer
::
CreatePackageService
.
new
(
authorized_user_project
,
current_user
,
declared_params
)
...
...
lib/api/conan_packages.rb
View file @
0621c581
...
...
@@ -242,7 +242,7 @@ module API
delete
do
authorize!
(
:destroy_package
,
project
)
track
_event
(
'delete_package'
)
package
_event
(
'delete_package'
)
package
.
destroy
end
...
...
lib/api/helpers/packages/conan/api_helpers.rb
View file @
0621c581
...
...
@@ -124,7 +124,7 @@ module API
conan_package_reference:
params
[
:conan_package_reference
]
).
execute!
track
_event
(
'pull_package'
)
if
params
[
:file_name
]
==
::
Packages
::
Conan
::
FileMetadatum
::
PACKAGE_BINARY
package
_event
(
'pull_package'
)
if
params
[
:file_name
]
==
::
Packages
::
Conan
::
FileMetadatum
::
PACKAGE_BINARY
present_carrierwave_file!
(
package_file
.
file
)
end
...
...
@@ -135,7 +135,7 @@ module API
def
track_push_package_event
if
params
[
:file_name
]
==
::
Packages
::
Conan
::
FileMetadatum
::
PACKAGE_BINARY
&&
params
[
:file
].
size
>
0
# rubocop: disable Style/ZeroLengthPredicate
track
_event
(
'push_package'
)
package
_event
(
'push_package'
)
end
end
...
...
lib/api/helpers/packages_helpers.rb
View file @
0621c581
...
...
@@ -47,6 +47,10 @@ module API
authorize_create_package!
(
subject
)
require_gitlab_workhorse!
end
def
package_event
(
event_name
,
**
args
)
track_event
(
event_name
,
**
args
)
end
end
end
end
lib/api/maven_packages.rb
View file @
0621c581
...
...
@@ -107,7 +107,7 @@ module API
when
'sha1'
package_file
.
file_sha1
else
track
_event
(
'pull_package'
)
if
jar_file?
(
format
)
package
_event
(
'pull_package'
)
if
jar_file?
(
format
)
present_carrierwave_file_with_head_support!
(
package_file
.
file
)
end
end
...
...
@@ -145,7 +145,7 @@ module API
when
'sha1'
package_file
.
file_sha1
else
track
_event
(
'pull_package'
)
if
jar_file?
(
format
)
package
_event
(
'pull_package'
)
if
jar_file?
(
format
)
present_carrierwave_file_with_head_support!
(
package_file
.
file
)
end
...
...
@@ -181,7 +181,7 @@ module API
when
'sha1'
package_file
.
file_sha1
else
track
_event
(
'pull_package'
)
if
jar_file?
(
format
)
package
_event
(
'pull_package'
)
if
jar_file?
(
format
)
present_carrierwave_file_with_head_support!
(
package_file
.
file
)
end
...
...
@@ -233,7 +233,7 @@ module API
when
'md5'
nil
else
track
_event
(
'push_package'
)
if
jar_file?
(
format
)
package
_event
(
'push_package'
)
if
jar_file?
(
format
)
file_params
=
{
file:
params
[
:file
],
...
...
lib/api/npm_packages.rb
View file @
0621c581
...
...
@@ -141,7 +141,7 @@ module API
package_file
=
::
Packages
::
PackageFileFinder
.
new
(
package
,
params
[
:file_name
]).
execute!
track
_event
(
'pull_package'
)
package
_event
(
'pull_package'
)
present_carrierwave_file!
(
package_file
.
file
)
end
...
...
@@ -157,7 +157,7 @@ module API
put
':id/packages/npm/:package_name'
,
requirements:
NPM_ENDPOINT_REQUIREMENTS
do
authorize_create_package!
(
user_project
)
track
_event
(
'push_package'
)
package
_event
(
'push_package'
)
created_package
=
::
Packages
::
Npm
::
CreatePackageService
.
new
(
user_project
,
current_user
,
params
.
merge
(
build:
current_authenticated_job
)).
execute
...
...
lib/api/nuget_packages.rb
View file @
0621c581
...
...
@@ -105,7 +105,7 @@ module API
package_file
=
::
Packages
::
CreatePackageFileService
.
new
(
package
,
file_params
)
.
execute
track
_event
(
'push_package'
)
package
_event
(
'push_package'
)
::
Packages
::
Nuget
::
ExtractionWorker
.
perform_async
(
package_file
.
id
)
# rubocop:disable CodeReuse/Worker
...
...
@@ -198,7 +198,7 @@ module API
not_found!
(
'Package'
)
unless
package_file
track
_event
(
'pull_package'
)
package
_event
(
'pull_package'
)
# nuget and dotnet don't support 302 Moved status codes, supports_direct_download has to be set to false
present_carrierwave_file!
(
package_file
.
file
,
supports_direct_download:
false
)
...
...
@@ -233,7 +233,7 @@ module API
.
new
(
authorized_user_project
,
params
[
:q
],
search_options
)
.
execute
track
_event
(
'search_package'
)
package
_event
(
'search_package'
)
present
::
Packages
::
Nuget
::
SearchResultsPresenter
.
new
(
search
),
with:
::
API
::
Entities
::
Nuget
::
SearchResults
...
...
lib/api/pypi_packages.rb
View file @
0621c581
...
...
@@ -72,7 +72,7 @@ module API
package
=
packages_finder
(
project
).
by_file_name_and_sha256
(
filename
,
params
[
:sha256
])
package_file
=
::
Packages
::
PackageFileFinder
.
new
(
package
,
filename
,
with_file_name_like:
false
).
execute
track
_event
(
'pull_package'
)
package
_event
(
'pull_package'
)
present_carrierwave_file!
(
package_file
.
file
,
supports_direct_download:
true
)
end
...
...
@@ -91,7 +91,7 @@ module API
get
'simple/*package_name'
,
format: :txt
do
authorize_read_package!
(
authorized_user_project
)
track
_event
(
'list_package'
)
package
_event
(
'list_package'
)
packages
=
find_package_versions
presenter
=
::
Packages
::
Pypi
::
PackagePresenter
.
new
(
packages
,
authorized_user_project
)
...
...
@@ -122,7 +122,7 @@ module API
authorize_upload!
(
authorized_user_project
)
bad_request!
(
'File is too large'
)
if
authorized_user_project
.
actual_limits
.
exceeded?
(
:pypi_max_file_size
,
params
[
:content
].
size
)
track
_event
(
'push_package'
)
package
_event
(
'push_package'
)
::
Packages
::
Pypi
::
CreatePackageService
.
new
(
authorized_user_project
,
current_user
,
declared_params
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment