Skip to content

Commit

Permalink
Merge pull request #685 from ddieulivol/ddieulivol-add_pipeline_metad…
Browse files Browse the repository at this point in the history
…ata_endpoint

Add pipeline metadata update endpoint
  • Loading branch information
NARKOZ authored Apr 30, 2024
2 parents 79c6759 + b22ed4d commit f96f86a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/gitlab/client/pipelines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,18 @@ def retry_pipeline(project, id)
def delete_pipeline(project, id)
delete("/projects/#{url_encode project}/pipelines/#{id}")
end

# Update a pipeline metadata
#
# @example
# Gitlab.update_pipeline_metadata(5, 1, name: 'new name')
#
# @param [Integer, String] project The ID or name of a project.
# @param [Integer] id The ID of a pipeline.
# @option options [String] :name The new name of the pipeline.
# @return [Gitlab::ObjectifiedHash]
def update_pipeline_metadata(project, id, options = {})
put("/projects/#{url_encode project}/pipelines/#{id}/metadata", body: options)
end
end
end
13 changes: 13 additions & 0 deletions spec/gitlab/client/pipelines_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,17 @@
expect(a_delete('/projects/3/pipelines/46')).to have_been_made
end
end

describe '.update_pipeline_metadata' do
before do
stub_put('/projects/3/pipelines/46/metadata', 'pipeline')
Gitlab.update_pipeline_metadata(3, 46, name: 'new pipeline name')
end

it 'gets the correct resource' do
expect(
a_put('/projects/3/pipelines/46/metadata').with(body: { name: 'new pipeline name' })
).to have_been_made
end
end
end

0 comments on commit f96f86a

Please sign in to comment.