diff --git a/cluster_tools.cr b/cluster_tools.cr index 356ea38b..c6b26f42 100644 --- a/cluster_tools.cr +++ b/cluster_tools.cr @@ -249,7 +249,14 @@ module ClusterTools def self.official_content_digest_by_image_name(image_name) Log.info { "official_content_digest_by_image_name: #{image_name}"} - result = exec("skopeo inspect docker://#{image_name}") + if ENV["DOCKERHUB_USERNAME"]? && ENV["DOCKERHUB_PASSWORD"]? + Log.info { "Using USERNAME and PASSWORD for accessing the registry via skopeo" } + registry_creds = "--creds #{ENV["DOCKERHUB_USERNAME"]}:#{ENV["DOCKERHUB_PASSWORD"]}" + else + Log.info { "Access the registry anonymously via skopeo" } + registry_creds = "" + end + result = exec("skopeo inspect #{registry_creds} docker://#{image_name}") response = result[:output] if result[:status].success? && !response.empty? return JSON.parse(response)