Class: Kuby::Docker::RemoteTags

Inherits:
Object
  • Object
show all
Defined in:
lib/kuby/docker/remote_tags.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote_client, image_url) ⇒ RemoteTags

T::Sig::WithoutRuntime.sig

params(
  remote_client: ::Docker::Remote::Client,
  image_url: String
)
.void



23
24
25
26
# File 'lib/kuby/docker/remote_tags.rb', line 23

def initialize(remote_client, image_url)
  @remote_client = remote_client
  @image_url = image_url
end

Instance Attribute Details

#image_urlObject (readonly)

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



14
15
16
# File 'lib/kuby/docker/remote_tags.rb', line 14

def image_url
  @image_url
end

#remote_clientObject (readonly)

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



11
12
13
# File 'lib/kuby/docker/remote_tags.rb', line 11

def remote_client
  @remote_client
end

Instance Method Details

#latest_tagsObject

T::Sig::WithoutRuntime.sig { returns(T::Array) }



37
38
39
40
# File 'lib/kuby/docker/remote_tags.rb', line 37

def latest_tags
  # not available for remote repos
  []
end

#tagsObject

T::Sig::WithoutRuntime.sig { returns(T::Array) }



29
30
31
32
33
34
# File 'lib/kuby/docker/remote_tags.rb', line 29

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

#timestamp_tagsObject

T::Sig::WithoutRuntime.sig { returns(T::Array) }



43
44
45
# File 'lib/kuby/docker/remote_tags.rb', line 43

def timestamp_tags
  tags.map { |t| TimestampTag.try_parse(t) }.compact
end