Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
4c90ed52
Commit
4c90ed52
authored
Jan 08, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete tag via API
parent
e78ddb09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
0 deletions
+63
-0
CHANGELOG
CHANGELOG
+1
-0
doc/api/tags.md
doc/api/tags.md
+20
-0
lib/api/tags.rb
lib/api/tags.rb
+21
-0
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+21
-0
No files found.
CHANGELOG
View file @
4c90ed52
...
@@ -26,6 +26,7 @@ v 8.4.0 (unreleased)
...
@@ -26,6 +26,7 @@ v 8.4.0 (unreleased)
- Properly set task-list class on single item task lists
- Properly set task-list class on single item task lists
- Add file finder feature in tree view (Kyungchul Shin)
- Add file finder feature in tree view (Kyungchul Shin)
- Ajax filter by message for commits page
- Ajax filter by message for commits page
- API: Add support for deleting a tag via the API (Robert Schilling)
v 8.3.3 (unreleased)
v 8.3.3 (unreleased)
- Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running
- Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running
...
...
doc/api/tags.md
View file @
4c90ed52
...
@@ -83,6 +83,26 @@ it will contain the annotation.
...
@@ -83,6 +83,26 @@ it will contain the annotation.
It returns 200 if the operation succeed. In case of an error,
It returns 200 if the operation succeed. In case of an error,
405 with an explaining error message is returned.
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
```
Parameters:
-
`id`
(required) - The ID of a project
-
`tag_name`
(required) - The name of a tag
```
json
{
"tag_name"
:
"v4.3.0"
}
```
## Create a new release
## Create a new release
...
...
lib/api/tags.rb
View file @
4c90ed52
...
@@ -40,6 +40,27 @@ module API
...
@@ -40,6 +40,27 @@ module API
end
end
end
end
# 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
authorize_push_project
result
=
DeleteTagService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:tag_name
])
if
result
[
:status
]
==
:success
{
tag_name:
params
[
:tag_name
]
}
else
render_api_error!
(
result
[
:message
],
result
[
:return_code
])
end
end
# Add release notes to tag
# Add release notes to tag
#
#
# Parameters:
# Parameters:
...
...
spec/requests/api/tags_spec.rb
View file @
4c90ed52
...
@@ -65,6 +65,27 @@ describe API::API, api: true do
...
@@ -65,6 +65,27 @@ describe API::API, api: true do
end
end
end
end
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
)
end
context
'delete tag'
do
it
'should delete an existing tag'
do
delete
api
(
"/projects/
#{
project
.
id
}
/repository/tags/
#{
tag_name
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'tag_name'
]).
to
eq
(
tag_name
)
end
it
'should raise 404 if the tag does not exist'
do
delete
api
(
"/projects/
#{
project
.
id
}
/repository/tags/foobar"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
context
'annotated tag'
do
context
'annotated tag'
do
it
'should create a new annotated tag'
do
it
'should create a new annotated tag'
do
# Identity must be set in .gitconfig to create annotated tag.
# Identity must be set in .gitconfig to create annotated tag.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment