Welcome to mirror list, hosted at ThFree Co, Russian Federation.

jenkins.rb « docker_run « service « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 00b632824845e3cf6fa1ddd3485ffd64c37185ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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