Commit b3093afd authored by Sean McGivern's avatar Sean McGivern

Merge branch 'zj-ancestor-gitaly-is-ok-for-test' into 'master'

Testing: Allow newer components for local tests

See merge request gitlab-org/gitlab!46445
parents 3c407657 f70beeb8
...@@ -517,6 +517,8 @@ module TestEnv ...@@ -517,6 +517,8 @@ module TestEnv
return false if component_matches_git_sha?(component_folder, expected_version) return false if component_matches_git_sha?(component_folder, expected_version)
return false if component_ahead_of_target?(component_folder, expected_version)
version = File.read(File.join(component_folder, 'VERSION')).strip version = File.read(File.join(component_folder, 'VERSION')).strip
# Notice that this will always yield true when using branch versions # Notice that this will always yield true when using branch versions
...@@ -527,6 +529,20 @@ module TestEnv ...@@ -527,6 +529,20 @@ module TestEnv
true true
end end
def component_ahead_of_target?(component_folder, expected_version)
# The HEAD of the component_folder will be used as heuristic for the version
# of the binaries, allowing to use Git to determine if HEAD is later than
# the expected version. Note: Git considers HEAD to be an anchestor of HEAD.
_out, exit_status = Gitlab::Popen.popen(%W[
#{Gitlab.config.git.bin_path}
-C #{component_folder}
merge-base --is-ancestor
#{expected_version} HEAD
])
exit_status == 0
end
def component_matches_git_sha?(component_folder, expected_version) def component_matches_git_sha?(component_folder, expected_version)
# Not a git SHA, so return early # Not a git SHA, so return early
return false unless expected_version =~ ::Gitlab::Git::COMMIT_ID return false unless expected_version =~ ::Gitlab::Git::COMMIT_ID
......
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