Commit 67eb610b authored by Yorick Peterse's avatar Yorick Peterse

Backport EE changes made to the scripts/ directory

This backport changes made by EE to the files in the scripts/ directory.
This comes with a few changes to some scripts to make them work in the
single codebase setup.
parent 40fb7ca5
# frozen_string_literal: true
require_dependency File.expand_path('gitlab/popen', __dir__)
require 'pathname'
module Gitlab
def self.root
......@@ -61,7 +61,7 @@ module Gitlab
def self.ee?
@is_ee ||=
if ENV['IS_GITLAB_EE'].present?
if ENV['IS_GITLAB_EE'] && !ENV['IS_GITLAB_EE'].empty?
Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE'])
else
# We may use this method when the Rails environment is not loaded. This
......
......@@ -70,5 +70,13 @@ namespace :gitlab do
Gitlab::DowntimeCheck.new.check_and_print(migrations)
end
desc 'Sets up EE specific database functionality'
if Gitlab.ee?
task setup_ee: %w[geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate]
else
task :setup_ee
end
end
end
#!/usr/bin/env ruby
# We don't have auto-loading here
require_relative '../lib/gitlab'
require_relative '../lib/gitlab/popen'
require_relative '../lib/gitlab/popen/runner'
......@@ -26,7 +27,6 @@ def emit_errors(static_analysis)
end
tasks = [
%w[ruby -rbundler/setup scripts/ee_specific_check/ee_specific_check.rb],
%w[bin/rake lint:all],
%w[bundle exec license_finder],
%w[yarn run eslint],
......@@ -37,6 +37,10 @@ tasks = [
%w[scripts/lint-rugged]
]
if Gitlab.ee?
tasks.unshift(%w[ruby -rbundler/setup scripts/ee_specific_check/ee_specific_check.rb])
end
static_analysis = Gitlab::Popen::Runner.new
static_analysis.run(tasks) do |cmd, &run|
......
......@@ -30,8 +30,7 @@ function setup_db() {
bundle exec rake add_limits_mysql
fi
# EE-only
bundle exec rake geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate
bundle exec rake gitlab:db:setup_ee
}
function install_api_client_dependencies_with_apk() {
......
......@@ -136,6 +136,12 @@ describe Gitlab do
expect(described_class.ee?).to eq(false)
end
it 'returns true when the IS_GITLAB_EE variable is not empty' do
stub_env('IS_GITLAB_EE', '1')
expect(described_class.ee?).to eq(true)
end
end
describe '.http_proxy_env?' do
......
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