composable-data-stack 0.8.0__py3-none-any.whl → 0.9.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cli/image_verification.py CHANGED
@@ -280,13 +280,14 @@ def _fixture_entry(
280
280
  fixture: dict[str, Any] | None,
281
281
  image_ref: str,
282
282
  ) -> dict[str, Any] | None:
283
- """Return the fixture entry whose repository matches image_ref, if any."""
283
+ """Return the repository entry matching image_ref, preferring its digest."""
284
284
  if fixture is None:
285
285
  return None
286
286
  images = fixture.get("images", {})
287
287
  if not isinstance(images, dict):
288
288
  return None
289
289
  folded_image_ref = image_ref.casefold()
290
+ matches: list[dict[str, Any]] = []
290
291
  for entry in images.values():
291
292
  if not isinstance(entry, dict):
292
293
  continue
@@ -297,8 +298,16 @@ def _fixture_entry(
297
298
  if folded_image_ref == folded_repository or folded_image_ref.startswith(
298
299
  (folded_repository + "@", folded_repository + ":")
299
300
  ):
300
- return entry
301
- return None
301
+ matches.append(entry)
302
+ if not matches:
303
+ return None
304
+ if "@sha256:" in folded_image_ref:
305
+ ref_digest = folded_image_ref.rsplit("@", 1)[1]
306
+ for entry in matches:
307
+ digest = entry.get("digest")
308
+ if isinstance(digest, str) and digest.casefold() == ref_digest:
309
+ return entry
310
+ return matches[0]
302
311
 
303
312
 
304
313
  def _verification_findings(