Commit 25b3a293 authored by lauraMon's avatar lauraMon

Updates schema, docs, other

* Fixes linting errors
* Updates DAST scanner service with CI namespace
* Adds success
parent 0f48633f
...@@ -6,6 +6,7 @@ module Mutations ...@@ -6,6 +6,7 @@ module Mutations
argument :id, GraphQL::ID_TYPE, argument :id, GraphQL::ID_TYPE,
required: true, required: true,
description: 'The id of the pipeline to mutate' description: 'The id of the pipeline to mutate'
private private
def find_object(id:) def find_object(id:)
......
...@@ -11,6 +11,7 @@ module Mutations ...@@ -11,6 +11,7 @@ module Mutations
result = ::Ci::CancelUserPipelinesService.new.execute(current_user) result = ::Ci::CancelUserPipelinesService.new.execute(current_user)
{ {
success: result.success?,
errors: [result&.message] errors: [result&.message]
} }
end end
......
...@@ -7,6 +7,8 @@ module Ci ...@@ -7,6 +7,8 @@ module Ci
# https://gitlab.com/gitlab-org/gitlab/issues/32332 # https://gitlab.com/gitlab-org/gitlab/issues/32332
def execute(user) def execute(user)
user.pipelines.cancelable.find_each(&:cancel_running) user.pipelines.cancelable.find_each(&:cancel_running)
ServiceResponse.success(message: 'Pipeline canceled')
rescue ActiveRecord::StaleObjectError rescue ActiveRecord::StaleObjectError
ServiceResponse.error(message: 'Error canceling pipeline') ServiceResponse.error(message: 'Error canceling pipeline')
end end
......
...@@ -12,7 +12,6 @@ module Ci ...@@ -12,7 +12,6 @@ module Ci
ServiceResponse.success(message: 'Pipeline not found') ServiceResponse.success(message: 'Pipeline not found')
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
ServiceResponse.error(message: 'Pipeline not found') ServiceResponse.error(message: 'Pipeline not found')
end end
end end
end end
...@@ -10646,11 +10646,6 @@ type PipelineDestroyPayload { ...@@ -10646,11 +10646,6 @@ type PipelineDestroyPayload {
Errors encountered during execution of the mutation. Errors encountered during execution of the mutation.
""" """
errors: [String!]! errors: [String!]!
"""
The pipeline after mutation
"""
pipeline: Pipeline
} }
""" """
......
...@@ -31948,20 +31948,6 @@ ...@@ -31948,20 +31948,6 @@
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "pipeline",
"description": "The pipeline after mutation",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "Pipeline",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
...@@ -1639,7 +1639,6 @@ Autogenerated return type of PipelineDestroy ...@@ -1639,7 +1639,6 @@ Autogenerated return type of PipelineDestroy
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `clientMutationId` | String | A unique identifier for the client performing the mutation. | | `clientMutationId` | String | A unique identifier for the client performing the mutation. |
| `errors` | String! => Array | Errors encountered during execution of the mutation. | | `errors` | String! => Array | Errors encountered during execution of the mutation. |
| `pipeline` | Pipeline | The pipeline after mutation |
## PipelinePermissions ## PipelinePermissions
......
...@@ -29,7 +29,7 @@ module Mutations ...@@ -29,7 +29,7 @@ module Mutations
dast_site_profile = find_dast_site_profile(project: project, dast_site_profile_id: dast_site_profile_id) dast_site_profile = find_dast_site_profile(project: project, dast_site_profile_id: dast_site_profile_id)
dast_site = dast_site_profile.dast_site dast_site = dast_site_profile.dast_site
service = Ci::RunDastScanService.new(project, current_user) service = ::Ci::RunDastScanService.new(project, current_user)
result = service.execute(branch: project.default_branch, target_url: dast_site.url) result = service.execute(branch: project.default_branch, target_url: dast_site.url)
if result.success? if result.success?
......
...@@ -32,7 +32,7 @@ module Mutations ...@@ -32,7 +32,7 @@ module Mutations
def resolve(project_path:, target_url:, branch:, scan_type:) def resolve(project_path:, target_url:, branch:, scan_type:)
project = authorized_find!(full_path: project_path) project = authorized_find!(full_path: project_path)
service = Ci::RunDastScanService.new(project, current_user) service = ::Ci::RunDastScanService.new(project, current_user)
result = service.execute(branch: branch, target_url: target_url) result = service.execute(branch: branch, target_url: target_url)
if result.success? if result.success?
......
...@@ -19,7 +19,7 @@ RSpec.describe 'PipelineCancel' do ...@@ -19,7 +19,7 @@ RSpec.describe 'PipelineCancel' do
let(:mutation_response) { graphql_mutation_response(:pipeline_cancel) } let(:mutation_response) { graphql_mutation_response(:pipeline_cancel) }
before(:all) do before_all do
project.add_maintainer(user) project.add_maintainer(user)
end end
......
...@@ -25,7 +25,7 @@ RSpec.describe 'PipelineRetry' do ...@@ -25,7 +25,7 @@ RSpec.describe 'PipelineRetry' do
let(:mutation_response) { graphql_mutation_response(:pipeline_retry) } let(:mutation_response) { graphql_mutation_response(:pipeline_retry) }
before(:all) do before_all do
project.add_maintainer(user) project.add_maintainer(user)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment