Sha256: bbdb2c23aeaa91043280f4b68279c07c76c2338172ff1206fefeb4d525df903d

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

# typed: strict

require 'docker/remote'

module Kuby
  module Docker
    class RemoteTags
      # extend T::Sig

      # T::Sig::WithoutRuntime.sig { returns(::Docker::Remote::Client) }
      attr_reader :remote_client

      # T::Sig::WithoutRuntime.sig { returns(String) }
      attr_reader :image_url

      # T::Sig::WithoutRuntime.sig {
      #   params(
      #     remote_client: ::Docker::Remote::Client,
      #     image_url: String
      #   )
      #   .void
      # }
      def initialize(remote_client, image_url)
        @remote_client = remote_client
        @image_url = image_url
      end

      # T::Sig::WithoutRuntime.sig { returns(T::Array[String]) }
      def tags
        remote_client.tags || []
      rescue ::Docker::Remote::UnknownRepoError, ::Docker::Remote::UnauthorizedError, ::Docker::Remote::TooManyRetriesError
        # these can happen if we've never pushed to the repo before
        []
      end

      # T::Sig::WithoutRuntime.sig { returns(T::Array[String]) }
      def latest_tags
        # not available for remote repos
        []
      end

      # T::Sig::WithoutRuntime.sig { returns(T::Array[Kuby::Docker::TimestampTag]) }
      def timestamp_tags
        tags.map { |t| TimestampTag.try_parse(t) }.compact
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.20.2 lib/kuby/docker/remote_tags.rb
kuby-core-0.20.1 lib/kuby/docker/remote_tags.rb
kuby-core-0.20.0 lib/kuby/docker/remote_tags.rb
kuby-core-0.19.0 lib/kuby/docker/remote_tags.rb
kuby-core-0.18.0 lib/kuby/docker/remote_tags.rb