Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/clioptions/imagesetup/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ func getArchitectures(image string, requiredArchs []string) ([]string, error) {
// and there isn't much else to go off of to tell if it's a manifest list or not.
if err != nil && strings.Contains(string(output), "the image is a manifest list") {
logrus.Debugf(" Image is a manifest list")
} else if err != nil && strings.Contains(string(output), "does not have the expected image configuration media type") {
logrus.Debugf(" Image is an artifact")
return nil, nil
Comment on lines +141 to +143
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Artifact path is not actually skipped by downstream logic.

At Line 143, returning (nil, nil) makes artifacts indistinguishable from the non-manifest-list path, so VerifyManifestLists still classifies them as problematic instead of skipping them. This conflicts with the stated PR behavior.

Proposed fix (preserve artifact intent via sentinel error)
diff --git a/pkg/clioptions/imagesetup/images.go b/pkg/clioptions/imagesetup/images.go
@@
 import (
+	"errors"
 	"fmt"
 	"os"
 	"os/exec"
 	"strings"
 	"time"
@@
 )
+
+var errImageArtifact = errors.New("image is an artifact")
@@
 	if err != nil && strings.Contains(string(output), "the image is a manifest list") {
 		logrus.Debugf("  Image is a manifest list")
 	} else if err != nil && strings.Contains(string(output), "does not have the expected image configuration media type") {
 		logrus.Debugf("  Image is an artifact")
-		return nil, nil
+		return nil, errImageArtifact
 	} else if err != nil {
 		return nil, fmt.Errorf("failed to check image %s: %w\nOutput: %s", image, err, string(output))
 	} else {
@@
-		availableArchs, err := getArchitectures(img, requiredArchs)
-		if err != nil {
+		availableArchs, err := getArchitectures(img, requiredArchs)
+		if err != nil {
+			if errors.Is(err, errImageArtifact) {
+				logrus.Debugf("  Image is an artifact, skipping")
+				skippedImages = append(skippedImages, img)
+				continue
+			}
 			return fmt.Errorf("failed to get image info for %s: %w", img, err)
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/clioptions/imagesetup/images.go` around lines 141 - 143, The current
branch in pkg/clioptions/imagesetup/images.go returns (nil, nil) for artifact
images which makes them indistinguishable from missing-manifest cases; change
this to return a sentinel error (e.g., declare var ErrImageIsArtifact =
errors.New("image is an artifact") in the package) and replace the current
return nil, nil with return nil, ErrImageIsArtifact in the branch that detects
"does not have the expected image configuration media type"; also update the
caller/consumer (e.g., VerifyManifestLists) to check for ErrImageIsArtifact and
explicitly skip processing when that sentinel is returned.

} else if err != nil {
return nil, fmt.Errorf("failed to check image %s: %w\nOutput: %s", image, err, string(output))
} else {
Expand Down