GitLab wurde erfolgreich aktualisiert. Durch regelmäßige Updates bleibt das THM GitLab sicher. Danke für Ihre Geduld.

Commit 4c90ed52 authored by Robert Schilling's avatar Robert Schilling

Delete tag via API

parent e78ddb09
......@@ -26,6 +26,7 @@ v 8.4.0 (unreleased)
- Properly set task-list class on single item task lists
- Add file finder feature in tree view (Kyungchul Shin)
- Ajax filter by message for commits page
- API: Add support for deleting a tag via the API (Robert Schilling)
v 8.3.3 (unreleased)
- Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running
......@@ -83,6 +83,26 @@ it will contain the annotation.
It returns 200 if the operation succeed. In case of an error,
405 with an explaining error message is returned.
## Delete a tag
Deletes a tag of a repository with given name. On success, this API method
returns 200 with the name of the deleted tag. If the tag does not exist, the
API returns 404.
DELETE /projects/:id/repository/tags/:tag_name
- `id` (required) - The ID of a project
- `tag_name` (required) - The name of a tag
"tag_name": "v4.3.0"
## Create a new release
......@@ -40,6 +40,27 @@ class Tags < Grape::API
# Delete tag
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# Example Request:
# DELETE /projects/:id/repository/tags/:tag
delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.*/ } do
result =, current_user).
if result[:status] == :success
tag_name: params[:tag_name]
render_api_error!(result[:message], result[:return_code])
# Add release notes to tag
# Parameters:
......@@ -65,6 +65,27 @@
describe 'DELETE /projects/:id/repository/tags/:tag_name' do
let(:tag_name) { project.repository.tag_names.sort.reverse.first }
before do
allow_any_instance_of(Repository).to receive(:rm_tag).and_return(true)
context 'delete tag' do
it 'should delete an existing tag' do
delete api("/projects/#{}/repository/tags/#{tag_name}", user)
expect(response.status).to eq(200)
expect(json_response['tag_name']).to eq(tag_name)
it 'should raise 404 if the tag does not exist' do
delete api("/projects/#{}/repository/tags/foobar", user)
expect(response.status).to eq(404)
context 'annotated tag' do
it 'should create a new annotated tag' do
# Identity must be set in .gitconfig to create annotated tag.
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