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
b3a1af26
Commit
b3a1af26
authored
Apr 09, 2021
by
Michael Leopard
Committed by
Michael Kozono
Apr 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CiCdSettingsUpdate mutation to accept MR pipelines and merge trains
parent
4aa39fc5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
1 deletion
+93
-1
app/graphql/mutations/ci/ci_cd_settings_update.rb
app/graphql/mutations/ci/ci_cd_settings_update.rb
+11
-1
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
ee/app/graphql/ee/mutations/ci/ci_cd_settings_update.rb
ee/app/graphql/ee/mutations/ci/ci_cd_settings_update.rb
+22
-0
ee/changelogs/unreleased/add-merge-train-mutation.yml
ee/changelogs/unreleased/add-merge-train-mutation.yml
+5
-0
ee/spec/graphql/ee/mutations/ci/ci_cd_settings_update_spec.rb
...pec/graphql/ee/mutations/ci/ci_cd_settings_update_spec.rb
+54
-0
No files found.
app/graphql/mutations/ci/ci_cd_settings_update.rb
View file @
b3a1af26
...
...
@@ -17,13 +17,23 @@ module Mutations
required:
false
,
description:
'Indicates if the latest artifact should be kept for this project.'
field
:ci_cd_settings
,
Types
::
Ci
::
CiCdSettingType
,
null:
false
,
description:
'The CI/CD settings after mutation.'
def
resolve
(
full_path
:,
**
args
)
project
=
authorized_find!
(
full_path
)
settings
=
project
.
ci_cd_settings
settings
.
update
(
args
)
{
errors:
errors_on_object
(
settings
)
}
{
ci_cd_settings:
settings
,
errors:
errors_on_object
(
settings
)
}
end
end
end
end
Mutations
::
Ci
::
CiCdSettingsUpdate
.
prepend_if_ee
(
'::EE::Mutations::Ci::CiCdSettingsUpdate'
)
doc/api/graphql/reference/index.md
View file @
b3a1af26
...
...
@@ -1055,6 +1055,7 @@ Autogenerated return type of CiCdSettingsUpdate.
| Field | Type | Description |
| ----- | ---- | ----------- |
|
`ciCdSettings`
|
[
`ProjectCiCdSetting!`
](
#projectcicdsetting
)
| The CI/CD settings after mutation. |
|
`clientMutationId`
|
[
`String`
](
#string
)
| A unique identifier for the client performing the mutation. |
|
`errors`
|
[
`[String!]!`
](
#string
)
| Errors encountered during execution of the mutation. |
...
...
ee/app/graphql/ee/mutations/ci/ci_cd_settings_update.rb
0 → 100644
View file @
b3a1af26
# frozen_string_literal: true
module
EE
module
Mutations
module
Ci
module
CiCdSettingsUpdate
extend
ActiveSupport
::
Concern
extend
::
Gitlab
::
Utils
::
Override
prepended
do
argument
:merge_pipelines_enabled
,
GraphQL
::
BOOLEAN_TYPE
,
required:
false
,
description:
'Indicates if merge pipelines are enabled for the project.'
argument
:merge_trains_enabled
,
GraphQL
::
BOOLEAN_TYPE
,
required:
false
,
description:
'Indicates if merge trains are enabled for the project.'
end
end
end
end
end
ee/changelogs/unreleased/add-merge-train-mutation.yml
0 → 100644
View file @
b3a1af26
---
title
:
Update CiCdSettingsUpdate mutation to accept MR pipelines and merge trains
merge_request
:
58592
author
:
type
:
added
ee/spec/graphql/ee/mutations/ci/ci_cd_settings_update_spec.rb
0 → 100644
View file @
b3a1af26
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Mutations
::
Ci
::
CiCdSettingsUpdate
do
include
GraphqlHelpers
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:mutation
)
{
described_class
.
new
(
object:
nil
,
context:
{
current_user:
user
},
field:
nil
)
}
subject
{
mutation
.
resolve
(
full_path:
project
.
full_path
,
**
mutation_params
)
}
before
do
stub_licensed_features
(
merge_pipelines:
true
,
merge_trains:
true
)
stub_feature_flags
(
disable_merge_trains:
false
)
project
.
merge_pipelines_enabled
=
nil
project
.
merge_trains_enabled
=
false
subject
project
.
reload
end
describe
'#resolve'
do
context
'when merge trains are set to true and merge pipelines are set to false'
do
let
(
:mutation_params
)
do
{
full_path:
project
.
full_path
,
merge_pipelines_enabled:
false
,
merge_trains_enabled:
true
}
end
it
'does not enable merge trains'
do
expect
(
project
.
ci_cd_settings
.
merge_trains_enabled?
).
to
eq
(
false
)
end
end
context
'when merge trains and merge pipelines are set to true'
do
let
(
:mutation_params
)
do
{
full_path:
project
.
full_path
,
merge_pipelines_enabled:
true
,
merge_trains_enabled:
true
}
end
it
'enables merge pipelines and merge trains'
do
expect
(
project
.
merge_pipelines_enabled?
).
to
eq
(
true
)
expect
(
project
.
merge_trains_enabled?
).
to
eq
(
true
)
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