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
60c6e255
Commit
60c6e255
authored
Dec 14, 2020
by
Allison Browne
Committed by
Kerri Miller
Dec 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cicd settings for merge trains to gql
Add the ci cd settings for merge trains to the gql api
parent
a43505bc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
185 additions
and
0 deletions
+185
-0
app/graphql/types/ci/ci_cd_setting_type.rb
app/graphql/types/ci/ci_cd_setting_type.rb
+20
-0
app/graphql/types/project_type.rb
app/graphql/types/project_type.rb
+5
-0
app/policies/project_ci_cd_setting_policy.rb
app/policies/project_ci_cd_setting_policy.rb
+5
-0
changelogs/unreleased/282520-follow-up-enable-and-disable-merge-train-checkbox-based-on-pipelin.yml
...ble-and-disable-merge-train-checkbox-based-on-pipelin.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+22
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+69
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+9
-0
spec/requests/api/graphql/ci/ci_cd_setting_spec.rb
spec/requests/api/graphql/ci/ci_cd_setting_spec.rb
+50
-0
No files found.
app/graphql/types/ci/ci_cd_setting_type.rb
0 → 100644
View file @
60c6e255
# frozen_string_literal: true
module
Types
module
Ci
class
CiCdSettingType
<
BaseObject
graphql_name
'ProjectCiCdSetting'
authorize
:admin_project
field
:merge_pipelines_enabled
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Whether merge pipelines are enabled.'
,
method: :merge_pipelines_enabled?
field
:merge_trains_enabled
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Whether merge trains are enabled.'
,
method: :merge_trains_enabled?
field
:project
,
Types
::
ProjectType
,
null:
true
,
description:
'Project the CI/CD settings belong to.'
end
end
end
app/graphql/types/project_type.rb
View file @
60c6e255
...
...
@@ -191,6 +191,11 @@ module Types
description:
'Build pipeline of the project'
,
resolver:
Resolvers
::
ProjectPipelineResolver
field
:ci_cd_settings
,
Types
::
Ci
::
CiCdSettingType
,
null:
true
,
description:
'CI/CD settings for the project'
field
:sentry_detailed_error
,
Types
::
ErrorTracking
::
SentryDetailedErrorType
,
null:
true
,
...
...
app/policies/project_ci_cd_setting_policy.rb
0 → 100644
View file @
60c6e255
# frozen_string_literal: true
class
ProjectCiCdSettingPolicy
<
BasePolicy
delegate
{
@subject
.
project
}
end
changelogs/unreleased/282520-follow-up-enable-and-disable-merge-train-checkbox-based-on-pipelin.yml
0 → 100644
View file @
60c6e255
---
title
:
Add Merge Train Setting to the graphql api
merge_request
:
49402
author
:
type
:
changed
doc/api/graphql/reference/gitlab_schema.graphql
View file @
60c6e255
...
...
@@ -16229,6 +16229,11 @@ type Project {
last
:
Int
):
BoardConnection
"""
CI
/
CD
settings
for
the
project
"""
ciCdSettings
:
ProjectCiCdSetting
"""
Find
a
single
cluster
agent
by
name
"""
...
...
@@ -17906,6 +17911,23 @@ type Project {
wikiEnabled
:
Boolean
}
type
ProjectCiCdSetting
{
"""
Whether
merge
pipelines
are
enabled
.
"""
mergePipelinesEnabled
:
Boolean
"""
Whether
merge
trains
are
enabled
.
"""
mergeTrainsEnabled
:
Boolean
"""
Project
the
CI
/
CD
settings
belong
to
.
"""
project
:
Project
}
"""
The connection type for Project.
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
60c6e255
...
...
@@ -48281,6 +48281,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "ciCdSettings",
"description": "CI/CD settings for the project",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "ProjectCiCdSetting",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "clusterAgent",
"description": "Find a single cluster agent by name",
...
...
@@ -52337,6 +52351,61 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "ProjectCiCdSetting",
"description": null,
"fields": [
{
"name": "mergePipelinesEnabled",
"description": "Whether merge pipelines are enabled.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "mergeTrainsEnabled",
"description": "Whether merge trains are enabled.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "project",
"description": "Project the CI/CD settings belong to.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "Project",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "ProjectConnection",
doc/api/graphql/reference/index.md
View file @
60c6e255
...
...
@@ -2521,6 +2521,7 @@ Autogenerated return type of PipelineRetry.
|
`avatarUrl`
| String | URL to avatar image file of the project |
|
`board`
| Board | A single board of the project |
|
`boards`
| BoardConnection | Boards of the project |
|
`ciCdSettings`
| ProjectCiCdSetting | CI/CD settings for the project |
|
`clusterAgent`
| ClusterAgent | Find a single cluster agent by name |
|
`clusterAgents`
| ClusterAgentConnection | Cluster agents associated with the project |
|
`codeCoverageSummary`
| CodeCoverageSummary | Code coverage summary associated with the project |
...
...
@@ -2615,6 +2616,14 @@ Autogenerated return type of PipelineRetry.
|
`webUrl`
| String | Web URL of the project |
|
`wikiEnabled`
| Boolean | Indicates if Wikis are enabled for the current user |
### ProjectCiCdSetting
| Field | Type | Description |
| ----- | ---- | ----------- |
|
`mergePipelinesEnabled`
| Boolean | Whether merge pipelines are enabled. |
|
`mergeTrainsEnabled`
| Boolean | Whether merge trains are enabled. |
|
`project`
| Project | Project the CI/CD settings belong to. |
### ProjectMember
Represents a Project Membership.
...
...
spec/requests/api/graphql/ci/ci_cd_setting_spec.rb
0 → 100644
View file @
60c6e255
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Getting Ci Cd Setting'
do
include
GraphqlHelpers
let_it_be_with_reload
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:current_user
)
{
project
.
owner
}
let
(
:fields
)
do
<<~
QUERY
#{
all_graphql_fields_for
(
'ProjectCiCdSetting'
)
}
QUERY
end
let
(
:query
)
do
graphql_query_for
(
'project'
,
{
'fullPath'
=>
project
.
full_path
},
query_graphql_field
(
'ciCdSettings'
,
{},
fields
)
)
end
let
(
:settings_data
)
{
graphql_data
[
'project'
][
'ciCdSettings'
]
}
context
'without permissions'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_reporter
(
user
)
post_graphql
(
query
,
current_user:
user
)
end
it_behaves_like
'a working graphql query'
specify
{
expect
(
settings_data
).
to
be
nil
}
end
context
'with project permissions'
do
before
do
post_graphql
(
query
,
current_user:
current_user
)
end
it_behaves_like
'a working graphql query'
specify
{
expect
(
settings_data
[
'mergePipelinesEnabled'
]).
to
eql
project
.
ci_cd_settings
.
merge_pipelines_enabled?
}
specify
{
expect
(
settings_data
[
'mergeTrainsEnabled'
]).
to
eql
project
.
ci_cd_settings
.
merge_trains_enabled?
}
specify
{
expect
(
settings_data
[
'project'
][
'id'
]).
to
eql
"gid://gitlab/Project/
#{
project
.
id
}
"
}
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