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
2a27685e
Commit
2a27685e
authored
Oct 12, 2021
by
Hugo Ortiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent push_package event if Composer package creation fails
parent
a0ded336
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
lib/api/composer_packages.rb
lib/api/composer_packages.rb
+2
-2
spec/support/shared_examples/requests/api/composer_packages_shared_examples.rb
...xamples/requests/api/composer_packages_shared_examples.rb
+11
-0
No files found.
lib/api/composer_packages.rb
View file @
2a27685e
...
@@ -137,12 +137,12 @@ module API
...
@@ -137,12 +137,12 @@ module API
bad_request!
bad_request!
end
end
track_package_event
(
'push_package'
,
:composer
,
project:
authorized_user_project
,
user:
current_user
,
namespace:
authorized_user_project
.
namespace
)
::
Packages
::
Composer
::
CreatePackageService
::
Packages
::
Composer
::
CreatePackageService
.
new
(
authorized_user_project
,
current_user
,
declared_params
.
merge
(
build:
current_authenticated_job
))
.
new
(
authorized_user_project
,
current_user
,
declared_params
.
merge
(
build:
current_authenticated_job
))
.
execute
.
execute
track_package_event
(
'push_package'
,
:composer
,
project:
authorized_user_project
,
user:
current_user
,
namespace:
authorized_user_project
.
namespace
)
created!
created!
end
end
...
...
spec/support/shared_examples/requests/api/composer_packages_shared_examples.rb
View file @
2a27685e
...
@@ -85,7 +85,18 @@ RSpec.shared_examples 'Composer package creation' do |user_type, status, add_mem
...
@@ -85,7 +85,18 @@ RSpec.shared_examples 'Composer package creation' do |user_type, status, add_mem
expect
(
response
).
to
have_gitlab_http_status
(
status
)
expect
(
response
).
to
have_gitlab_http_status
(
status
)
end
end
it_behaves_like
'a package tracking event'
,
described_class
.
name
,
'push_package'
it_behaves_like
'a package tracking event'
,
described_class
.
name
,
'push_package'
context
'when package creation fails'
do
before
do
allow_next_instance_of
(
::
Packages
::
Composer
::
CreatePackageService
)
do
|
create_package_service
|
allow
(
create_package_service
).
to
receive
(
:execute
).
and_raise
(
StandardError
)
end
end
it_behaves_like
'not a package tracking event'
end
end
end
end
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