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
iv
gitlab-ce
Commits
c119a737
Commit
c119a737
authored
Nov 12, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add releases api
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
d343d9d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
lib/api/entities.rb
lib/api/entities.rb
+4
-0
lib/api/tags.rb
lib/api/tags.rb
+18
-1
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+14
-1
No files found.
lib/api/entities.rb
View file @
c119a737
...
...
@@ -341,5 +341,9 @@ module API
expose
:user_oauth_applications
expose
:after_sign_out_path
end
class
Release
<
Grape
::
Entity
expose
:tag
,
:description
end
end
end
lib/api/tags.rb
View file @
c119a737
module
API
#
Release
s API
#
Git Tag
s API
class
Tags
<
Grape
::
API
before
{
authenticate!
}
before
{
authorize!
:download_code
,
user_project
}
...
...
@@ -39,6 +39,23 @@ module API
render_api_error!
(
result
[
:message
],
400
)
end
end
# Add release notes to tag
#
# Parameters:
# id (required) - The ID of a project
# tag (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
authorize_push_project
required_attributes!
[
:description
]
release
=
user_project
.
releases
.
find_or_initialize_by
(
tag:
params
[
:tag
])
release
.
update_attributes
(
description:
params
[
:description
])
present
release
,
with:
Entities
::
Release
end
end
end
end
spec/requests/api/tags_spec.rb
View file @
c119a737
...
...
@@ -11,7 +11,6 @@ describe API::API, api: true do
let!
(
:master
)
{
create
(
:project_member
,
user:
user
,
project:
project
,
access_level:
ProjectMember
::
MASTER
)
}
let!
(
:guest
)
{
create
(
:project_member
,
user:
user2
,
project:
project
,
access_level:
ProjectMember
::
GUEST
)
}
describe
"GET /projects/:id/repository/tags"
do
it
"should return an array of project tags"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user
)
...
...
@@ -86,4 +85,18 @@ describe API::API, api: true do
expect
(
json_response
[
'message'
]).
to
eq
(
'Invalid reference name'
)
end
end
describe
'PUT /projects/:id/repository/:tag/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
),
description:
description
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'tag'
]).
to
eq
(
tag_name
)
expect
(
json_response
[
'description'
]).
to
eq
(
description
)
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