Skip to content
代码片段 群组 项目
提交 49dda390 编辑于 作者: Kamil Trzciński's avatar Kamil Trzciński 提交者: Grzegorz Bizon
浏览文件

Make IS_GITLAB_EE consistent

Currently:
1. If `IS_GITLAB_EE=` is used, it fails to generate Webpack
   as it cannot be parsed as JSON,
2. If `IS_GITLAB_EE=1` is used, it fails on GitLab CE,
3. If `IS_GITLAB_EE=0` it does work correctly, and disables EE,
4. If `IS_GITLAB_EE=1` is used on GitLab EE it effectively required
   to run on EE changes.

This changes to:

Make `IS_GITLAB_EE=` to donate the intent to disable or enable EE
sources, instead of requiring it, and makes the check consitent
in behaviour.
上级 d51133ad
No related branches found
No related tags found
无相关合并请求
......@@ -3,7 +3,12 @@ const path = require('path');
const ROOT_PATH = path.resolve(__dirname, '../..');
// The `IS_GITLAB_EE` is always `string` or `nil`
// Thus the nil or empty string will result
// in using default value: true
//
// The behavior needs to be synchronised with
// lib/gitlab.rb: Gitlab.ee?
module.exports =
process.env.IS_GITLAB_EE !== undefined
? JSON.parse(process.env.IS_GITLAB_EE)
: fs.existsSync(path.join(ROOT_PATH, 'ee'));
fs.existsSync(path.join(ROOT_PATH, 'ee', 'app', 'models', 'license.rb')) &&
(!process.env.IS_GITLAB_EE || JSON.parse(process.env.IS_GITLAB_EE));
......@@ -65,14 +65,18 @@ def self.dev_env_or_com?
def self.ee?
@is_ee ||=
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
# means that checking the presence of the License class could result in
# this method returning `false`, even for an EE installation.
root.join('ee/app/models/license.rb').exist?
end
# We use this method when the Rails environment is not loaded. This
# means that checking the presence of the License class could result in
# this method returning `false`, even for an EE installation.
#
# The `IS_GITLAB_EE` is always `string` or `nil`
# Thus the nil or empty string will result
# in using default value: true
#
# The behavior needs to be synchronised with
# config/helpers/is_ee_env.js
root.join('ee/app/models/license.rb').exist? &&
(ENV['IS_GITLAB_EE'].to_s.empty? || Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE']))
end
def self.ee
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册