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
6e58bddd
Commit
6e58bddd
authored
Feb 02, 2022
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
7a4cb945
c399d7ab
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
284 additions
and
31 deletions
+284
-31
app/presenters/blobs/unfold_presenter.rb
app/presenters/blobs/unfold_presenter.rb
+1
-1
config/feature_flags/development/json_limited_encoder.yml
config/feature_flags/development/json_limited_encoder.yml
+1
-1
doc/api/deployments.md
doc/api/deployments.md
+71
-1
doc/ci/environments/deployment_approvals.md
doc/ci/environments/deployment_approvals.md
+5
-1
doc/ci/pipelines/settings.md
doc/ci/pipelines/settings.md
+17
-7
doc/ci/yaml/index.md
doc/ci/yaml/index.md
+2
-0
ee/app/assets/javascripts/external_issues_show/components/sidebar/assignee.vue
...ipts/external_issues_show/components/sidebar/assignee.vue
+3
-1
ee/app/assets/javascripts/external_issues_show/components/sidebar/issue_due_date.vue
...xternal_issues_show/components/sidebar/issue_due_date.vue
+6
-4
ee/app/models/ee/deployment.rb
ee/app/models/ee/deployment.rb
+3
-1
ee/lib/ee/api/entities/deployment_extended.rb
ee/lib/ee/api/entities/deployment_extended.rb
+16
-0
ee/spec/fixtures/api/schemas/public_api/v4/deployment_extended.json
...xtures/api/schemas/public_api/v4/deployment_extended.json
+26
-0
ee/spec/frontend/external_issues_show/components/sidebar/__snapshots__/assignee_spec.js.snap
...ow/components/sidebar/__snapshots__/assignee_spec.js.snap
+5
-3
ee/spec/lib/ee/api/entities/deployment_extended_spec.rb
ee/spec/lib/ee/api/entities/deployment_extended_spec.rb
+30
-0
ee/spec/models/deployment_spec.rb
ee/spec/models/deployment_spec.rb
+9
-1
ee/spec/requests/api/deployments_spec.rb
ee/spec/requests/api/deployments_spec.rb
+46
-0
lib/api/deployments.rb
lib/api/deployments.rb
+6
-6
lib/api/entities/deployment_extended.rb
lib/api/entities/deployment_extended.rb
+10
-0
lib/gitlab/json.rb
lib/gitlab/json.rb
+1
-1
spec/fixtures/api/schemas/public_api/v4/deployment.json
spec/fixtures/api/schemas/public_api/v4/deployment.json
+3
-3
spec/lib/api/entities/deployment_extended_spec.rb
spec/lib/api/entities/deployment_extended_spec.rb
+15
-0
spec/presenters/blobs/unfold_presenter_spec.rb
spec/presenters/blobs/unfold_presenter_spec.rb
+8
-0
No files found.
app/presenters/blobs/unfold_presenter.rb
View file @
6e58bddd
...
@@ -108,7 +108,7 @@ module Blobs
...
@@ -108,7 +108,7 @@ module Blobs
def
limit
(
lines
)
def
limit
(
lines
)
return
lines
if
full?
return
lines
if
full?
lines
[
since
-
1
..
to
-
1
]
lines
[
since
-
1
..
to
-
1
]
||
[]
end
end
end
end
end
end
config/feature_flags/development/json_limited_encoder.yml
View file @
6e58bddd
...
@@ -5,4 +5,4 @@ rollout_issue_url:
...
@@ -5,4 +5,4 @@ rollout_issue_url:
milestone
:
'
13.3'
milestone
:
'
13.3'
type
:
development
type
:
development
group
:
group::source code
group
:
group::source code
default_enabled
:
fals
e
default_enabled
:
tru
e
doc/api/deployments.md
View file @
6e58bddd
...
@@ -23,7 +23,7 @@ GET /projects/:id/deployments
...
@@ -23,7 +23,7 @@ GET /projects/:id/deployments
|
`updated_after`
| datetime | no | Return deployments updated after the specified date. Expected in ISO 8601 format (
`2019-03-15T08:00:00Z`
). |
|
`updated_after`
| datetime | no | Return deployments updated after the specified date. Expected in ISO 8601 format (
`2019-03-15T08:00:00Z`
). |
|
`updated_before`
| datetime | no | Return deployments updated before the specified date. Expected in ISO 8601 format (
`2019-03-15T08:00:00Z`
). |
|
`updated_before`
| datetime | no | Return deployments updated before the specified date. Expected in ISO 8601 format (
`2019-03-15T08:00:00Z`
). |
|
`environment`
| string | no | The
[
name of the environment
](
../ci/environments/index.md
)
to filter deployments by. |
|
`environment`
| string | no | The
[
name of the environment
](
../ci/environments/index.md
)
to filter deployments by. |
|
`status`
| string | no | The status to filter deployments by. One of
`created`
,
`running`
,
`success`
,
`failed`
,
`canceled`
.
|
`status`
| string | no | The status to filter deployments by. One of
`created`
,
`running`
,
`success`
,
`failed`
,
`canceled`
,
`blocked`
.
```
shell
```
shell
curl
--header
"PRIVATE-TOKEN: <your_access_token>"
"https://gitlab.example.com/api/v4/projects/1/deployments"
curl
--header
"PRIVATE-TOKEN: <your_access_token>"
"https://gitlab.example.com/api/v4/projects/1/deployments"
...
@@ -201,6 +201,7 @@ Example response:
...
@@ -201,6 +201,7 @@ Example response:
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"created_at"
:
"2016-08-11T11:32:35.444Z"
,
"created_at"
:
"2016-08-11T11:32:35.444Z"
,
"updated_at"
:
"2016-08-11T11:34:01.123Z"
,
"updated_at"
:
"2016-08-11T11:34:01.123Z"
,
"status"
:
"success"
,
"user"
:
{
"user"
:
{
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"username"
:
"root"
,
"username"
:
"root"
,
...
@@ -264,6 +265,29 @@ Example response:
...
@@ -264,6 +265,29 @@ Example response:
}
}
```
```
Deployments created by users on GitLab Premium or higher include the
`approvals`
and
`pending_approval_count`
properties:
```
json
{
"status"
:
"created"
,
"pending_approval_count"
:
0
,
"approvals"
:
[
{
"user"
:
{
"id"
:
49
,
"username"
:
"project_6_bot"
,
"name"
:
"****"
,
"state"
:
"active"
,
"avatar_url"
:
"https://www.gravatar.com/avatar/e83ac685f68ea07553ad3054c738c709?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3000/project_6_bot"
},
"status"
:
"approved"
}
],
...
}
```
## Create a deployment
## Create a deployment
```
plaintext
```
plaintext
...
@@ -311,6 +335,29 @@ Example response:
...
@@ -311,6 +335,29 @@ Example response:
}
}
```
```
Deployments created by users on GitLab Premium or higher include the
`approvals`
and
`pending_approval_count`
properties:
```
json
{
"status"
:
"created"
,
"pending_approval_count"
:
0
,
"approvals"
:
[
{
"user"
:
{
"id"
:
49
,
"username"
:
"project_6_bot"
,
"name"
:
"****"
,
"state"
:
"active"
,
"avatar_url"
:
"https://www.gravatar.com/avatar/e83ac685f68ea07553ad3054c738c709?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3000/project_6_bot"
},
"status"
:
"approved"
}
],
...
}
```
## Update a deployment
## Update a deployment
```
plaintext
```
plaintext
...
@@ -354,6 +401,29 @@ Example response:
...
@@ -354,6 +401,29 @@ Example response:
}
}
```
```
Deployments created by users on GitLab Premium or higher include the
`approvals`
and
`pending_approval_count`
properties:
```
json
{
"status"
:
"created"
,
"pending_approval_count"
:
0
,
"approvals"
:
[
{
"user"
:
{
"id"
:
49
,
"username"
:
"project_6_bot"
,
"name"
:
"****"
,
"state"
:
"active"
,
"avatar_url"
:
"https://www.gravatar.com/avatar/e83ac685f68ea07553ad3054c738c709?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3000/project_6_bot"
},
"status"
:
"approved"
}
],
...
}
```
## List of merge requests associated with a deployment
## List of merge requests associated with a deployment
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35739) in GitLab 12.7.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35739) in GitLab 12.7.
...
...
doc/ci/environments/deployment_approvals.md
View file @
6e58bddd
...
@@ -95,7 +95,11 @@ curl --data "status=approved" \
...
@@ -95,7 +95,11 @@ curl --data "status=approved" \
#### Using the API
#### Using the API
Use the
[
Deployments API
](
../../api/deployments.md
)
to see deployments. The
`status`
field indicates if a deployment is blocked.
Use the
[
Deployments API
](
../../api/deployments.md
)
to see deployments.
-
The
`status`
field indicates if a deployment is blocked.
-
The
`pending_approval_count`
field indicates how many approvals are remaining to run a deployment.
-
The
`approvals`
field contains the deployment's approvals.
## Related features
## Related features
...
...
doc/ci/pipelines/settings.md
View file @
6e58bddd
...
@@ -211,15 +211,25 @@ averaged.
...
@@ -211,15 +211,25 @@ averaged.
To define a coverage-parsing regular expression:
To define a coverage-parsing regular expression:
-
In the GitLab UI:
-
Using the project's
`.gitlab-ci.yml`
, provide a regular expression using the
[
`coverage`
](
../yaml/index.md#coverage
)
keyword. Setting the regular expression this way takes precedence over the project's CI/CD settings.
1.
On the top bar, select
**Menu > Projects**
and find your project.
-
Using the Project's CI/CD settings:
1.
On the left sidebar, select
**Settings > CI/CD**
.
-
Set using the GitLab UI:
1.
Expand
**General pipelines**
.
1.
In the
**Test coverage parsing**
field, enter a regular expression. Leave blank to disable this feature.
-
Using the project's
`.gitlab-ci.yml`
, provide a regular expression using the
[
`coverage`
](
../yaml/index.md#coverage
)
1. On the top bar, select **Menu > Projects** and find your project.
keyword.
1. On the left sidebar, select **Settings > CI/CD**.
1. Expand **General pipelines**.
1. In the **Test coverage parsing** field, enter a regular expression. Leave blank to disable this feature.
-
Set when
[
editing a project
](
../../api/projects.md#edit-project
)
or
[
creating a project
](
../../api/projects.md#create-project
)
using the GitLab API with the
`build_coverage_regex`
attribute:
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your-token>" \
--url 'https://gitlab.com/api/v4/projects/<your-project-ID>' \
--data "build_coverage_regex=<your-regular-expression>"
```
You can use
<https://rubular.com>
to test your regular expression. The regular expression returns the
**last**
You can use
<https://rubular.com>
to test your regular expression. The regular expression returns the
**last**
match found in the output.
match found in the output.
...
...
doc/ci/yaml/index.md
View file @
6e58bddd
...
@@ -1348,6 +1348,8 @@ In this example:
...
@@ -1348,6 +1348,8 @@ In this example:
**Additional details**
:
**Additional details**
:
-
Coverage regular expressions set in
`gitlab-ci.yml`
take precedence over coverage regular expression set in the
[
GitLab UI
](
../pipelines/settings.md#add-test-coverage-results-to-a-merge-request
)
.
-
If there is more than one matched line in the job output, the last line is used
-
If there is more than one matched line in the job output, the last line is used
(the first result of reverse search).
(the first result of reverse search).
-
If there are multiple matches in a single line, the last match is searched
-
If there are multiple matches in a single line, the last match is searched
...
...
ee/app/assets/javascripts/external_issues_show/components/sidebar/assignee.vue
View file @
6e58bddd
...
@@ -68,7 +68,9 @@ export default {
...
@@ -68,7 +68,9 @@ export default {
:sub-label=
"avatarSubLabel"
:sub-label=
"avatarSubLabel"
/>
/>
</gl-avatar-link>
</gl-avatar-link>
<span
v-else
class=
"gl-text-gray-500"
data-testid=
"no-assignee-text"
>
{{
__
(
'
None
'
)
}}
</span>
<div
v-else
class=
"gl-text-gray-500 gl-line-height-14"
data-testid=
"no-assignee-text"
>
{{
__
(
'
None
'
)
}}
</div>
</div>
</div>
<div
<div
...
...
ee/app/assets/javascripts/external_issues_show/components/sidebar/issue_due_date.vue
View file @
6e58bddd
...
@@ -66,10 +66,12 @@ export default {
...
@@ -66,10 +66,12 @@ export default {
</div>
</div>
<div
class=
"hide-collapsed"
>
<div
class=
"hide-collapsed"
>
<div
class=
"title"
>
{{
$options
.
i18n
.
dueDateTitle
}}
</div>
<div
class=
"gl-line-height-20 gl-mb-2 gl-text-gray-900"
>
<div
class=
"value"
data-testid=
"due-date-value"
>
{{
$options
.
i18n
.
dueDateTitle
}}
<strong
v-if=
"dueDate"
>
{{
formattedDueDate
}}
</strong>
</div>
<span
v-else
class=
"no-value"
>
{{
$options
.
i18n
.
none
}}
</span>
<div
class=
"gl-line-height-14"
data-testid=
"due-date-value"
>
<span
v-if=
"dueDate"
class=
"gl-font-weight-bold"
>
{{
formattedDueDate
}}
</span>
<span
v-else
class=
"gl-text-gray-500"
>
{{
$options
.
i18n
.
none
}}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
ee/app/models/ee/deployment.rb
View file @
6e58bddd
...
@@ -32,7 +32,9 @@ module EE
...
@@ -32,7 +32,9 @@ module EE
end
end
def
pending_approval_count
def
pending_approval_count
environment
.
required_approval_count
-
approvals
.
approved
.
count
return
0
unless
blocked?
environment
.
required_approval_count
-
approvals
.
count
end
end
end
end
end
end
ee/lib/ee/api/entities/deployment_extended.rb
0 → 100644
View file @
6e58bddd
# frozen_string_literal: true
module
EE
module
API
module
Entities
module
DeploymentExtended
extend
ActiveSupport
::
Concern
prepended
do
expose
:pending_approval_count
expose
:approvals
,
using:
::
API
::
Entities
::
Deployments
::
Approval
end
end
end
end
end
ee/spec/fixtures/api/schemas/public_api/v4/deployment_extended.json
0 → 100644
View file @
6e58bddd
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../../../spec/fixtures/api/schemas/public_api/v4/deployment.json"
},
{
"required"
:
[
"pending_approval_count"
,
"approvals"
],
"properties"
:
{
"pending_approval_count"
:
{
"type"
:
"integer"
},
"approvals"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"deployment_approval.json"
}
},
"additionalProperties"
:
false
}
}
]
}
ee/spec/frontend/external_issues_show/components/sidebar/__snapshots__/assignee_spec.js.snap
View file @
6e58bddd
...
@@ -52,12 +52,14 @@ exports[`ExternalIssuesSidebarAssignee with no assignee template renders templat
...
@@ -52,12 +52,14 @@ exports[`ExternalIssuesSidebarAssignee with no assignee template renders templat
numberofassignees="0"
numberofassignees="0"
/>
/>
<
span
<
div
class="gl-text-gray-500"
class="gl-text-gray-500
gl-line-height-14
"
data-testid="no-assignee-text"
data-testid="no-assignee-text"
>
>
None
None
</span>
</div>
</div>
</div>
<div
<div
...
...
ee/spec/lib/ee/api/entities/deployment_extended_spec.rb
0 → 100644
View file @
6e58bddd
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
::
EE
::
API
::
Entities
::
DeploymentExtended
do
subject
{
::
API
::
Entities
::
DeploymentExtended
.
new
(
deployment
).
as_json
}
describe
'#as_json'
do
let
(
:deployment
)
{
create
(
:deployment
,
:blocked
)
}
before
do
stub_licensed_features
(
protected_environments:
true
)
create
(
:protected_environment
,
project_id:
deployment
.
environment
.
project_id
,
name:
deployment
.
environment
.
name
,
required_approval_count:
2
)
create
(
:deployment_approval
,
:approved
,
deployment:
deployment
)
end
it
'includes fields from deployment entity'
do
is_expected
.
to
include
(
:id
,
:iid
,
:ref
,
:sha
,
:created_at
,
:updated_at
,
:user
,
:environment
,
:deployable
,
:status
)
end
it
'includes pending_approval_count'
do
expect
(
subject
[
:pending_approval_count
]).
to
eq
(
1
)
end
it
'includes approvals'
,
:aggregate_failures
do
expect
(
subject
[
:approvals
].
length
).
to
eq
(
1
)
expect
(
subject
.
dig
(
:approvals
,
0
,
:status
)).
to
eq
(
"approved"
)
end
end
end
ee/spec/models/deployment_spec.rb
View file @
6e58bddd
...
@@ -28,7 +28,7 @@ RSpec.describe Deployment do
...
@@ -28,7 +28,7 @@ RSpec.describe Deployment do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let
(
:deployment
)
{
create
(
:deployment
,
project:
project
,
environment:
environment
)
}
let
(
:deployment
)
{
create
(
:deployment
,
:blocked
,
project:
project
,
environment:
environment
)
}
context
'when Protected Environments feature is available'
do
context
'when Protected Environments feature is available'
do
before
do
before
do
...
@@ -61,6 +61,14 @@ RSpec.describe Deployment do
...
@@ -61,6 +61,14 @@ RSpec.describe Deployment do
expect
(
deployment
.
pending_approval_count
).
to
eq
(
0
)
expect
(
deployment
.
pending_approval_count
).
to
eq
(
0
)
end
end
end
end
context
'with a deployment that is not blocked'
do
let
(
:deployment
)
{
create
(
:deployment
,
:success
,
project:
project
,
environment:
environment
)
}
it
'returns zero'
do
expect
(
deployment
.
pending_approval_count
).
to
eq
(
0
)
end
end
end
end
context
'when Protected Environments feature is not available'
do
context
'when Protected Environments feature is not available'
do
...
...
ee/spec/requests/api/deployments_spec.rb
View file @
6e58bddd
...
@@ -11,7 +11,41 @@ RSpec.describe API::Deployments do
...
@@ -11,7 +11,41 @@ RSpec.describe API::Deployments do
stub_licensed_features
(
protected_environments:
true
)
stub_licensed_features
(
protected_environments:
true
)
end
end
describe
'GET /projects/:id/deployments/:id'
do
let
(
:deployment
)
{
create
(
:deployment
,
:blocked
,
project:
project
)
}
before
do
create
(
:deployment_approval
,
:approved
,
deployment:
deployment
)
project
.
add_developer
(
user
)
end
it
'matches the response schema'
do
get
api
(
"/projects/
#{
project
.
id
}
/deployments/
#{
deployment
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/deployment_extended'
,
dir:
'ee'
)
end
end
describe
'POST /projects/:id/deployments'
do
describe
'POST /projects/:id/deployments'
do
it
'matches the response schema'
do
project
.
add_developer
(
user
)
post
(
api
(
"/projects/
#{
project
.
id
}
/deployments"
,
user
),
params:
{
environment:
environment
.
name
,
sha:
'b83d6e391c22777fca1ed3012fce84f633d7fed0'
,
ref:
'master'
,
tag:
false
,
status:
'success'
}
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/deployment_extended'
,
dir:
'ee'
)
end
context
'when deploying to a protected environment that requires maintainer access'
do
context
'when deploying to a protected environment that requires maintainer access'
do
before
do
before
do
create
(
create
(
...
@@ -114,6 +148,18 @@ RSpec.describe API::Deployments do
...
@@ -114,6 +148,18 @@ RSpec.describe API::Deployments do
)
)
end
end
it
'matches the response schema'
do
project
.
add_developer
(
user
)
put
(
api
(
"/projects/
#{
project
.
id
}
/deployments/
#{
deploy
.
id
}
"
,
user
),
params:
{
status:
'success'
}
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/deployment_extended'
,
dir:
'ee'
)
end
context
'when updating a deployment for a protected environment that requires maintainer access'
do
context
'when updating a deployment for a protected environment that requires maintainer access'
do
before
do
before
do
create
(
create
(
...
...
lib/api/deployments.rb
View file @
6e58bddd
...
@@ -47,7 +47,7 @@ module API
...
@@ -47,7 +47,7 @@ module API
desc
'Gets a specific deployment'
do
desc
'Gets a specific deployment'
do
detail
'This feature was introduced in GitLab 8.11.'
detail
'This feature was introduced in GitLab 8.11.'
success
Entities
::
Deployment
success
Entities
::
Deployment
Extended
end
end
params
do
params
do
requires
:deployment_id
,
type:
Integer
,
desc:
'The deployment ID'
requires
:deployment_id
,
type:
Integer
,
desc:
'The deployment ID'
...
@@ -57,12 +57,12 @@ module API
...
@@ -57,12 +57,12 @@ module API
deployment
=
user_project
.
deployments
.
find
(
params
[
:deployment_id
])
deployment
=
user_project
.
deployments
.
find
(
params
[
:deployment_id
])
present
deployment
,
with:
Entities
::
Deployment
present
deployment
,
with:
Entities
::
Deployment
Extended
end
end
desc
'Creates a new deployment'
do
desc
'Creates a new deployment'
do
detail
'This feature was introduced in GitLab 12.4'
detail
'This feature was introduced in GitLab 12.4'
success
Entities
::
Deployment
success
Entities
::
Deployment
Extended
end
end
params
do
params
do
requires
:environment
,
requires
:environment
,
...
@@ -106,7 +106,7 @@ module API
...
@@ -106,7 +106,7 @@ module API
deployment
=
service
.
execute
deployment
=
service
.
execute
if
deployment
.
persisted?
if
deployment
.
persisted?
present
(
deployment
,
with:
Entities
::
Deployment
,
current_user:
current_user
)
present
(
deployment
,
with:
Entities
::
Deployment
Extended
,
current_user:
current_user
)
else
else
render_validation_error!
(
deployment
)
render_validation_error!
(
deployment
)
end
end
...
@@ -114,7 +114,7 @@ module API
...
@@ -114,7 +114,7 @@ module API
desc
'Updates an existing deployment'
do
desc
'Updates an existing deployment'
do
detail
'This feature was introduced in GitLab 12.4'
detail
'This feature was introduced in GitLab 12.4'
success
Entities
::
Deployment
success
Entities
::
Deployment
Extended
end
end
params
do
params
do
requires
:status
,
requires
:status
,
...
@@ -136,7 +136,7 @@ module API
...
@@ -136,7 +136,7 @@ module API
service
=
::
Deployments
::
UpdateService
.
new
(
deployment
,
declared_params
)
service
=
::
Deployments
::
UpdateService
.
new
(
deployment
,
declared_params
)
if
service
.
execute
if
service
.
execute
present
(
deployment
,
with:
Entities
::
Deployment
,
current_user:
current_user
)
present
(
deployment
,
with:
Entities
::
Deployment
Extended
,
current_user:
current_user
)
else
else
render_validation_error!
(
deployment
)
render_validation_error!
(
deployment
)
end
end
...
...
lib/api/entities/deployment_extended.rb
0 → 100644
View file @
6e58bddd
# frozen_string_literal: true
module
API
module
Entities
class
DeploymentExtended
<
Deployment
end
end
end
API
::
Entities
::
DeploymentExtended
.
prepend_mod
lib/gitlab/json.rb
View file @
6e58bddd
...
@@ -248,7 +248,7 @@ module Gitlab
...
@@ -248,7 +248,7 @@ module Gitlab
# @return [String]
# @return [String]
# @raise [LimitExceeded] if the resulting json string is bigger than the specified limit
# @raise [LimitExceeded] if the resulting json string is bigger than the specified limit
def
self
.
encode
(
object
,
limit:
25
.
megabytes
)
def
self
.
encode
(
object
,
limit:
25
.
megabytes
)
return
::
Gitlab
::
Json
.
dump
(
object
)
unless
Feature
.
enabled?
(
:json_limited_encoder
)
return
::
Gitlab
::
Json
.
dump
(
object
)
unless
Feature
.
enabled?
(
:json_limited_encoder
,
default_enabled: :yaml
)
buffer
=
StringIO
.
new
buffer
=
StringIO
.
new
buffer_size
=
0
buffer_size
=
0
...
...
spec/fixtures/api/schemas/public_api/v4/deployment.json
View file @
6e58bddd
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
"created_at"
,
"created_at"
,
"updated_at"
,
"updated_at"
,
"user"
,
"user"
,
"deployable"
"deployable"
,
"status"
],
],
"properties"
:
{
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"id"
:
{
"type"
:
"integer"
},
...
@@ -30,6 +31,5 @@
...
@@ -30,6 +31,5 @@
]
]
},
},
"status"
:
{
"type"
:
"string"
}
"status"
:
{
"type"
:
"string"
}
},
}
"additionalProperties"
:
false
}
}
spec/lib/api/entities/deployment_extended_spec.rb
0 → 100644
View file @
6e58bddd
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
API
::
Entities
::
DeploymentExtended
do
describe
'#as_json'
do
subject
{
described_class
.
new
(
deployment
).
as_json
}
let
(
:deployment
)
{
create
(
:deployment
)
}
it
'includes fields from deployment entity'
do
is_expected
.
to
include
(
:id
,
:iid
,
:ref
,
:sha
,
:created_at
,
:updated_at
,
:user
,
:environment
,
:deployable
,
:status
)
end
end
end
spec/presenters/blobs/unfold_presenter_spec.rb
View file @
6e58bddd
...
@@ -206,6 +206,14 @@ RSpec.describe Blobs::UnfoldPresenter do
...
@@ -206,6 +206,14 @@ RSpec.describe Blobs::UnfoldPresenter do
end
end
end
end
context
'when since exceeds number of lines'
do
let
(
:params
)
{
{
since:
2
}
}
it
'returns an empty list'
do
expect
(
subject
.
lines
.
size
).
to
eq
(
0
)
end
end
context
'when full is true'
do
context
'when full is true'
do
let
(
:params
)
{
{
full:
true
}
}
let
(
:params
)
{
{
full:
true
}
}
...
...
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