diff options
Diffstat (limited to 'app/graphql/mutations/ci')
-rw-r--r-- | app/graphql/mutations/ci/ci_cd_settings_update.rb | 8 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job/base.rb | 2 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job/cancel.rb | 28 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job/play.rb | 2 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job/retry.rb | 2 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job/unschedule.rb | 28 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job_token_scope/add_project.rb | 10 | ||||
-rw-r--r-- | app/graphql/mutations/ci/job_token_scope/remove_project.rb | 10 | ||||
-rw-r--r-- | app/graphql/mutations/ci/pipeline/base.rb | 2 | ||||
-rw-r--r-- | app/graphql/mutations/ci/pipeline/retry.rb | 2 | ||||
-rw-r--r-- | app/graphql/mutations/ci/runner/update.rb | 14 | ||||
-rw-r--r-- | app/graphql/mutations/ci/runners_registration_token/reset.rb | 6 |
12 files changed, 85 insertions, 29 deletions
diff --git a/app/graphql/mutations/ci/ci_cd_settings_update.rb b/app/graphql/mutations/ci/ci_cd_settings_update.rb index 0973e9beae3..7bd38bc2998 100644 --- a/app/graphql/mutations/ci/ci_cd_settings_update.rb +++ b/app/graphql/mutations/ci/ci_cd_settings_update.rb @@ -9,22 +9,22 @@ module Mutations authorize :admin_project - argument :full_path, GraphQL::ID_TYPE, + argument :full_path, GraphQL::Types::ID, required: true, description: 'Full Path of the project the settings belong to.' - argument :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, + argument :keep_latest_artifact, GraphQL::Types::Boolean, required: false, description: 'Indicates if the latest artifact should be kept for this project.' - argument :job_token_scope_enabled, GraphQL::BOOLEAN_TYPE, + argument :job_token_scope_enabled, GraphQL::Types::Boolean, required: false, description: 'Indicates CI job tokens generated in this project have restricted access to resources.' field :ci_cd_settings, Types::Ci::CiCdSettingType, null: false, - description: 'The CI/CD settings after mutation.' + description: 'CI/CD settings after mutation.' def resolve(full_path:, **args) project = authorized_find!(full_path) diff --git a/app/graphql/mutations/ci/job/base.rb b/app/graphql/mutations/ci/job/base.rb index 3359def159a..a9fe26226d9 100644 --- a/app/graphql/mutations/ci/job/base.rb +++ b/app/graphql/mutations/ci/job/base.rb @@ -8,7 +8,7 @@ module Mutations argument :id, JobID, required: true, - description: 'The ID of the job to mutate.' + description: 'ID of the job to mutate.' def find_object(id: ) # TODO: remove this line when the compatibility layer is removed diff --git a/app/graphql/mutations/ci/job/cancel.rb b/app/graphql/mutations/ci/job/cancel.rb new file mode 100644 index 00000000000..dc9f4d19779 --- /dev/null +++ b/app/graphql/mutations/ci/job/cancel.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Job + class Cancel < Base + graphql_name 'JobCancel' + + field :job, + Types::Ci::JobType, + null: true, + description: 'Job after the mutation.' + + authorize :update_build + + def resolve(id:) + job = authorized_find!(id: id) + + ::Ci::BuildCancelService.new(job, current_user).execute + { + job: job, + errors: errors_on_object(job) + } + end + end + end + end +end diff --git a/app/graphql/mutations/ci/job/play.rb b/app/graphql/mutations/ci/job/play.rb index f87904f8b25..99f62ea3e70 100644 --- a/app/graphql/mutations/ci/job/play.rb +++ b/app/graphql/mutations/ci/job/play.rb @@ -9,7 +9,7 @@ module Mutations field :job, Types::Ci::JobType, null: true, - description: 'The job after the mutation.' + description: 'Job after the mutation.' authorize :update_build diff --git a/app/graphql/mutations/ci/job/retry.rb b/app/graphql/mutations/ci/job/retry.rb index a61d5dddb40..9af357ab216 100644 --- a/app/graphql/mutations/ci/job/retry.rb +++ b/app/graphql/mutations/ci/job/retry.rb @@ -9,7 +9,7 @@ module Mutations field :job, Types::Ci::JobType, null: true, - description: 'The job after the mutation.' + description: 'Job after the mutation.' authorize :update_build diff --git a/app/graphql/mutations/ci/job/unschedule.rb b/app/graphql/mutations/ci/job/unschedule.rb new file mode 100644 index 00000000000..07b1896bd2c --- /dev/null +++ b/app/graphql/mutations/ci/job/unschedule.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Job + class Unschedule < Base + graphql_name 'JobUnschedule' + + field :job, + Types::Ci::JobType, + null: true, + description: 'Job after the mutation.' + + authorize :update_build + + def resolve(id:) + job = authorized_find!(id: id) + + ::Ci::BuildUnscheduleService.new(job, current_user).execute + { + job: job, + errors: errors_on_object(job) + } + end + end + end + end +end diff --git a/app/graphql/mutations/ci/job_token_scope/add_project.rb b/app/graphql/mutations/ci/job_token_scope/add_project.rb index 30f98a537b5..41adcae2c82 100644 --- a/app/graphql/mutations/ci/job_token_scope/add_project.rb +++ b/app/graphql/mutations/ci/job_token_scope/add_project.rb @@ -10,18 +10,18 @@ module Mutations authorize :admin_project - argument :project_path, GraphQL::ID_TYPE, + argument :project_path, GraphQL::Types::ID, required: true, - description: 'The project that the CI job token scope belongs to.' + description: 'Project that the CI job token scope belongs to.' - argument :target_project_path, GraphQL::ID_TYPE, + argument :target_project_path, GraphQL::Types::ID, required: true, - description: 'The project to be added to the CI job token scope.' + description: 'Project to be added to the CI job token scope.' field :ci_job_token_scope, Types::Ci::JobTokenScopeType, null: true, - description: "The CI job token's scope of access." + description: "CI job token's scope of access." def resolve(project_path:, target_project_path:) project = authorized_find!(project_path) diff --git a/app/graphql/mutations/ci/job_token_scope/remove_project.rb b/app/graphql/mutations/ci/job_token_scope/remove_project.rb index 71c9083bef8..dd6b2358dd5 100644 --- a/app/graphql/mutations/ci/job_token_scope/remove_project.rb +++ b/app/graphql/mutations/ci/job_token_scope/remove_project.rb @@ -10,18 +10,18 @@ module Mutations authorize :admin_project - argument :project_path, GraphQL::ID_TYPE, + argument :project_path, GraphQL::Types::ID, required: true, - description: 'The project that the CI job token scope belongs to.' + description: 'Project that the CI job token scope belongs to.' - argument :target_project_path, GraphQL::ID_TYPE, + argument :target_project_path, GraphQL::Types::ID, required: true, - description: 'The project to be removed from the CI job token scope.' + description: 'Project to be removed from the CI job token scope.' field :ci_job_token_scope, Types::Ci::JobTokenScopeType, null: true, - description: "The CI job token's scope of access." + description: "CI job token's scope of access." def resolve(project_path:, target_project_path:) project = authorized_find!(project_path) diff --git a/app/graphql/mutations/ci/pipeline/base.rb b/app/graphql/mutations/ci/pipeline/base.rb index ebfab56e743..aed8035a52a 100644 --- a/app/graphql/mutations/ci/pipeline/base.rb +++ b/app/graphql/mutations/ci/pipeline/base.rb @@ -8,7 +8,7 @@ module Mutations argument :id, PipelineID, required: true, - description: 'The ID of the pipeline to mutate.' + description: 'ID of the pipeline to mutate.' private diff --git a/app/graphql/mutations/ci/pipeline/retry.rb b/app/graphql/mutations/ci/pipeline/retry.rb index a12330470f0..ee93f99703e 100644 --- a/app/graphql/mutations/ci/pipeline/retry.rb +++ b/app/graphql/mutations/ci/pipeline/retry.rb @@ -9,7 +9,7 @@ module Mutations field :pipeline, Types::Ci::PipelineType, null: true, - description: 'The pipeline after mutation.' + description: 'Pipeline after mutation.' authorize :update_pipeline diff --git a/app/graphql/mutations/ci/runner/update.rb b/app/graphql/mutations/ci/runner/update.rb index 4cdfa1fb1bd..e37ab1081f9 100644 --- a/app/graphql/mutations/ci/runner/update.rb +++ b/app/graphql/mutations/ci/runner/update.rb @@ -14,11 +14,11 @@ module Mutations required: true, description: 'ID of the runner to update.' - argument :description, GraphQL::STRING_TYPE, + argument :description, GraphQL::Types::String, required: false, description: 'Description of the runner.' - argument :maximum_timeout, GraphQL::INT_TYPE, + argument :maximum_timeout, GraphQL::Types::Int, required: false, description: 'Maximum timeout (in seconds) for jobs processed by the runner.' @@ -26,24 +26,24 @@ module Mutations required: false, description: 'Access level of the runner.' - argument :active, GraphQL::BOOLEAN_TYPE, + argument :active, GraphQL::Types::Boolean, required: false, description: 'Indicates the runner is allowed to receive jobs.' - argument :locked, GraphQL::BOOLEAN_TYPE, required: false, + argument :locked, GraphQL::Types::Boolean, required: false, description: 'Indicates the runner is locked.' - argument :run_untagged, GraphQL::BOOLEAN_TYPE, + argument :run_untagged, GraphQL::Types::Boolean, required: false, description: 'Indicates the runner is able to run untagged jobs.' - argument :tag_list, [GraphQL::STRING_TYPE], required: false, + argument :tag_list, [GraphQL::Types::String], required: false, description: 'Tags associated with the runner.' field :runner, Types::Ci::RunnerType, null: true, - description: 'The runner after mutation.' + description: 'Runner after mutation.' def resolve(id:, **runner_attrs) runner = authorized_find!(id) diff --git a/app/graphql/mutations/ci/runners_registration_token/reset.rb b/app/graphql/mutations/ci/runners_registration_token/reset.rb index e1cdd9a22a5..7976e8fb70d 100644 --- a/app/graphql/mutations/ci/runners_registration_token/reset.rb +++ b/app/graphql/mutations/ci/runners_registration_token/reset.rb @@ -8,7 +8,7 @@ module Mutations authorize :update_runners_registration_token - ScopeID = ::GraphQL::ID_TYPE + ScopeID = ::GraphQL::Types::ID argument :type, ::Types::Ci::RunnerTypeEnum, required: true, @@ -19,9 +19,9 @@ module Mutations description: 'ID of the project or group to reset the token for. Omit if resetting instance runner token.' field :token, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, - description: 'The runner token after mutation.' + description: 'Runner token after mutation.' def resolve(**args) { |