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
412a3857
Commit
412a3857
authored
May 06, 2019
by
Grzegorz Bizon
Committed by
Filipa Lacerda
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not serialize a deployment commit showing a job
parent
1052f64c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
app/serializers/build_details_entity.rb
app/serializers/build_details_entity.rb
+5
-1
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+2
-0
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+24
-0
No files found.
app/serializers/build_details_entity.rb
View file @
412a3857
...
...
@@ -13,7 +13,11 @@ class BuildDetailsEntity < JobEntity
expose
:deployment_status
,
if:
->
(
*
)
{
build
.
starts_environment?
}
do
expose
:deployment_status
,
as: :status
expose
:persisted_environment
,
as: :environment
,
with:
EnvironmentEntity
expose
:persisted_environment
,
as: :environment
do
|
build
,
options
|
options
.
merge
(
except:
[{
last_deployment:
[
:commit
]
}]).
yield_self
do
|
opts
|
EnvironmentEntity
.
represent
(
build
.
persisted_environment
,
opts
)
end
end
end
expose
:artifact
,
if:
->
(
*
)
{
can?
(
current_user
,
:read_build
,
build
)
}
do
...
...
spec/controllers/projects/jobs_controller_spec.rb
View file @
412a3857
...
...
@@ -269,6 +269,8 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
expect
(
json_response
.
dig
(
'deployment_status'
,
'status'
)).
to
eq
'creating'
expect
(
json_response
.
dig
(
'deployment_status'
,
'environment'
)).
not_to
be_nil
expect
(
json_response
.
dig
(
'deployment_status'
,
'environment'
,
'last_deployment'
)).
not_to
be_nil
expect
(
json_response
.
dig
(
'deployment_status'
,
'environment'
,
'last_deployment'
))
.
not_to
include
(
'commit'
)
end
end
...
...
spec/serializers/build_details_entity_spec.rb
View file @
412a3857
...
...
@@ -122,5 +122,29 @@ describe BuildDetailsEntity do
it
{
is_expected
.
to
include
(
failure_reason:
'unmet_prerequisites'
)
}
end
context
'when a build has environment with latest deployment'
do
let
(
:build
)
do
create
(
:ci_build
,
:running
,
environment:
environment
.
name
,
pipeline:
pipeline
)
end
let
(
:environment
)
do
create
(
:environment
,
project:
project
,
name:
'staging'
,
state: :available
)
end
before
do
create
(
:deployment
,
:success
,
environment:
environment
,
project:
project
)
allow
(
request
).
to
receive
(
:project
).
and_return
(
project
)
end
it
'does not serialize latest deployment commit'
do
response
=
subject
.
with_indifferent_access
response
.
dig
(
:deployment_status
,
:environment
,
:last_deployment
).
tap
do
|
deployment
|
expect
(
deployment
).
not_to
include
(
:commit
)
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