Skip to content

Commit

Permalink
core: version-chooser: more data on error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani authored and patrickelectric committed Jan 23, 2023
1 parent 16b3cba commit b058534
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/services/versionchooser/utils/dockerhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ async def fetch_sha(self, metadata: TagMetadata) -> str:
"Accept": "application/vnd.docker.distribution.manifest.v2+json",
}
async with aiohttp.ClientSession() as session:
async with session.get(
f"{self.index_url}/v2/{metadata.repository}/manifests/{metadata.digest}", headers=header
) as resp:
url = f"{self.index_url}/v2/{metadata.repository}/manifests/{metadata.digest}"
async with session.get(url, headers=header) as resp:
if resp.status != 200:
warn(f"Error status {resp.status}")
raise Exception("Failed getting sha from DockerHub!")
raise Exception(f"Failed getting sha from DockerHub at {url} : {resp.status} : {await resp.text()}")
data = await resp.json(content_type=None)
return str(data["config"]["digest"])

Expand Down Expand Up @@ -115,6 +114,6 @@ async def fetch_remote_tags(self, repository: str, local_images: List[str]) -> T
tag.sha = await self.fetch_sha(tag)
except Exception as new_error:
if str(new_error) not in errors:
errors.append(str(new_error))
errors.append(str(f"Error fetching sha for {tag}: {new_error}"))
valid_images.append(tag)
return "\n".join(errors), valid_images

0 comments on commit b058534

Please sign in to comment.