summaryrefslogtreecommitdiff
path: root/qa/qa/runtime
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-09 12:18:55 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-09 12:18:55 +0100
commit5becdf01941e3a471def26dd82282784c58b5590 (patch)
treeb4453e5eb7465918447ac05aadec288fcb9c8fbf /qa/qa/runtime
parent2ae578c6b11bcd06b0c6dc6827e01de09f2747cc (diff)
downloadgitlab-ce-5becdf01941e3a471def26dd82282784c58b5590.tar.gz
Implement GitLab QA release inflection strategy
Diffstat (limited to 'qa/qa/runtime')
-rw-r--r--qa/qa/runtime/release.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/qa/qa/runtime/release.rb b/qa/qa/runtime/release.rb
new file mode 100644
index 00000000000..d64b478a41a
--- /dev/null
+++ b/qa/qa/runtime/release.rb
@@ -0,0 +1,45 @@
+module QA
+ module Runtime
+ ##
+ # Class that is responsible for plugging CE/EE extensions in, depending on
+ # environment variable GITLAB_RELEASE that should be present in the runtime
+ # environment.
+ #
+ # We need that to reduce the probability of conflicts when merging
+ # CE to EE.
+ #
+ class Release
+ UnspecifiedReleaseError = Class.new(StandardError)
+
+ def initialize(version = ENV['GITLAB_RELEASE'])
+ @version = version.to_s.upcase
+
+ unless %w[CE EE].include?(@version)
+ raise UnspecifiedReleaseError, 'GITLAB_RELEASE env not defined!'
+ end
+
+ begin
+ require "#{version.downcase}/strategy"
+ rescue LoadError
+ # noop
+ end
+ end
+
+ def has_strategy?
+ QA.const_defined?("#{@version}::Strategy")
+ end
+
+ def strategy
+ QA.const_get("#{@version}::Strategy")
+ end
+
+ def self.method_missing(name, *args)
+ @release ||= self.new
+
+ if @release.has_strategy?
+ @release.strategy.public_send(name, *args)
+ end
+ end
+ end
+ end
+end