Commit b16d77c3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make it easier to add CI services

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent cce27a6a
...@@ -58,6 +58,7 @@ class Project < ActiveRecord::Base ...@@ -58,6 +58,7 @@ class Project < ActiveRecord::Base
has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event', foreign_key: 'project_id' has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event', foreign_key: 'project_id'
# Project services # Project services
has_many :services
has_one :gitlab_ci_service, dependent: :destroy has_one :gitlab_ci_service, dependent: :destroy
has_one :campfire_service, dependent: :destroy has_one :campfire_service, dependent: :destroy
has_one :emails_on_push_service, dependent: :destroy has_one :emails_on_push_service, dependent: :destroy
...@@ -329,20 +330,12 @@ class Project < ActiveRecord::Base ...@@ -329,20 +330,12 @@ class Project < ActiveRecord::Base
gitlab_ci_service && gitlab_ci_service.active gitlab_ci_service && gitlab_ci_service.active
end end
def jenkins_enabled? def ci_services
jenkins_service && jenkins_service.active services.select { |service| service.category == :ci }
end
def enabled_ci?
gitlab_ci? || jenkins_enabled?
end end
def ci_service def ci_service
if gitlab_ci? services.select(&:activated?).first
gitlab_ci_service
elsif jenkins_enabled?
jenkins_service
end
end end
def jira_tracker? def jira_tracker?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment