Sha256: cd4a81b88de2f84ac99b73c1cc279421162a1034130a1e4d3bdf6ffce8703240

Contents?: true

Size: 1.15 KB

Versions: 35

Compression:

Stored size: 1.15 KB

Contents

require 'securerandom'

module Gitlab
  module QA
    module Component
      ##
      # This class represents GitLab QA specs image that is implemented in
      # the `qa/` directory located in GitLab CE / EE repositories.
      #
      class Specs < Scenario::Template
        attr_accessor :suite, :release, :network, :args

        def initialize
          @docker = Docker::Engine.new
        end

        def perform # rubocop:disable Metrics/AbcSize
          raise ArgumentError unless [suite, release].all?

          puts "Running test suite `#{suite}` for #{release.project_name}"

          name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"

          @docker.run(release.qa_image, release.qa_tag, suite, *args) do |command|
            command << "-t --rm --net=#{network || 'bridge'}"

            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), '/home/qa/tmp')

            command.name(name)
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
gitlab-qa-4.2.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.1.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.0.5 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.0.4 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.0.3 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.0.2 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.0.1 lib/gitlab/qa/component/specs.rb
gitlab-qa-4.0.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.3.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.2.3 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.2.2 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.2.1 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.2.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.1.1 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.1.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-3.0.1 lib/gitlab/qa/component/specs.rb
gitlab-qa-2.13.1 lib/gitlab/qa/component/specs.rb
gitlab-qa-2.13.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-2.12.0 lib/gitlab/qa/component/specs.rb
gitlab-qa-2.11.0 lib/gitlab/qa/component/specs.rb