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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b998479c
Commit
b998479c
authored
Oct 12, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Version information
parent
7c07c07d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
0 deletions
+65
-0
CHANGELOG
CHANGELOG
+1
-0
doc/api/README.md
doc/api/README.md
+1
-0
doc/api/version.md
doc/api/version.md
+23
-0
lib/api/api.rb
lib/api/api.rb
+1
-0
lib/api/version.rb
lib/api/version.rb
+12
-0
spec/requests/api/version_spec.rb
spec/requests/api/version_spec.rb
+27
-0
No files found.
CHANGELOG
View file @
b998479c
...
...
@@ -30,6 +30,7 @@ v 8.13.0 (unreleased)
- Cache rendered markdown in the database, rather than Redis
- Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes without references
- Simplify Mentionable concern instance methods
- API: Ability to retrieve version information (Robert Schilling)
- Fix permission for setting an issue's due date
- API: Multi-file commit !6096 (mahcsig)
- Revert "Label list shows all issues (opened or closed) with that label"
...
...
doc/api/README.md
View file @
b998479c
...
...
@@ -46,6 +46,7 @@ following locations:
-
[
Todos
](
todos.md
)
-
[
Users
](
users.md
)
-
[
Validate CI configuration
](
ci/lint.md
)
-
[
Version
](
version.md
)
### Internal CI API
...
...
doc/api/version.md
0 → 100644
View file @
b998479c
# Version API
>**Note:** This feature was introduced in GitLab 8.13
Retrieve version information for this GitLab instance. Responds
`200 OK`
for
authenticated users.
```
GET /version
```
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/version
```
Example response:
```
json
{
"version"
:
"8.13.0-pre"
,
"revision"
:
"4e963fe"
}
```
lib/api/api.rb
View file @
b998479c
...
...
@@ -73,6 +73,7 @@ module API
mount
::
API
::
Triggers
mount
::
API
::
Users
mount
::
API
::
Variables
mount
::
API
::
Version
route
:any
,
'*path'
do
error!
(
'404 Not Found'
,
404
)
...
...
lib/api/version.rb
0 → 100644
View file @
b998479c
module
API
class
Version
<
Grape
::
API
before
{
authenticate!
}
desc
'Get the version information of the GitLab instance.'
do
detail
'This feature was introduced in GitLab 8.13.'
end
get
'/version'
do
{
version:
Gitlab
::
VERSION
,
revision:
Gitlab
::
REVISION
}
end
end
end
spec/requests/api/version_spec.rb
0 → 100644
View file @
b998479c
require
'spec_helper'
describe
API
::
API
,
api:
true
do
include
ApiHelpers
describe
'GET /version'
do
context
'when unauthenticated'
do
it
'returns authentication error'
do
get
api
(
'/version'
)
expect
(
response
).
to
have_http_status
(
401
)
end
end
context
'when authenticated'
do
let
(
:user
)
{
create
(
:user
)
}
it
'returns the version information'
do
get
api
(
'/version'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'version'
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
json_response
[
'revision'
]).
to
eq
(
Gitlab
::
REVISION
)
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