Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /lib/container_registry
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'lib/container_registry')
-rw-r--r--lib/container_registry/client.rb9
-rw-r--r--lib/container_registry/tag.rb4
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/container_registry/client.rb b/lib/container_registry/client.rb
index cc692140301..46399224a5d 100644
--- a/lib/container_registry/client.rb
+++ b/lib/container_registry/client.rb
@@ -51,6 +51,15 @@ module ContainerRegistry
client.supports_tag_delete?
end
+ def self.registry_info
+ registry_config = Gitlab.config.registry
+ return unless registry_config.enabled && registry_config.api_url.present?
+
+ token = Auth::ContainerRegistryAuthenticationService.access_token([], [])
+ client = new(registry_config.api_url, token: token)
+ client.registry_info
+ end
+
def initialize(base_uri, options = {})
@base_uri = base_uri
@options = options
diff --git a/lib/container_registry/tag.rb b/lib/container_registry/tag.rb
index 614b1b5e6c6..2a32f950457 100644
--- a/lib/container_registry/tag.rb
+++ b/lib/container_registry/tag.rb
@@ -5,6 +5,7 @@ module ContainerRegistry
include Gitlab::Utils::StrongMemoize
attr_reader :repository, :name
+ attr_writer :created_at
delegate :registry, :client, to: :repository
delegate :revision, :short_revision, to: :config_blob, allow_nil: true
@@ -73,9 +74,10 @@ module ContainerRegistry
end
def created_at
+ return @created_at if @created_at
return unless config
- strong_memoize(:created_at) do
+ strong_memoize(:memoized_created_at) do
DateTime.rfc3339(config['created'])
rescue ArgumentError
nil