Commit 76abdcd7 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'ee-resolve-scripts-differences' into 'master'

EE: Backport EE changes made to the scripts/ directory

See merge request gitlab-org/gitlab-ee!14778
parents 40332d0e 67eb610b
# frozen_string_literal: true # frozen_string_literal: true
require_dependency File.expand_path('gitlab/popen', __dir__) require 'pathname'
module Gitlab module Gitlab
def self.root def self.root
...@@ -61,7 +61,7 @@ module Gitlab ...@@ -61,7 +61,7 @@ module Gitlab
def self.ee? def self.ee?
@is_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']) Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE'])
else else
# We may use this method when the Rails environment is not loaded. This # We may use this method when the Rails environment is not loaded. This
......
...@@ -70,5 +70,13 @@ namespace :gitlab do ...@@ -70,5 +70,13 @@ namespace :gitlab do
Gitlab::DowntimeCheck.new.check_and_print(migrations) Gitlab::DowntimeCheck.new.check_and_print(migrations)
end 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
end end
#!/usr/bin/env ruby #!/usr/bin/env ruby
# We don't have auto-loading here # We don't have auto-loading here
require_relative '../lib/gitlab'
require_relative '../lib/gitlab/popen' require_relative '../lib/gitlab/popen'
require_relative '../lib/gitlab/popen/runner' require_relative '../lib/gitlab/popen/runner'
...@@ -26,7 +27,6 @@ def emit_errors(static_analysis) ...@@ -26,7 +27,6 @@ def emit_errors(static_analysis)
end end
tasks = [ tasks = [
%w[ruby -rbundler/setup scripts/ee_specific_check/ee_specific_check.rb],
%w[bin/rake lint:all], %w[bin/rake lint:all],
%w[bundle exec license_finder], %w[bundle exec license_finder],
%w[yarn run eslint], %w[yarn run eslint],
...@@ -37,6 +37,10 @@ tasks = [ ...@@ -37,6 +37,10 @@ tasks = [
%w[scripts/lint-rugged] %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 = Gitlab::Popen::Runner.new
static_analysis.run(tasks) do |cmd, &run| static_analysis.run(tasks) do |cmd, &run|
......
...@@ -30,8 +30,7 @@ function setup_db() { ...@@ -30,8 +30,7 @@ function setup_db() {
bundle exec rake add_limits_mysql bundle exec rake add_limits_mysql
fi fi
# EE-only bundle exec rake gitlab:db:setup_ee
bundle exec rake geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate
} }
function install_api_client_dependencies_with_apk() { function install_api_client_dependencies_with_apk() {
......
...@@ -136,6 +136,12 @@ describe Gitlab do ...@@ -136,6 +136,12 @@ describe Gitlab do
expect(described_class.ee?).to eq(false) expect(described_class.ee?).to eq(false)
end 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 end
describe '.http_proxy_env?' do 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