Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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