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
e17ac92c
Commit
e17ac92c
authored
Aug 19, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds pipeline cancel and refactors
* Refactors some spec variables
parent
ae1c4d0d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
4 deletions
+65
-4
app/graphql/mutations/ci/pipeline_cancel.rb
app/graphql/mutations/ci/pipeline_cancel.rb
+20
-0
app/graphql/types/mutation_type.rb
app/graphql/types/mutation_type.rb
+2
-1
spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb
...requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb
+40
-0
spec/requests/api/graphql/mutations/ci/pipeline_destroy_spec.rb
...equests/api/graphql/mutations/ci/pipeline_destroy_spec.rb
+1
-1
spec/requests/api/graphql/mutations/ci/pipeline_retry_spec.rb
.../requests/api/graphql/mutations/ci/pipeline_retry_spec.rb
+2
-2
No files found.
app/graphql/mutations/ci/pipeline_cancel.rb
0 → 100644
View file @
e17ac92c
# frozen_string_literal: true
module
Mutations
module
Ci
class
PipelineCancel
<
BaseMutation
graphql_name
'PipelineCancel'
authorize
:update_pipeline
def
resolve
::
Ci
::
CancelUserPipelinesService
.
new
.
execute
(
current_user
)
{
errors:
[]
}
end
end
end
end
app/graphql/types/mutation_type.rb
View file @
e17ac92c
...
...
@@ -62,8 +62,9 @@ module Types
mount_mutation
Mutations
::
DesignManagement
::
Delete
,
calls_gitaly:
true
mount_mutation
Mutations
::
DesignManagement
::
Move
mount_mutation
Mutations
::
ContainerExpirationPolicies
::
Update
mount_mutation
Mutations
::
Ci
::
Pipeline
Retry
mount_mutation
Mutations
::
Ci
::
Pipeline
Cancel
mount_mutation
Mutations
::
Ci
::
PipelineDestroy
mount_mutation
Mutations
::
Ci
::
PipelineRetry
end
end
...
...
spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb
0 → 100644
View file @
e17ac92c
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'PipelineCancel'
do
include
GraphqlHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:running
,
project:
project
,
user:
user
)
}
let
(
:mutation
)
do
graphql_mutation
(
:pipeline_cancel
,
{},
<<-
QL
errors
QL
)
end
before
do
project
.
add_maintainer
(
user
)
end
it
'does not change any pipelines not owned by the current user'
do
build
=
create
(
:ci_build
,
:running
,
pipeline:
pipeline
)
post_graphql_mutation
(
mutation
,
current_user:
create
(
:user
))
expect
(
build
).
not_to
be_canceled
end
it
"cancels all of the current user's cancelable pipelines"
do
build
=
create
(
:ci_build
,
:running
,
pipeline:
pipeline
)
post_graphql_mutation
(
mutation
,
current_user:
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
expect
(
build
.
reload
).
to
be_canceled
end
end
spec/requests/api/graphql/mutations/ci/pipeline_destroy_spec.rb
View file @
e17ac92c
...
...
@@ -32,7 +32,7 @@ RSpec.describe 'PipelineDestroy' do
expect
(
graphql_errors
).
not_to
be_empty
end
it
'
retrie
s a pipeline'
do
it
'
destroy
s a pipeline'
do
post_graphql_mutation
(
mutation
,
current_user:
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
...
...
spec/requests/api/graphql/mutations/ci/pipeline_retry_spec.rb
View file @
e17ac92c
...
...
@@ -5,8 +5,8 @@ require 'spec_helper'
RSpec
.
describe
'PipelineRetry'
do
include
GraphqlHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
user:
user
)
}
let
(
:mutation
)
do
...
...
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