Sha256: a95bfd0bef701fbf32bf09e4694db18749909bd6f4d2776320658f1c3f04f5e3

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

# takelage docker image tag check module
module DockerImageTagCheckModule

  # 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"

    exit false unless configured? %w(docker_repo docker_image)

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

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

    cmd_docker_images = 'docker images --quiet ' +
        image

    stdout_str, stderr_str, status = run_and_check cmd_docker_images

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

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

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

    exit false unless configured? %w(docker_repo docker_image docker_tagsurl)

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

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

    tags = docker_image_tag_list_remote

    unless tags.include? tag
      log.debug "No remote docker image \"#{image}\" found"
      return false
    end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
takelage-0.4.5 lib/takelage/docker/image/tag/check/module.rb
takelage-0.4.4 lib/takelage/docker/image/tag/check/module.rb
takelage-0.4.3 lib/takelage/docker/image/tag/check/module.rb
takelage-0.4.2 lib/takelage/docker/image/tag/check/module.rb
takelage-0.4.1 lib/takelage/docker/image/tag/check/module.rb
takelage-0.4.0 lib/takelage/docker/image/tag/check/module.rb
takelage-0.3.0 lib/takelage/docker/image/tag/check/module.rb
takelage-0.2.1 lib/takelage/docker/image/tag/check/module.rb
takelage-0.2.0 lib/takelage/docker/image/tag/check/module.rb
takelage-0.1.5 lib/takelage/docker/image/tag/check/module.rb
takelage-0.1.4 lib/takelage/docker/image/tag/check/module.rb
takelage-0.1.3 lib/takelage/docker/image/tag/check/module.rb
takelage-0.1.2 lib/takelage/docker/image/tag/check/module.rb
takelage-0.1.1 lib/takelage/docker/image/tag/check/module.rb
takelage-0.1.0 lib/takelage/docker/image/tag/check/module.rb