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
Jérome Perrin
gitlab-ce
Commits
2cba93a0
Commit
2cba93a0
authored
Nov 21, 2015
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tag API consistent for release feature
parent
4427e80f
Changes
4
Show 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:
...
@@ -29,7 +29,7 @@ Parameters:
]
]
},
},
"release"
:
{
"release"
:
{
"tag"
:
"1.0.0"
,
"tag
_name
"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
"description"
:
"Amazing release. Wow"
},
},
"name"
:
"v1.0.0"
,
"name"
:
"v1.0.0"
,
...
@@ -70,7 +70,7 @@ Parameters:
...
@@ -70,7 +70,7 @@ Parameters:
]
]
},
},
"release"
:
{
"release"
:
{
"tag"
:
"1.0.0"
,
"tag
_name
"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
"description"
:
"Amazing release. Wow"
},
},
"name"
:
"v1.0.0"
,
"name"
:
"v1.0.0"
,
...
@@ -89,18 +89,18 @@ It returns 200 if the operation succeed. In case of an error,
...
@@ -89,18 +89,18 @@ It returns 200 if the operation succeed. In case of an error,
Add release notes to the existing git tag
Add release notes to the existing git tag
```
```
PUT /projects/:id/repository/
:tag
/release
PUT /projects/:id/repository/
tags/:tag_name
/release
```
```
Parameters:
Parameters:
-
`id`
(required) - The ID of a project
-
`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
-
`description`
(required) - Release notes with markdown support
```
json
```
json
{
{
"tag"
:
"1.0.0"
,
"tag
_name
"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
"description"
:
"Amazing release. Wow"
}
}
```
```
lib/api/entities.rb
View file @
2cba93a0
...
@@ -322,7 +322,8 @@ module API
...
@@ -322,7 +322,8 @@ module API
end
end
class
Release
<
Grape
::
Entity
class
Release
<
Grape
::
Entity
expose
:tag
,
:description
expose
:tag
,
as: :tag_name
expose
:description
end
end
class
RepoTag
<
Grape
::
Entity
class
RepoTag
<
Grape
::
Entity
...
...
lib/api/tags.rb
View file @
2cba93a0
...
@@ -44,14 +44,14 @@ module API
...
@@ -44,14 +44,14 @@ module API
#
#
# Parameters:
# Parameters:
# id (required) - The ID of a project
# 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
# description (required) - Release notes with markdown support
# Example Request:
# Example Request:
# PUT /projects/:id/repository/tags
# PUT /projects/:id/repository/tags
/:tag_name/release
put
':id/repository/
:tag/release'
,
requirements:
{
tag
:
/.*/
}
do
put
':id/repository/
tags/:tag_name/release'
,
requirements:
{
tag_name
:
/.*/
}
do
authorize_push_project
authorize_push_project
required_attributes!
[
:description
]
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
])
release
.
update_attributes
(
description:
params
[
:description
])
present
release
,
with:
Entities
::
Release
present
release
,
with:
Entities
::
Release
...
...
spec/requests/api/tags_spec.rb
View file @
2cba93a0
...
@@ -119,16 +119,16 @@ describe API::API, api: true do
...
@@ -119,16 +119,16 @@ describe API::API, api: true do
end
end
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
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:description
)
{
'Awesome release!'
}
let
(
:description
)
{
'Awesome release!'
}
it
'should create description for existing git tag'
do
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
description:
description
expect
(
response
.
status
).
to
eq
(
200
)
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
)
expect
(
json_response
[
'description'
]).
to
eq
(
description
)
end
end
end
end
...
...
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