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
Tatuya Kamada
gitlab-ce
Commits
d636ad49
Commit
d636ad49
authored
Oct 29, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: set gitlab-ci service for project
parent
d71914ca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
11 deletions
+75
-11
CHANGELOG
CHANGELOG
+1
-0
app/models/hipchat_service.rb
app/models/hipchat_service.rb
+0
-1
lib/api/api.rb
lib/api/api.rb
+1
-0
lib/api/deploy_keys.rb
lib/api/deploy_keys.rb
+0
-10
lib/api/services.rb
lib/api/services.rb
+40
-0
spec/requests/api/services_spec.rb
spec/requests/api/services_spec.rb
+33
-0
No files found.
CHANGELOG
View file @
d636ad49
v 6.3.0
- API for adding gitlab-ci service
- Init script now waits for pids to appear after (re)starting before reporting status (Rovanion Luckey)
- Restyle project home page
- Grammar fixes
...
...
app/models/hipchat_service.rb
View file @
d636ad49
...
...
@@ -71,5 +71,4 @@ class HipchatService < Service
message
end
end
lib/api/api.rb
View file @
d636ad49
...
...
@@ -38,5 +38,6 @@ module API
mount
ProjectSnippets
mount
DeployKeys
mount
ProjectHooks
mount
Services
end
end
lib/api/deploy_keys.rb
View file @
d636ad49
...
...
@@ -5,16 +5,6 @@ module API
before
{
authorize_admin_project
}
resource
:projects
do
helpers
do
def
handle_project_member_errors
(
errors
)
if
errors
[
:project_access
].
any?
error!
(
errors
[
:project_access
],
422
)
end
not_found!
end
end
# Get a specific project's keys
#
# Example Request:
...
...
lib/api/services.rb
0 → 100644
View file @
d636ad49
module
API
# Projects API
class
Services
<
Grape
::
API
before
{
authenticate!
}
before
{
authorize_admin_project
}
resource
:projects
do
# Set GitLab CI service for project
#
# Parameters:
# token (required) - CI project token
# project_url (required) - CI project url
#
# Example Request:
# PUT /projects/:id/services/gitlab-ci
put
":id/services/gitlab-ci"
do
required_attributes!
[
:token
,
:project_url
]
attrs
=
attributes_for_keys
[
:token
,
:project_url
]
user_project
.
build_missing_services
if
user_project
.
gitlab_ci_service
.
update_attributes
(
attrs
.
merge
(
active:
true
))
true
else
not_found!
end
end
# Delete GitLab CI service settings
#
# Example Request:
# DELETE /projects/:id/keys/:id
delete
":id/services/gitlab-ci"
do
if
user_project
.
gitlab_ci_service
user_project
.
gitlab_ci_service
.
destroy
end
end
end
end
end
spec/requests/api/services_spec.rb
0 → 100644
View file @
d636ad49
require
"spec_helper"
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project_with_code
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
describe
"POST /projects/:id/services/gitlab-ci"
do
it
"should update gitlab-ci settings"
do
put
api
(
"/projects/
#{
project
.
id
}
/services/gitlab-ci"
,
user
),
token:
'secret-token'
,
project_url:
"http://ci.example.com/projects/1"
response
.
status
.
should
==
200
end
it
"should return if required fields missing"
do
put
api
(
"/projects/
#{
project
.
id
}
/services/gitlab-ci"
,
user
),
project_url:
"http://ci.example.com/projects/1"
,
active:
true
response
.
status
.
should
==
400
end
end
describe
"DELETE /projects/:id/services/gitlab-ci"
do
it
"should update gitlab-ci settings"
do
delete
api
(
"/projects/
#{
project
.
id
}
/services/gitlab-ci"
,
user
)
response
.
status
.
should
==
200
project
.
gitlab_ci_service
.
should
be_nil
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