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
3ba921cc
Commit
3ba921cc
authored
Jun 30, 2021
by
Pedro Pombeiro
Committed by
Igor Drozdov
Jun 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GraphQL: Allow updating runner cost factor in mutation [RUN AS-IF-FOSS]
parent
98d7e528
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
app/graphql/mutations/ci/runner/update.rb
app/graphql/mutations/ci/runner/update.rb
+2
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+2
-0
ee/app/graphql/ee/mutations/ci/runner/update.rb
ee/app/graphql/ee/mutations/ci/runner/update.rb
+24
-0
ee/spec/graphql/ee/mutations/ci/runner/update_spec.rb
ee/spec/graphql/ee/mutations/ci/runner/update_spec.rb
+43
-0
No files found.
app/graphql/mutations/ci/runner/update.rb
View file @
3ba921cc
...
...
@@ -66,3 +66,5 @@ module Mutations
end
end
end
Mutations
::
Ci
::
Runner
::
Update
.
prepend_mod_with
(
'Mutations::Ci::Runner::Update'
)
doc/api/graphql/reference/index.md
View file @
3ba921cc
...
...
@@ -3558,6 +3558,8 @@ Input type: `RunnerUpdateInput`
|
<a
id=
"mutationrunnerupdateid"
></a>
`id`
|
[
`CiRunnerID!`
](
#cirunnerid
)
| ID of the runner to update. |
|
<a
id=
"mutationrunnerupdatelocked"
></a>
`locked`
|
[
`Boolean`
](
#boolean
)
| Indicates the runner is locked. |
|
<a
id=
"mutationrunnerupdatemaximumtimeout"
></a>
`maximumTimeout`
|
[
`Int`
](
#int
)
| Maximum timeout (in seconds) for jobs processed by the runner. |
|
<a
id=
"mutationrunnerupdateprivateprojectsminutescostfactor"
></a>
`privateProjectsMinutesCostFactor`
|
[
`Float`
](
#float
)
| Private projects' "minutes cost factor" associated with the runner (GitLab.com only). |
|
<a
id=
"mutationrunnerupdatepublicprojectsminutescostfactor"
></a>
`publicProjectsMinutesCostFactor`
|
[
`Float`
](
#float
)
| Public projects' "minutes cost factor" associated with the runner (GitLab.com only). |
|
<a
id=
"mutationrunnerupdaterununtagged"
></a>
`runUntagged`
|
[
`Boolean`
](
#boolean
)
| Indicates the runner is able to run untagged jobs. |
|
<a
id=
"mutationrunnerupdatetaglist"
></a>
`tagList`
|
[
`[String!]`
](
#string
)
| Tags associated with the runner. |
...
...
ee/app/graphql/ee/mutations/ci/runner/update.rb
0 → 100644
View file @
3ba921cc
# frozen_string_literal: true
module
EE
module
Mutations
module
Ci
module
Runner
module
Update
extend
ActiveSupport
::
Concern
extend
::
Gitlab
::
Utils
::
Override
prepended
do
argument
:public_projects_minutes_cost_factor
,
GraphQL
::
FLOAT_TYPE
,
required:
false
,
description:
'Public projects\' "minutes cost factor" associated with the runner (GitLab.com only).'
argument
:private_projects_minutes_cost_factor
,
GraphQL
::
FLOAT_TYPE
,
required:
false
,
description:
'Private projects\' "minutes cost factor" associated with the runner (GitLab.com only).'
end
end
end
end
end
end
ee/spec/graphql/ee/mutations/ci/runner/update_spec.rb
0 → 100644
View file @
3ba921cc
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Mutations
::
Ci
::
Runner
::
Update
do
include
GraphqlHelpers
describe
'#resolve'
do
let
(
:runner
)
do
create
(
:ci_runner
,
active:
true
,
locked:
false
,
run_untagged:
true
,
public_projects_minutes_cost_factor:
0.0
,
private_projects_minutes_cost_factor:
0.0
)
end
let
(
:mutation
)
{
described_class
.
new
(
object:
nil
,
context:
current_ctx
,
field:
nil
)
}
subject
(
:mutation_result
)
{
mutation
.
resolve
(
id:
runner
.
to_global_id
,
**
mutation_params
)
}
def
resolve
mutation_result
runner
.
reload
end
context
'when user can update runner'
,
:enable_admin_mode
do
let
(
:admin_user
)
{
create
(
:user
,
:admin
)
}
let
(
:current_ctx
)
{
{
current_user:
admin_user
}
}
context
'when mutation includes cost factor arguments'
do
let
(
:mutation_params
)
do
{
public_projects_minutes_cost_factor:
2.5
,
private_projects_minutes_cost_factor:
0.5
}
end
it
'updates cost factors to specified values'
,
:aggregate_failures
do
expect
{
resolve
}
.
to
change
{
runner
.
public_projects_minutes_cost_factor
}.
from
(
0
).
to
(
2.5
)
.
and
change
{
runner
.
private_projects_minutes_cost_factor
}.
from
(
0
).
to
(
0.5
)
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