BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c119a737
Unverified
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
entities.rb
lib/api/entities.rb
+4
-0
tags.rb
lib/api/tags.rb
+18
-1
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