Sha256: ae23721dbd633bccb686a63af54552ac741917d6f28762650c3fe3a4667ad93d

Contents?: true

Size: 977 Bytes

Versions: 28

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

require "securerandom"

module Gitlab
  module QA
    module Component
      # Generic helper component running alpine linux image
      # Useful for populating volumes beforehand or running any other action that requires a running container
      # and has to be performed before main component containers are started
      #
      class Alpine < Base
        DOCKER_IMAGE = "alpine"
        DOCKER_IMAGE_TAG = "latest"

        def name
          @name ||= "alpine-#{SecureRandom.hex(4)}"
        end

        def start
          docker.run(image: image, tag: tag, args: ["tail", "-f", "/dev/null"]) do |command|
            command << "-d"
            command << "--name #{name}"

            volumes.each { |to, from| command.volume(to, from, 'Z') }
            environment.each { |key, value| command.env(key, value) }
          end
        end

        def prepare
          prepare_docker_container
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gitlab-qa-12.3.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.3.0.1 lib/gitlab/qa/component/alpine.rb
gitlab-qa-12.2.1 lib/gitlab/qa/component/alpine.rb
gitlab-qa-12.2.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-12.1.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-12.0.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-11.3.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-11.2.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-11.1.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-11.0.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.6.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.5.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.4.1 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.4.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.3.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.2.2 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.2.1 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.2.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.1.0 lib/gitlab/qa/component/alpine.rb
gitlab-qa-10.0.0 lib/gitlab/qa/component/alpine.rb