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
Kazuhiko Shiozaki
gitlab-ce
Commits
2cba93a0
Commit
2cba93a0
authored
9 years ago
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tag API consistent for release feature
parent
4427e80f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
doc/api/tags.md
doc/api/tags.md
+5
-5
lib/api/entities.rb
lib/api/entities.rb
+2
-1
lib/api/tags.rb
lib/api/tags.rb
+4
-4
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+3
-3
No files found.
doc/api/tags.md
View file @
2cba93a0
...
...
@@ -29,7 +29,7 @@ Parameters:
]
},
"release"
:
{
"tag"
:
"1.0.0"
,
"tag
_name
"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
},
"name"
:
"v1.0.0"
,
...
...
@@ -70,7 +70,7 @@ Parameters:
]
},
"release"
:
{
"tag"
:
"1.0.0"
,
"tag
_name
"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
},
"name"
:
"v1.0.0"
,
...
...
@@ -89,18 +89,18 @@ It returns 200 if the operation succeed. In case of an error,
Add release notes to the existing git tag
```
PUT /projects/:id/repository/
:tag
/release
PUT /projects/:id/repository/
tags/:tag_name
/release
```
Parameters:
-
`id`
(required) - The ID of a project
-
`tag`
(required) - The name of a tag
-
`tag
_name
`
(required) - The name of a tag
-
`description`
(required) - Release notes with markdown support
```
json
{
"tag"
:
"1.0.0"
,
"tag
_name
"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
}
```
This diff is collapsed.
Click to expand it.
lib/api/entities.rb
View file @
2cba93a0
...
...
@@ -322,7 +322,8 @@ module API
end
class
Release
<
Grape
::
Entity
expose
:tag
,
:description
expose
:tag
,
as: :tag_name
expose
:description
end
class
RepoTag
<
Grape
::
Entity
...
...
This diff is collapsed.
Click to expand it.
lib/api/tags.rb
View file @
2cba93a0
...
...
@@ -44,14 +44,14 @@ module API
#
# Parameters:
# id (required) - The ID of a project
# tag (required) - The name of the tag
# tag
_name
(required) - The name of the tag
# description (required) - Release notes with markdown support
# Example Request:
# PUT /projects/:id/repository/tags
put
':id/repository/
:tag/release'
,
requirements:
{
tag
:
/.*/
}
do
# PUT /projects/:id/repository/tags
/:tag_name/release
put
':id/repository/
tags/:tag_name/release'
,
requirements:
{
tag_name
:
/.*/
}
do
authorize_push_project
required_attributes!
[
:description
]
release
=
user_project
.
releases
.
find_or_initialize_by
(
tag:
params
[
:tag
])
release
=
user_project
.
releases
.
find_or_initialize_by
(
tag:
params
[
:tag
_name
])
release
.
update_attributes
(
description:
params
[
:description
])
present
release
,
with:
Entities
::
Release
...
...
This diff is collapsed.
Click to expand it.
spec/requests/api/tags_spec.rb
View file @
2cba93a0
...
...
@@ -119,16 +119,16 @@ describe API::API, api: true do
end
end
describe
'PUT /projects/:id/repository/
:tag
/release'
do
describe
'PUT /projects/:id/repository/
tags/:tag_name
/release'
do
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:description
)
{
'Awesome release!'
}
it
'should create description for existing git tag'
do
put
api
(
"/projects/
#{
project
.
id
}
/repository/
#{
tag_name
}
/release"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/repository/
tags/
#{
tag_name
}
/release"
,
user
),
description:
description
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'tag'
]).
to
eq
(
tag_name
)
expect
(
json_response
[
'tag
_name
'
]).
to
eq
(
tag_name
)
expect
(
json_response
[
'description'
]).
to
eq
(
description
)
end
end
...
...
This diff is collapsed.
Click to expand it.
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