- link_timestamp = link.properties.fetch("image_timestamp",
- "1900-01-01T00:00:01Z")
- if link_timestamp > latest_image_timestamp
- latest_image_link = link
- latest_image_timestamp = link_timestamp
- end
+ uuid_timestamps[link.head_uuid] =
+ [(-link.properties["image_timestamp"].to_datetime.to_i rescue 0),
+ -link.created_at.to_i]
+ end
+ uuid_timestamps.keys.sort_by { |uuid| uuid_timestamps[uuid] }
+ end
+
+ def self.for_latest_docker_image(search_term, search_tag=nil, readers=nil)
+ image_uuid = uuids_for_docker_image(search_term, search_tag, readers).last
+ if image_uuid.nil?
+ nil
+ else
+ find_by_uuid(image_uuid)