Skip to content

Commit

Permalink
Improve remote image comparison logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nusantara-self committed Feb 6, 2024
1 parent 1a31f4a commit 1778cdd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dockerhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ def get_remote_image_id(self, namespace, image, tag):
)

metadata = json.loads(resp.content.decode("utf-8"))
try:
print(f"DEBUG: remote image last pushed: {metadata['images'][0]['last-pushed']}")
print(f"DEBUG: remote image status: {metadata['images'][0]['status']}")
print(f"DEBUG: repository tag status: {metadata['status']}")
print(f"DEBUG: repository tag last updated: {metadata['last_updated']}")
print(f"DEBUG: repository tag last pushed: {metadata['tag_last_pushed']}")
except KeyError as e:
print(f"KeyError encountered while accessing metadata: {e}")
except IndexError as e:
print(f"IndexError encountered while accessing metadata: {e}")
return metadata["images"][0]["digest"]
except Exception as e:
print("Can't get remote image id: {}".format(e))
Expand Down
4 changes: 4 additions & 0 deletions registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,8 @@ def correctly_pushed(self, namespace, repo, tag):
remote_id = self.get_remote_image_id(namespace, repo, tag)
if remote_id is None:
return True
try:
print(f"DEBUG: Comparing local_id and remote_id, local_id: {local_id}, remote_id: {remote_id}")
except NameError as e:
print(f"Error: {e}. Ensure 'local_id' and 'remote_id' are defined before comparing.")
return local_id == remote_id

0 comments on commit 1778cdd

Please sign in to comment.