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
f9f76690
Commit
f9f76690
authored
Sep 22, 2021
by
Shinya Maeda
Committed by
Fabio Pitino
Sep 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure the controller passes Ci::Build to RetryBuildService
parent
b2a333b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
app/controllers/projects/jobs_controller.rb
app/controllers/projects/jobs_controller.rb
+2
-3
app/services/ci/retry_build_service.rb
app/services/ci/retry_build_service.rb
+5
-0
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+4
-0
No files found.
app/controllers/projects/jobs_controller.rb
View file @
f9f76690
...
...
@@ -44,7 +44,7 @@ class Projects::JobsController < Projects::ApplicationController
render
json:
BuildSerializer
.
new
(
project:
@project
,
current_user:
@current_user
)
.
represent
(
@build
,
{},
BuildDetailsEntity
)
.
represent
(
@build
.
present
(
current_user:
current_user
)
,
{},
BuildDetailsEntity
)
end
end
end
...
...
@@ -120,7 +120,7 @@ class Projects::JobsController < Projects::ApplicationController
def
status
render
json:
BuildSerializer
.
new
(
project:
@project
,
current_user:
@current_user
)
.
represent_status
(
@build
)
.
represent_status
(
@build
.
present
(
current_user:
current_user
)
)
end
def
erase
...
...
@@ -225,7 +225,6 @@ class Projects::JobsController < Projects::ApplicationController
def
find_job_as_build
@build
=
project
.
builds
.
find
(
params
[
:id
])
.
present
(
current_user:
current_user
)
end
def
find_job_as_processable
...
...
app/services/ci/retry_build_service.rb
View file @
f9f76690
...
...
@@ -32,6 +32,11 @@ module Ci
# rubocop: disable CodeReuse/ActiveRecord
def
reprocess!
(
build
)
# Cloning a build requires a strict type check to ensure
# the attributes being used for the clone are taken straight
# from the model and not overridden by other abstractions.
raise
TypeError
unless
build
.
instance_of?
(
Ci
::
Build
)
check_access!
(
build
)
new_build
=
clone_build
(
build
)
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
f9f76690
...
...
@@ -283,6 +283,10 @@ RSpec.describe Ci::RetryBuildService do
end
end
it
'raises an error when an unexpected class is passed'
do
expect
{
service
.
reprocess!
(
create
(
:ci_build
).
present
)
}.
to
raise_error
(
TypeError
)
end
context
'when user has ability to execute build'
do
before
do
stub_not_protect_default_branch
...
...
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