Commit 297b11ea authored by Arturo Herrero's avatar Arturo Herrero

GitHub and Jenkins only available at project-level

GitHub & Jenkins CI doesn't make sense at the instance-level or
group-level as they are mapping one GitLab project with one GitHub
repository or Jenkins project.
parent 268be250
......@@ -4,28 +4,27 @@ module EE
module Service
extend ActiveSupport::Concern
EE_SERVICE_NAMES = %w[
github
jenkins
EE_DEV_OR_COM_PROJECT_SPECIFIC_SERVICE_NAMES = %w[
gitlab_slack_application
].freeze
EE_PROJECT_SPECIFIC_SERVICE_NAMES = %w[
gitlab_slack_application
github
jenkins
].freeze
class_methods do
extend ::Gitlab::Utils::Override
override :services_names
def services_names
super + EE_SERVICE_NAMES
end
override :project_specific_services_names
def project_specific_services_names
return super unless ::Gitlab.dev_env_or_com?
services = super + EE_PROJECT_SPECIFIC_SERVICE_NAMES
super + EE_PROJECT_SPECIFIC_SERVICE_NAMES
if ::Gitlab.dev_env_or_com?
services + EE_DEV_OR_COM_PROJECT_SPECIFIC_SERVICE_NAMES
else
services
end
end
end
end
......
......@@ -3,17 +3,6 @@
require 'spec_helper'
RSpec.describe Service do
describe 'Available services' do
let(:ee_services) do
%w[
github
jenkins
]
end
it { expect(described_class.available_services_names).to include(*ee_services) }
end
describe '.project_specific_services_names' do
before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com)
......@@ -22,13 +11,13 @@ RSpec.describe Service do
context 'when not on gitlab.com and not in development environment' do
let(:dev_env_or_com) { false }
it { expect(described_class.project_specific_services_names).to eq([]) }
it { expect(described_class.project_specific_services_names).to contain_exactly('github', 'jenkins') }
end
context 'when on gitlab.com or in dev environment' do
let(:dev_env_or_com) { true }
it { expect(described_class.project_specific_services_names).to eq(%w[gitlab_slack_application]) }
it { expect(described_class.project_specific_services_names).to contain_exactly('github', 'gitlab_slack_application', 'jenkins') }
end
end
end
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