Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/ci/pipelines.rb')
-rw-r--r--lib/api/ci/pipelines.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/api/ci/pipelines.rb b/lib/api/ci/pipelines.rb
index bd5c04f401b..b5123ab49dc 100644
--- a/lib/api/ci/pipelines.rb
+++ b/lib/api/ci/pipelines.rb
@@ -288,6 +288,33 @@ module API
end
end
+ desc 'Updates pipeline metadata' do
+ detail 'This feature was introduced in GitLab 16.6'
+ success status: 200, model: Entities::Ci::PipelineWithMetadata
+ failure [
+ { code: 400, message: 'Bad request' },
+ { code: 401, message: 'Unauthorized' },
+ { code: 403, message: 'Forbidden' },
+ { code: 404, message: 'Not found' }
+ ]
+ end
+ params do
+ requires :pipeline_id, type: Integer, desc: 'The pipeline ID', documentation: { example: 18 }
+ requires :name, type: String, desc: 'The name of the pipeline', documentation: { example: 'Deployment to production' }
+ end
+ route_setting :authentication, job_token_allowed: true
+ put ':id/pipelines/:pipeline_id/metadata', urgency: :low, feature_category: :continuous_integration do
+ authorize! :update_pipeline, pipeline
+
+ response = ::Ci::Pipelines::UpdateMetadataService.new(pipeline, params.slice(:name)).execute
+
+ if response.success?
+ present response.payload, with: Entities::Ci::PipelineWithMetadata
+ else
+ render_api_error_with_reason!(response.reason, response.message, response.payload.join(', '))
+ end
+ end
+
desc 'Retry builds in the pipeline' do
detail 'This feature was introduced in GitLab 8.11.'
success status: 201, model: Entities::Ci::Pipeline
@@ -325,7 +352,7 @@ module API
requires :pipeline_id, type: Integer, desc: 'The pipeline ID', documentation: { example: 18 }
end
post ':id/pipelines/:pipeline_id/cancel', urgency: :low, feature_category: :continuous_integration do
- authorize! :update_pipeline, pipeline
+ authorize! :cancel_pipeline, pipeline
# TODO: inconsistent behavior: when pipeline is not cancelable we should return an error
::Ci::CancelPipelineService.new(pipeline: pipeline, current_user: current_user).execute