21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/gitlab/qa/component/specs.rb', line 21
def perform
return Runtime::Logger.info("Skipping tests.") if skip_tests?
raise ArgumentError unless [suite, release].all?
@docker.login(**release.login_params) if release.login_params
@docker.pull(image: qa_image) unless Runtime::Env.skip_pull?
Runtime::Logger.info("Running test suite `#{suite}` for #{release.project_name}")
name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"
feature_flag_sets = []
while (index = args&.index { |x| x =~ /--.*-feature/ })
feature_flag_sets << args.slice!(index, 2)
end
feature_flag_sets << [] unless feature_flag_sets.any?
feature_flag_sets.each do |feature_flag_set|
@docker.run(image: qa_image, args: [suite, *args_with_flags(args, feature_flag_set)]) do |command|
command << "-t --rm --net=#{network || 'bridge'}"
unless hostname.nil?
command << "--hostname #{hostname}"
command.env('QA_HOSTNAME', hostname)
end
env.merge(Runtime::Env.variables).each do |key, value|
command.env(key, value)
end
command.volume('/var/run/docker.sock', '/var/run/docker.sock')
command.volume(File.join(Runtime::Env.host_artifacts_dir, name), File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'tmp'))
@volumes.to_h.each do |to, from|
command.volume(to, from)
end
command.name(name)
end
end
end
|