summaryrefslogtreecommitdiff
path: root/qa/qa/service
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-29 12:06:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-29 12:06:40 +0000
commitd64e3a8b281d355c7d51d04df52fab407b8cc76d (patch)
tree282d6cc62eacd3fb4a0f6841ae52ae4a709e303f /qa/qa/service
parent833eadad8cac85b99871842854c9a676a607e2da (diff)
downloadgitlab-ce-d64e3a8b281d355c7d51d04df52fab407b8cc76d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/qa/service')
-rw-r--r--qa/qa/service/docker_run/jenkins.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/qa/qa/service/docker_run/jenkins.rb b/qa/qa/service/docker_run/jenkins.rb
new file mode 100644
index 00000000000..00b63282484
--- /dev/null
+++ b/qa/qa/service/docker_run/jenkins.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+module QA
+ module Service
+ module DockerRun
+ class Jenkins < Base
+ def initialize
+ @image = 'registry.gitlab.com/gitlab-org/gitlab-qa/jenkins-gitlab:version1'
+ @name = 'jenkins-server'
+ @port = '8080'
+ super()
+ end
+
+ def host_address
+ "http://#{host_name}:#{@port}"
+ end
+
+ def host_name
+ return 'localhost' unless QA::Runtime::Env.running_in_ci?
+
+ super
+ end
+
+ def register!
+ command = <<~CMD.tr("\n", ' ')
+ docker run -d --rm
+ --network #{network}
+ --hostname #{host_name}
+ --name #{@name}
+ --env JENKINS_HOME=jenkins_home
+ --publish #{@port}:8080
+ --publish 50000:50000
+ #{@image}
+ CMD
+
+ command.gsub!("--network #{network} ", '') unless QA::Runtime::Env.running_in_ci?
+
+ shell command
+ end
+ end
+ end
+ end
+end