summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-09-24 19:41:58 +0000
committerRobert Speicher <robert@gitlab.com>2015-09-24 19:41:58 +0000
commit817a60894a8cb37539c9225b6619083100bc75fc (patch)
tree24fea3323d0baffa9a9602e4c80a51afa0052e6b /app
parent83c9752e04c3d1040191fc68817c0e2a6058a7e3 (diff)
parent04c4445ae088f2599659522c70a096811ecd0496 (diff)
downloadgitlab-ce-817a60894a8cb37539c9225b6619083100bc75fc.tar.gz
Merge branch 'get-ci-token-from-ci-projects' into 'master'
Get CI token from ci projects This fixes problem when GitLabCiService had different token than stored in Ci::Project. See merge request !1425
Diffstat (limited to 'app')
-rw-r--r--app/models/project_services/gitlab_ci_service.rb8
-rw-r--r--app/services/ci/create_project_service.rb2
2 files changed, 7 insertions, 3 deletions
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index df92c6158e7..23ab206efba 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -21,8 +21,6 @@
class GitlabCiService < CiService
include Gitlab::Application.routes.url_helpers
- prop_accessor :token
-
after_save :compose_service_hook, if: :activated?
def compose_service_hook
@@ -53,6 +51,12 @@ class GitlabCiService < CiService
end
end
+ def token
+ if project.gitlab_ci_project.present?
+ project.gitlab_ci_project.token
+ end
+ end
+
def get_ci_commit(sha, ref)
Ci::Project.find(project.gitlab_ci_project).commits.find_by_sha_and_ref!(sha, ref)
end
diff --git a/app/services/ci/create_project_service.rb b/app/services/ci/create_project_service.rb
index 839d3f6b444..f42babd2388 100644
--- a/app/services/ci/create_project_service.rb
+++ b/app/services/ci/create_project_service.rb
@@ -10,7 +10,7 @@ module Ci
gl_project = ::Project.find(@project.gitlab_id)
gl_project.build_missing_services
- gl_project.gitlab_ci_service.update_attributes(active: true, token: @project.token)
+ gl_project.gitlab_ci_service.update_attributes(active: true)
end
if forked_project