Skip to content

Commit

Permalink
Leverage the dockerhub account for skopeo if set (#30)
Browse files Browse the repository at this point in the history
* Leverage the dockerhub account if they are set in env

skopeo directly pulls from docker.io which easily reaches
the anon pull rate limit.

Please see shared_database and observability failing because
of skopeo (whatever the use of private mirror or mirror.gcr.io):
https://github.com/cnti-testcatalog/testsuite/actions/runs/12674901774/job/35470396257?pr=2203
https://github.com/cnti-testcatalog/testsuite/actions/runs/12674901774/job/35470398665?pr=2203

Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Co-authored-by: Martin Matyas <martin.matyas@tietoevry.com>
  • Loading branch information
collivier and martin-mat authored Jan 15, 2025
1 parent 3f350cc commit ebfc47a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cluster_tools.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ebfc47a

Please sign in to comment.