Skip to content
Snippets Groups Projects
Commit 64295a18 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Get GitLabCiService token from CI project

parent 6a326089
No related branches found
No related tags found
1 merge request!1425Get CI token from ci projects
Loading
@@ -21,8 +21,6 @@
Loading
@@ -21,8 +21,6 @@
class GitlabCiService < CiService class GitlabCiService < CiService
include Gitlab::Application.routes.url_helpers include Gitlab::Application.routes.url_helpers
   
prop_accessor :token
after_save :compose_service_hook, if: :activated? after_save :compose_service_hook, if: :activated?
   
def compose_service_hook def compose_service_hook
Loading
@@ -53,6 +51,12 @@ class GitlabCiService < CiService
Loading
@@ -53,6 +51,12 @@ class GitlabCiService < CiService
end end
end end
   
def token
if project.gitlab_ci_project.present?
project.gitlab_ci_project.token
end
end
def get_ci_commit(sha, ref) def get_ci_commit(sha, ref)
Ci::Project.find(project.gitlab_ci_project).commits.find_by_sha_and_ref!(sha, ref) Ci::Project.find(project.gitlab_ci_project).commits.find_by_sha_and_ref!(sha, ref)
end end
Loading
@@ -69,8 +73,7 @@ class GitlabCiService < CiService
Loading
@@ -69,8 +73,7 @@ class GitlabCiService < CiService
name_with_namespace: new_project.name_with_namespace, name_with_namespace: new_project.name_with_namespace,
path_with_namespace: new_project.path_with_namespace, path_with_namespace: new_project.path_with_namespace,
web_url: new_project.web_url, web_url: new_project.web_url,
default_branch: new_project.default_branch, default_branch: new_project.default_branch
ssh_url_to_repo: new_project.ssh_url_to_repo
}) })
   
ci_project = Ci::Project.find_by!(gitlab_id: project.id) ci_project = Ci::Project.find_by!(gitlab_id: project.id)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment