Commit f7c662c7 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'qa/gb/do-not-require-test-network-in-pipeline-tests' into 'master'

Do not attach runner to a non-exsiting network in QA

Closes gitlab-qa#180

See merge request gitlab-org/gitlab-ce!17028
parents 0862bff8 27a70018
...@@ -15,6 +15,14 @@ module QA ...@@ -15,6 +15,14 @@ module QA
@tags = %w[qa test] @tags = %w[qa test]
end end
def network
shell "docker network inspect #{@network}"
rescue CommandError
'bridge'
else
@network
end
def pull def pull
shell "docker pull #{@image}" shell "docker pull #{@image}"
end end
...@@ -22,7 +30,7 @@ module QA ...@@ -22,7 +30,7 @@ module QA
def register! def register!
shell <<~CMD.tr("\n", ' ') shell <<~CMD.tr("\n", ' ')
docker run -d --rm --entrypoint=/bin/sh docker run -d --rm --entrypoint=/bin/sh
--network #{@network} --name #{@name} --network #{network} --name #{@name}
-e CI_SERVER_URL=#{@address} -e CI_SERVER_URL=#{@address}
-e REGISTER_NON_INTERACTIVE=true -e REGISTER_NON_INTERACTIVE=true
-e REGISTRATION_TOKEN=#{@token} -e REGISTRATION_TOKEN=#{@token}
......
...@@ -3,6 +3,8 @@ require 'open3' ...@@ -3,6 +3,8 @@ require 'open3'
module QA module QA
module Service module Service
module Shellout module Shellout
CommandError = Class.new(StandardError)
## ##
# TODO, make it possible to use generic QA framework classes # TODO, make it possible to use generic QA framework classes
# as a library - gitlab-org/gitlab-qa#94 # as a library - gitlab-org/gitlab-qa#94
...@@ -14,7 +16,7 @@ module QA ...@@ -14,7 +16,7 @@ module QA
out.each { |line| puts line } out.each { |line| puts line }
if wait.value.exited? && wait.value.exitstatus.nonzero? if wait.value.exited? && wait.value.exitstatus.nonzero?
raise "Command `#{command}` failed!" raise CommandError, "Command `#{command}` failed!"
end end
end end
end end
......
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