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
a1791d55
Commit
a1791d55
authored
Aug 13, 2021
by
Steve Abrams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update generic package event tracking with usage ping
parent
39a1040e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
lib/api/generic_packages.rb
lib/api/generic_packages.rb
+2
-2
spec/requests/api/generic_packages_spec.rb
spec/requests/api/generic_packages_spec.rb
+6
-2
No files found.
lib/api/generic_packages.rb
View file @
a1791d55
...
...
@@ -62,7 +62,7 @@ module API
authorize_upload!
(
project
)
bad_request!
(
'File is too large'
)
if
max_file_size_exceeded?
::
Gitlab
::
Tracking
.
event
(
self
.
options
[
:for
].
name
,
'push_package'
,
user:
current_user
,
project:
project
,
namespace:
project
.
namespace
)
track_package_event
(
'push_package'
,
:generic
,
project:
project
,
user:
current_user
,
namespace:
project
.
namespace
)
create_package_file_params
=
declared_params
.
merge
(
build:
current_authenticated_job
)
::
Packages
::
Generic
::
CreatePackageFileService
...
...
@@ -96,7 +96,7 @@ module API
package
=
::
Packages
::
Generic
::
PackageFinder
.
new
(
project
).
execute!
(
params
[
:package_name
],
params
[
:package_version
])
package_file
=
::
Packages
::
PackageFileFinder
.
new
(
package
,
params
[
:file_name
]).
execute!
::
Gitlab
::
Tracking
.
event
(
self
.
options
[
:for
].
name
,
'pull_package'
,
user:
current_user
,
project:
project
,
namespace:
project
.
namespace
)
track_package_event
(
'pull_package'
,
:generic
,
project:
project
,
user:
current_user
,
namespace:
project
.
namespace
)
present_carrierwave_file!
(
package_file
.
file
)
end
...
...
spec/requests/api/generic_packages_spec.rb
View file @
a1791d55
...
...
@@ -388,9 +388,11 @@ RSpec.describe API::GenericPackages do
end
context
'event tracking'
do
let
(
:snowplow_gitlab_standard_context
)
{
{
project:
project
,
namespace:
project
.
namespace
,
user:
user
}
}
subject
{
upload_file
(
params
,
workhorse_headers
.
merge
(
personal_access_token_header
))
}
it_behaves_like
'a
gitlab
tracking event'
,
described_class
.
name
,
'push_package'
it_behaves_like
'a
package
tracking event'
,
described_class
.
name
,
'push_package'
end
it
'rejects request without a file from workhorse'
do
...
...
@@ -542,13 +544,15 @@ RSpec.describe API::GenericPackages do
end
context
'event tracking'
do
let
(
:snowplow_gitlab_standard_context
)
{
{
project:
project
,
namespace:
project
.
namespace
,
user:
user
}
}
before
do
project
.
add_developer
(
user
)
end
subject
{
download_file
(
personal_access_token_header
)
}
it_behaves_like
'a
gitlab
tracking event'
,
described_class
.
name
,
'pull_package'
it_behaves_like
'a
package
tracking event'
,
described_class
.
name
,
'pull_package'
end
it
'rejects a malicious file name request'
do
...
...
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