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
f246db44
Commit
f246db44
authored
Aug 27, 2019
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deployable nil exception on job controller
When deployable is nil, we gracefully take care of the case.
parent
153f25af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
1 deletion
+23
-1
app/serializers/deployment_entity.rb
app/serializers/deployment_entity.rb
+1
-1
changelogs/unreleased/fix-nil-deployable-exception-on-job-controller-show.yml
...d/fix-nil-deployable-exception-on-job-controller-show.yml
+5
-0
spec/features/projects/jobs_spec.rb
spec/features/projects/jobs_spec.rb
+8
-0
spec/serializers/deployment_entity_spec.rb
spec/serializers/deployment_entity_spec.rb
+9
-0
No files found.
app/serializers/deployment_entity.rb
View file @
f246db44
...
...
@@ -23,7 +23,7 @@ class DeploymentEntity < Grape::Entity
expose
:last?
expose
:deployed_by
,
as: :user
,
using:
UserEntity
expose
:deployable
do
|
deployment
,
opts
|
expose
:deployable
,
if:
->
(
deployment
)
{
deployment
.
deployable
.
present?
}
do
|
deployment
,
opts
|
deployment
.
deployable
.
yield_self
do
|
deployable
|
if
include_details?
JobEntity
.
represent
(
deployable
,
opts
)
...
...
changelogs/unreleased/fix-nil-deployable-exception-on-job-controller-show.yml
0 → 100644
View file @
f246db44
---
title
:
Fix users cannot access job detail page when deployable does not exist
merge_request
:
32247
author
:
type
:
fixed
spec/features/projects/jobs_spec.rb
View file @
f246db44
...
...
@@ -609,6 +609,14 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
expect
(
find
(
'.js-environment-link'
)[
'href'
]).
to
match
(
"environments/
#{
environment
.
id
}
"
)
expect
(
find
(
'.js-job-deployment-link'
)[
'href'
]).
to
include
(
second_deployment
.
deployable
.
project
.
path
,
second_deployment
.
deployable_id
.
to_s
)
end
context
'when deployment does not have a deployable'
do
let!
(
:second_deployment
)
{
create
(
:deployment
,
:success
,
environment:
environment
,
deployable:
nil
)
}
it
'has an empty href'
do
expect
(
find
(
'.js-job-deployment-link'
)[
'href'
]).
to
be_empty
end
end
end
context
'job failed to deploy'
do
...
...
spec/serializers/deployment_entity_spec.rb
View file @
f246db44
...
...
@@ -36,6 +36,15 @@ describe DeploymentEntity do
expect
(
subject
).
to
include
(
:deployed_at
)
end
context
'when deployable is nil'
do
let
(
:entity
)
{
described_class
.
new
(
deployment
,
request:
request
,
deployment_details:
false
)
}
let
(
:deployment
)
{
create
(
:deployment
,
deployable:
nil
,
project:
project
)
}
it
'does not expose deployable entry'
do
expect
(
subject
).
not_to
include
(
:deployable
)
end
end
context
'when the pipeline has another manual action'
do
let
(
:other_build
)
{
create
(
:ci_build
,
:manual
,
name:
'another deploy'
,
pipeline:
pipeline
)
}
let!
(
:other_deployment
)
{
create
(
:deployment
,
deployable:
other_build
)
}
...
...
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