Sha256: af25ef04b72e691a1c47a2beff813ddf62c88fd236ff2fa29786ffed0e60fe5e

Contents?: true

Size: 1.03 KB

Versions: 24

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

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

    return false unless docker_check_running

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

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

    return false unless _docker_image_check_local_image? image

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

  private

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

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

    true
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
takelage-0.22.2 lib/takelage/docker/image/tag/check/local.rb
takelage-0.22.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.22.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.21.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.21.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.20.2 lib/takelage/docker/image/tag/check/local.rb
takelage-0.20.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.20.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.19.2 lib/takelage/docker/image/tag/check/local.rb
takelage-0.19.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.19.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.18.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.18.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.17.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.17.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.16.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.15.1 lib/takelage/docker/image/tag/check/local.rb
takelage-0.15.0 lib/takelage/docker/image/tag/check/local.rb
takelage-0.14.5 lib/takelage/docker/image/tag/check/local.rb
takelage-0.14.4 lib/takelage/docker/image/tag/check/local.rb