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
d704138c
Commit
d704138c
authored
Jan 29, 2022
by
Cong Chen
Committed by
gentcys
Feb 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter a pipeline by author
Changelog: added
parent
93352519
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
app/graphql/resolvers/concerns/resolves_pipelines.rb
app/graphql/resolvers/concerns/resolves_pipelines.rb
+4
-1
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+3
-0
spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb
spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb
+9
-3
No files found.
app/graphql/resolvers/concerns/resolves_pipelines.rb
View file @
d704138c
...
...
@@ -20,11 +20,14 @@ module ResolvesPipelines
GraphQL
::
Types
::
String
,
required:
false
,
description:
"Filter pipelines by the sha of the commit they are run for."
argument
:source
,
GraphQL
::
Types
::
String
,
required:
false
,
description:
"Filter pipelines by their source."
argument
:username
,
GraphQL
::
Types
::
String
,
required:
false
,
description:
"Filter pipelines by the user that triggered the pipeline."
end
class_methods
do
...
...
doc/api/graphql/reference/index.md
View file @
d704138c
...
...
@@ -9451,6 +9451,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="commitpipelinessha"></a>`sha` | [`String`](#string) | Filter pipelines by the sha of the commit they are run for. |
| <a id="commitpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. |
| <a id="commitpipelinesstatus"></a>`status` | [`PipelineStatusEnum`](#pipelinestatusenum) | Filter pipelines by their status. |
| <a id="commitpipelinesusername"></a>`username` | [`String`](#string) | Filter pipelines by the user that triggered the pipeline. |
### `ComplianceFramework`
...
...
@@ -12284,6 +12285,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="mergerequestpipelinessha"></a>`sha` | [`String`](#string) | Filter pipelines by the sha of the commit they are run for. |
| <a id="mergerequestpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. |
| <a id="mergerequestpipelinesstatus"></a>`status` | [`PipelineStatusEnum`](#pipelinestatusenum) | Filter pipelines by their status. |
| <a id="mergerequestpipelinesusername"></a>`username` | [`String`](#string) | Filter pipelines by the user that triggered the pipeline. |
##### `MergeRequest.reference`
...
...
@@ -14312,6 +14314,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="projectpipelinessha"></a>`sha` | [`String`](#string) | Filter pipelines by the sha of the commit they are run for. |
| <a id="projectpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. |
| <a id="projectpipelinesstatus"></a>`status` | [`PipelineStatusEnum`](#pipelinestatusenum) | Filter pipelines by their status. |
| <a id="projectpipelinesusername"></a>`username` | [`String`](#string) | Filter pipelines by the user that triggered the pipeline. |
##### `Project.projectMembers`
spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb
View file @
d704138c
...
...
@@ -15,7 +15,7 @@ RSpec.describe ResolvesPipelines do
end
end
let
(
:current_user
)
{
create
(
:user
)
}
let
_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:private
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
...
...
@@ -23,13 +23,15 @@ RSpec.describe ResolvesPipelines do
let_it_be
(
:success_pipeline
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
)
}
let_it_be
(
:ref_pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
ref:
'awesome-feature'
)
}
let_it_be
(
:sha_pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
'deadbeef'
)
}
let_it_be
(
:username_pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
user:
current_user
)
}
let_it_be
(
:all_pipelines
)
do
[
pipeline
,
failed_pipeline
,
success_pipeline
,
ref_pipeline
,
sha_pipeline
sha_pipeline
,
username_pipeline
]
end
...
...
@@ -37,7 +39,7 @@ RSpec.describe ResolvesPipelines do
project
.
add_developer
(
current_user
)
end
it
{
is_expected
.
to
have_graphql_arguments
(
:status
,
:scope
,
:ref
,
:sha
,
:source
)
}
it
{
is_expected
.
to
have_graphql_arguments
(
:status
,
:scope
,
:ref
,
:sha
,
:source
,
:username
)
}
it
'finds all pipelines'
do
expect
(
resolve_pipelines
).
to
contain_exactly
(
*
all_pipelines
)
...
...
@@ -71,6 +73,10 @@ RSpec.describe ResolvesPipelines do
end
end
it
'allows filtering by username'
do
expect
(
resolve_pipelines
(
username:
current_user
.
username
)).
to
contain_exactly
(
username_pipeline
)
end
it
'does not return any pipelines if the user does not have access'
do
expect
(
resolve_pipelines
({},
{})).
to
be_empty
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