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
d493fea4
Commit
d493fea4
authored
Jan 27, 2022
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REST API: Deprecate active/paused values in status filters
Changelog: deprecated
parent
bbe5f822
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
60 deletions
+161
-60
data/deprecations/14-8-runner-api-status-filter-does-accept-active-or-paused.yml
...runner-api-status-filter-does-accept-active-or-paused.yml
+18
-0
doc/api/runners.md
doc/api/runners.md
+53
-29
doc/update/deprecations.md
doc/update/deprecations.md
+18
-0
lib/api/ci/runners.rb
lib/api/ci/runners.rb
+7
-6
spec/requests/api/ci/runners_spec.rb
spec/requests/api/ci/runners_spec.rb
+65
-25
No files found.
data/deprecations/14-8-runner-api-status-filter-does-accept-active-or-paused.yml
0 → 100644
View file @
d493fea4
-
name
:
"
REST
API
Runner
will
not
accept
`status`
filter
values
of
`active`
or
`paused`"
announcement_milestone
:
"
14.8"
# The milestone when this feature was first announced as deprecated.
announcement_date
:
"
2022-02-22"
removal_milestone
:
"
15.0"
# the milestone when this feature is planned to be removed
removal_date
:
"
2022-05-22"
# the date of the milestone release when this feature is planned to be removed
breaking_change
:
true
body
:
|
# Do not modify this line, instead modify the lines below.
The GitLab Runner REST endpoints will stop accepting `paused` or `active` as a status value in GitLab 15.0.
A runner's status will only relate to runner contact status, such as: `online`, `offline`.
Status values `paused` or `active` will no longer be accepted and will be replaced by the `paused` query parameter.
When checking for paused runners, API users are advised to specify `paused=true` as the query parameter.
When checking for active runners, specify `paused=false`.
stage
:
Verify
tiers
:
[
Core
,
Premium
,
Ultimate
]
issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/351109
documentation_url
:
https://docs.gitlab.com/ee/api/runners.html
doc/api/runners.md
View file @
d493fea4
This diff is collapsed.
Click to expand it.
doc/update/deprecations.md
View file @
d493fea4
...
...
@@ -733,6 +733,24 @@ The `instanceStatisticsMeasurements` GraphQL node has been renamed to `usageTren
**Planned removal milestone: 15.0 (2022-05-22)**
### REST API Runner will not accept `status` filter values of `active` or `paused`
WARNING:
This feature will be changed or removed in 15.0
as a
[
breaking change
](
https://docs.gitlab.com/ee/development/contributing/#breaking-changes
)
.
Before updating GitLab, review the details carefully to determine if you need to make any
changes to your code, settings, or workflow.
The GitLab Runner REST endpoints will stop accepting
`paused`
or
`active`
as a status value in GitLab 15.0.
A runner's status will only relate to runner contact status, such as:
`online`
,
`offline`
.
Status values
`paused`
or
`active`
will no longer be accepted and will be replaced by the
`paused`
query parameter.
When checking for paused runners, API users are advised to specify
`paused=true`
as the query parameter.
When checking for active runners, specify
`paused=false`
.
**Planned removal milestone: 15.0 (2022-05-22)**
### REST and GraphQL API Runner usage of `active` replaced by `paused`
WARNING:
...
...
lib/api/ci/runners.rb
View file @
d493fea4
...
...
@@ -18,6 +18,7 @@ module API
desc:
'The scope of specific runners to show'
optional
:type
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_TYPES
,
desc:
'The type of the runners to show'
optional
:paused
,
type:
Boolean
,
desc:
'Whether to include only runners that are accepting or ignoring new jobs'
optional
:status
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
,
desc:
'The status of the runners to show'
optional
:tag_list
,
type:
Array
[
String
],
coerce_with:
::
API
::
Validations
::
Types
::
CommaSeparatedToArray
.
coerce
,
desc:
'The tags of the runners to show'
...
...
@@ -26,9 +27,7 @@ module API
get
do
runners
=
current_user
.
ci_owned_runners
runners
=
filter_runners
(
runners
,
params
[
:scope
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
)
runners
=
filter_runners
(
runners
,
params
[
:type
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_TYPES
)
runners
=
filter_runners
(
runners
,
params
[
:status
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
)
runners
=
runners
.
tagged_with
(
params
[
:tag_list
])
if
params
[
:tag_list
]
runners
=
apply_filter
(
runners
,
params
)
present
paginate
(
runners
),
with:
Entities
::
Ci
::
Runner
end
...
...
@@ -41,6 +40,7 @@ module API
desc:
'The scope of specific runners to show'
optional
:type
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_TYPES
,
desc:
'The type of the runners to show'
optional
:paused
,
type:
Boolean
,
desc:
'Whether to include only runners that are accepting or ignoring new jobs'
optional
:status
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
,
desc:
'The status of the runners to show'
optional
:tag_list
,
type:
Array
[
String
],
coerce_with:
::
API
::
Validations
::
Types
::
CommaSeparatedToArray
.
coerce
,
desc:
'The tags of the runners to show'
...
...
@@ -51,9 +51,7 @@ module API
runners
=
::
Ci
::
Runner
.
all
runners
=
filter_runners
(
runners
,
params
[
:scope
])
runners
=
filter_runners
(
runners
,
params
[
:type
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_TYPES
)
runners
=
filter_runners
(
runners
,
params
[
:status
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
)
runners
=
runners
.
tagged_with
(
params
[
:tag_list
])
if
params
[
:tag_list
]
runners
=
apply_filter
(
runners
,
params
)
present
paginate
(
runners
),
with:
Entities
::
Ci
::
Runner
end
...
...
@@ -163,6 +161,7 @@ module API
desc:
'The scope of specific runners to show'
optional
:type
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_TYPES
,
desc:
'The type of the runners to show'
optional
:paused
,
type:
Boolean
,
desc:
'Whether to include only runners that are accepting or ignoring new jobs'
optional
:status
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
,
desc:
'The status of the runners to show'
optional
:tag_list
,
type:
Array
[
String
],
coerce_with:
::
API
::
Validations
::
Types
::
CommaSeparatedToArray
.
coerce
,
desc:
'The tags of the runners to show'
...
...
@@ -226,6 +225,7 @@ module API
params
do
optional
:type
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_TYPES
,
desc:
'The type of the runners to show'
optional
:paused
,
type:
Boolean
,
desc:
'Whether to include only runners that are accepting or ignoring new jobs'
optional
:status
,
type:
String
,
values:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
,
desc:
'The status of the runners to show'
optional
:tag_list
,
type:
Array
[
String
],
coerce_with:
::
API
::
Validations
::
Types
::
CommaSeparatedToArray
.
coerce
,
desc:
'The tags of the runners to show'
...
...
@@ -313,6 +313,7 @@ module API
def
apply_filter
(
runners
,
params
)
runners
=
filter_runners
(
runners
,
params
[
:type
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_TYPES
)
runners
=
filter_runners
(
runners
,
params
[
:status
],
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_STATUSES
)
runners
=
filter_runners
(
runners
,
params
[
:paused
]
?
'paused'
:
'active'
,
allowed_scopes:
%w[paused active]
)
if
params
.
include?
(
:paused
)
runners
=
runners
.
tagged_with
(
params
[
:tag_list
])
if
params
[
:tag_list
]
runners
...
...
spec/requests/api/ci/runners_spec.rb
View file @
d493fea4
...
...
@@ -86,14 +86,24 @@ RSpec.describe API::Ci::Runners do
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
end
it
'filters runners by status
'
do
create
(
:ci_runner
,
:project
,
:inactive
,
description:
'Inactive project runner'
,
projects:
[
project
])
context
'with an inactive runner
'
do
let_it_be
(
:runner
)
{
create
(
:ci_runner
,
:project
,
:inactive
,
description:
'Inactive project runner'
,
projects:
[
project
])
}
get
api
(
'/runners?status=paused'
,
user
)
it
'filters runners by paused state'
do
get
api
(
'/runners?paused=true'
,
user
)
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
end
it
'filters runners by status'
do
get
api
(
'/runners?status=paused'
,
user
)
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
end
end
it
'does not filter by invalid status'
do
...
...
@@ -199,14 +209,24 @@ RSpec.describe API::Ci::Runners do
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
end
it
'filters runners by status
'
do
create
(
:ci_runner
,
:project
,
:inactive
,
description:
'Inactive project runner'
,
projects:
[
project
])
context
'with an inactive runner
'
do
let_it_be
(
:runner
)
{
create
(
:ci_runner
,
:project
,
:inactive
,
description:
'Inactive project runner'
,
projects:
[
project
])
}
get
api
(
'/runners/all?status=paused'
,
admin
)
it
'filters runners by status'
do
get
api
(
'/runners/all?paused=true'
,
admin
)
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
end
it
'filters runners by status'
do
get
api
(
'/runners/all?status=paused'
,
admin
)
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
end
end
it
'does not filter by invalid status'
do
...
...
@@ -956,14 +976,24 @@ RSpec.describe API::Ci::Runners do
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
end
it
'filters runners by status
'
do
create
(
:ci_runner
,
:project
,
:inactive
,
description:
'Inactive project runner'
,
projects:
[
project
])
context
'with an inactive runner
'
do
let_it_be
(
:runner
)
{
create
(
:ci_runner
,
:project
,
:inactive
,
description:
'Inactive project runner'
,
projects:
[
project
])
}
get
api
(
"/projects/
#{
project
.
id
}
/runners?status=paused"
,
user
)
it
'filters runners by status'
do
get
api
(
"/projects/
#{
project
.
id
}
/runners?paused=true"
,
user
)
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
end
it
'filters runners by status'
do
get
api
(
"/projects/
#{
project
.
id
}
/runners?status=paused"
,
user
)
expect
(
json_response
).
to
match_array
[
a_hash_including
(
'description'
=>
'Inactive project runner'
)
]
end
end
it
'does not filter by invalid status'
do
...
...
@@ -1022,21 +1052,31 @@ RSpec.describe API::Ci::Runners do
end
end
context
'filter runners by status'
do
it
'returns runners by valid status'
do
create
(
:ci_runner
,
:group
,
:inactive
,
description:
'Inactive group runner'
,
groups:
[
group
])
context
'with an inactive runner'
do
let_it_be
(
:runner
)
{
create
(
:ci_runner
,
:group
,
:inactive
,
description:
'Inactive group runner'
,
groups:
[
group
])
}
get
api
(
"/groups/
#{
group
.
id
}
/runners?status=paused"
,
user
)
it
'returns runners by paused state'
do
get
api
(
"/groups/
#{
group
.
id
}
/runners?paused=true"
,
user
)
expect
(
json_response
).
to
match_array
([
a_hash_including
(
'description'
=>
'Inactive group runner'
)
])
end
it
'does not filter by invalid status'
do
get
api
(
"/groups/
#{
group
.
id
}
/runners?status=bogus"
,
user
)
context
'filter runners by status'
do
it
'returns runners by valid status'
do
get
api
(
"/groups/
#{
group
.
id
}
/runners?status=paused"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
).
to
match_array
([
a_hash_including
(
'description'
=>
'Inactive group runner'
)
])
end
it
'does not filter by invalid status'
do
get
api
(
"/groups/
#{
group
.
id
}
/runners?status=bogus"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
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