summaryrefslogtreecommitdiff
path: root/lib/ci
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-23 12:47:29 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-30 12:48:40 +0200
commitb9ccc79cb5d67e356edce3778b6a17def985ed22 (patch)
tree103aacc1d621c7d6436c2ad3a2a52d48dfc395e1 /lib/ci
parent34431d8ecb1c3d3082c3e391db70b33ca7dbf056 (diff)
downloadgitlab-ce-b9ccc79cb5d67e356edce3778b6a17def985ed22.tar.gz
Delegate ci_project parameters to projects
- It delegates name, path, gitlab_url, ssh_url_to_repo - Remove ability to set this parameters using CI API This fixes GitLab project rename, namespace change, repository rename, etc.
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/api/projects.rb23
1 files changed, 4 insertions, 19 deletions
diff --git a/lib/ci/api/projects.rb b/lib/ci/api/projects.rb
index 66bcf65e8c4..d719ad9e8d5 100644
--- a/lib/ci/api/projects.rb
+++ b/lib/ci/api/projects.rb
@@ -75,23 +75,17 @@ module Ci
# Create Gitlab CI project using Gitlab project info
#
# Parameters:
- # name (required) - The name of the project
# gitlab_id (required) - The gitlab id of the project
- # path (required) - The gitlab project path, ex. randx/six
- # ssh_url_to_repo (required) - The gitlab ssh url to the repo
# default_ref - The branch to run against (defaults to `master`)
# Example Request:
# POST /projects
post do
- required_attributes! [:name, :gitlab_id, :ssh_url_to_repo]
+ required_attributes! [:gitlab_id]
filtered_params = {
- name: params[:name],
gitlab_id: params[:gitlab_id],
# we accept gitlab_url for backward compatibility for a while (added to 7.11)
- path: params[:path] || params[:gitlab_url].sub(/.*\/(.*\/.*)$/, '\1'),
- default_ref: params[:default_ref] || 'master',
- ssh_url_to_repo: params[:ssh_url_to_repo]
+ default_ref: params[:default_ref] || 'master'
}
project = Ci::Project.new(filtered_params)
@@ -109,11 +103,7 @@ module Ci
#
# Parameters:
# id (required) - The ID of a project
- # name - The name of the project
- # gitlab_id - The gitlab id of the project
- # path - The gitlab project path, ex. randx/six
- # ssh_url_to_repo - The gitlab ssh url to the repo
- # default_ref - The branch to run against (defaults to `master`)
+ # default_ref - The branch to run against (defaults to `master`)
# Example Request:
# PUT /projects/:id
put ":id" do
@@ -121,12 +111,7 @@ module Ci
unauthorized! unless can?(current_user, :admin_project, project.gl_project)
- attrs = attributes_for_keys [:name, :gitlab_id, :path, :gitlab_url, :default_ref, :ssh_url_to_repo]
-
- # we accept gitlab_url for backward compatibility for a while (added to 7.11)
- if attrs[:gitlab_url] && !attrs[:path]
- attrs[:path] = attrs[:gitlab_url].sub(/.*\/(.*\/.*)$/, '\1')
- end
+ attrs = attributes_for_keys [:default_ref]
if project.update_attributes(attrs)
present project, with: Entities::Project