Helper functions shortenImageDigest extracts and shortens image digest to 8 characters
(imageRef string)
| 700 | |
| 701 | // shortenImageDigest extracts and shortens image digest to 8 characters |
| 702 | func shortenImageDigest(imageRef string) string { |
| 703 | // Extract digest from image reference (format: registry/repo@sha256:digest) |
| 704 | parts := strings.Split(imageRef, "@") |
| 705 | if len(parts) < 2 { |
| 706 | // No digest, return first 8 chars of image ref |
| 707 | if len(imageRef) > 8 { |
| 708 | return "…" + imageRef[len(imageRef)-8:] |
| 709 | } |
| 710 | return imageRef |
| 711 | } |
| 712 | |
| 713 | digest := parts[1] |
| 714 | // Remove sha256: prefix if present |
| 715 | digest = strings.TrimPrefix(digest, "sha256:") |
| 716 | // Return first 8 characters |
| 717 | if len(digest) >= 8 { |
| 718 | return digest[:8] |
| 719 | } |
| 720 | return digest |
| 721 | } |
| 722 | |
| 723 | // extractFallbackReason extracts the reason for fallback from ValidationResult |
| 724 | // Prefers structured ReasonCode field, falls back to message parsing for backward compatibility |
no outgoing calls