Sha256: 53ce7665b300924d2650a5186c7ee21e6e9e5c3cabb4e3483e0bca150e3c44a1

Contents?: true

Size: 972 Bytes

Versions: 9

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

# takelage docker image tag check
module DockerImageTagCheck
  # Backend method for docker image tag check.
  # @return [Boolean] does docker image tag exist?
  def docker_image_tag_check(tag)
    log.debug "Check if docker image tag \"#{tag}\" exists"

    return false unless docker_check_daemon

    if tag.to_s.strip.empty?
      log.warn 'No docker image tag specified'
      return false
    end

    image = "#{@docker_user}/#{@docker_repo}:#{tag}"

    return false unless _docker_image_check_image? image

    log.debug "Found docker image \"#{image}\""
    true
  end

  private

  # Check if image exists.
  def _docker_image_check_image?(image)
    cmd_docker_images =
      format(
        config.active['cmd_docker_image_tag_check_docker_images'],
        image: image
      )

    if (run cmd_docker_images).to_s.strip.empty?
      log.debug "No docker image \"#{image}\" found"
      return false
    end

    true
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
takelage-0.26.4 lib/takelage/docker/image/tag/check.rb
takelage-0.26.3 lib/takelage/docker/image/tag/check.rb
takelage-0.26.2 lib/takelage/docker/image/tag/check.rb
takelage-0.25.10 lib/takelage/docker/image/tag/check.rb
takelage-0.25.8 lib/takelage/docker/image/tag/check.rb
takelage-0.24.0 lib/takelage/docker/image/tag/check.rb
takelage-0.23.3 lib/takelage/docker/image/tag/check.rb
takelage-0.23.2 lib/takelage/docker/image/tag/check.rb
takelage-0.23.1 lib/takelage/docker/image/tag/check.rb