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
eb7cd131
Commit
eb7cd131
authored
Aug 18, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds PipelineDestroy mutation
* Adds first spec
parent
fc73d77c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
0 deletions
+62
-0
app/graphql/mutations/ci/base.rb
app/graphql/mutations/ci/base.rb
+1
-0
app/graphql/mutations/ci/pipeline_destroy.rb
app/graphql/mutations/ci/pipeline_destroy.rb
+20
-0
app/graphql/types/mutation_type.rb
app/graphql/types/mutation_type.rb
+1
-0
spec/requests/api/graphql/mutations/ci/pipeline_destroy_spec.rb
...equests/api/graphql/mutations/ci/pipeline_destroy_spec.rb
+40
-0
No files found.
app/graphql/mutations/ci/base.rb
View file @
eb7cd131
...
...
@@ -14,6 +14,7 @@ module Mutations
description:
'The pipeline after mutation'
authorize
:update_pipeline
authorize
:destroy_pipeline
private
...
...
app/graphql/mutations/ci/pipeline_destroy.rb
0 → 100644
View file @
eb7cd131
# frozen_string_literal: true
module
Mutations
module
Ci
class
PipelineDestroy
<
Base
graphql_name
'PipelineDestroy'
def
resolve
(
id
:)
pipeline
=
authorized_find!
(
id:
id
)
project
=
pipeline
.
project
::
Ci
::
DestroyPipelineService
.
new
(
project
,
current_user
).
execute
(
pipeline
)
{
errors:
[]
}
end
end
end
end
app/graphql/types/mutation_type.rb
View file @
eb7cd131
...
...
@@ -63,6 +63,7 @@ module Types
mount_mutation
Mutations
::
DesignManagement
::
Move
mount_mutation
Mutations
::
ContainerExpirationPolicies
::
Update
mount_mutation
Mutations
::
Ci
::
PipelineRetry
mount_mutation
Mutations
::
Ci
::
PipelineDestroy
end
end
...
...
spec/requests/api/graphql/mutations/ci/pipeline_destroy_spec.rb
0 → 100644
View file @
eb7cd131
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'PipelineDestroy'
do
include
GraphqlHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
,
user:
user
)
}
let
(
:mutation
)
do
variables
=
{
id:
pipeline
.
id
}
graphql_mutation
(
:pipeline_destroy
,
variables
,
<<-
QL
errors
QL
)
end
let
(
:mutation_response
)
{
graphql_mutation_response
(
:pipeline_destroy
)
}
before
do
project
.
add_maintainer
(
user
)
end
it
'returns an error if the user is not allowed to destroy the pipeline'
do
post_graphql_mutation
(
mutation
,
current_user:
create
(
:user
))
expect
(
graphql_errors
).
not_to
be_empty
end
it
'retries a pipeline'
do
post_graphql_mutation
(
mutation
,
current_user:
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
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