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
75f80036
Commit
75f80036
authored
Feb 07, 2020
by
Giorgenes Gelatti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve conan packages code quality
parent
d880633f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
ee/lib/api/conan_packages.rb
ee/lib/api/conan_packages.rb
+21
-7
No files found.
ee/lib/api/conan_packages.rb
View file @
75f80036
...
...
@@ -391,15 +391,31 @@ module API
present_carrierwave_file!
(
package_file
.
file
)
end
def
find_or_create_package
package
||
::
Packages
::
Conan
::
CreatePackageService
.
new
(
project
,
current_user
,
params
).
execute
end
def
track_push_package_event
if
params
[
:file_name
]
==
::
Packages
::
ConanFileMetadatum
::
PACKAGE_BINARY
&&
params
[
'file.size'
].
positive?
track_event
(
'push_package'
)
end
end
def
create_package_file_with_type
(
file_type
,
current_package
)
unless
params
[
'file.size'
]
==
0
# conan sends two upload requests, the first has no file, so we skip record creation if file.size == 0
::
Packages
::
Conan
::
CreatePackageFileService
.
new
(
current_package
,
uploaded_package_file
,
params
.
merge
(
conan_file_type:
file_type
)).
execute
end
end
def
upload_package_file
(
file_type
)
authorize_upload!
(
project
)
current_package
=
package
||
::
Packages
::
Conan
::
CreatePackageService
.
new
(
project
,
current_user
,
params
).
execut
e
current_package
=
find_or_create_packag
e
track_
event
(
'push_package'
)
if
params
[
:file_name
]
==
::
Packages
::
ConanFileMetadatum
::
PACKAGE_BINARY
&&
params
[
'file.size'
].
positive?
track_
push_package_event
# conan sends two upload requests, the first has no file, so we skip record creation if file.size == 0
::
Packages
::
Conan
::
CreatePackageFileService
.
new
(
current_package
,
uploaded_package_file
,
params
.
merge
(
conan_file_type:
file_type
)).
execute
unless
params
[
'file.size'
]
==
0
create_package_file_with_type
(
file_type
,
current_package
)
rescue
ObjectStorage
::
RemoteStoreError
=>
e
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
file_name:
params
[
:file_name
],
project_id:
project
.
id
)
...
...
@@ -416,9 +432,7 @@ module API
def
find_user_from_job_token
return
unless
route_authentication_setting
[
:job_token_allowed
]
job
=
find_job_from_token
raise
::
Gitlab
::
Auth
::
UnauthorizedError
unless
job
job
=
find_job_from_token
||
raise
(
::
Gitlab
::
Auth
::
UnauthorizedError
)
job
.
user
end
...
...
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