Skip to content

NO-JIRA: Handle unexpected image configuration media type in getArchitectures#31039

Open
bitoku wants to merge 1 commit intoopenshift:mainfrom
bitoku:fix-image-config-media-type-check
Open

NO-JIRA: Handle unexpected image configuration media type in getArchitectures#31039
bitoku wants to merge 1 commit intoopenshift:mainfrom
bitoku:fix-image-config-media-type-check

Conversation

@bitoku
Copy link
Copy Markdown
Contributor

@bitoku bitoku commented Apr 20, 2026

Skip images that don't have the expected image configuration media type instead of treating them as errors, since they are artifacts rather than runnable container images.

Assisted-by: Claude Code https://claude.com/claude-code

Summary by CodeRabbit

  • Bug Fixes
    • Improved image artifact detection to correctly identify artifact-type images, reducing false error messages and enhancing the accuracy of image validation diagnostics.

Skip images that don't have the expected image configuration media type
instead of treating them as errors, since they are artifacts rather than
runnable container images.

Assisted-by: Claude Code <https://claude.com/claude-code>
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 20, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@bitoku: This pull request explicitly references no jira issue.

Details

In response to this:

Skip images that don't have the expected image configuration media type instead of treating them as errors, since they are artifacts rather than runnable container images.

Assisted-by: Claude Code https://claude.com/claude-code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Walkthrough

The getArchitectures function in images.go now specifically detects a particular oc image info failure indicating the image lacks expected image configuration media type, treating it as an artifact indicator. When detected, it logs the artifact status and returns nil values instead of a formatted error.

Changes

Cohort / File(s) Summary
Error handling for artifact detection
pkg/clioptions/imagesetup/images.go
Added conditional logic to detect when oc image info fails with "does not have the expected image configuration media type" message, treating this as an artifact indicator by logging "Image is an artifact" and returning (nil, nil) instead of propagating the error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Stable And Deterministic Test Names ✅ Passed The pull request modifies only utility code in pkg/clioptions/imagesetup/images.go, not any Ginkgo test files or test patterns.
Test Structure And Quality ✅ Passed The pull request modifies only production code in pkg/clioptions/imagesetup/images.go and contains no Ginkgo test files or test code changes.
Microshift Test Compatibility ✅ Passed This pull request does not add any new Ginkgo e2e tests. The only file modified is pkg/clioptions/imagesetup/images.go, a utility package with no Ginkgo test patterns.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This pull request does not add any new Ginkgo e2e tests. Changes are exclusively to utility function getArchitectures in pkg/clioptions/imagesetup/images.go for image artifact detection. No test files are modified and no Ginkgo test declarations are present.
Topology-Aware Scheduling Compatibility ✅ Passed The modified file is a test utility for image metadata verification with no deployment manifests, operator code, or scheduling-related code.
Ote Binary Stdout Contract ✅ Passed The PR adds only a logrus.Debugf() call within a utility function, which is not process-level code. Logrus defaults to stderr, not stdout, so the OTE Binary Stdout Contract is not violated.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR modifies utility helper function getArchitectures in imagesetup package, not a test definition. No new Ginkgo e2e test blocks found.
Title check ✅ Passed The title accurately describes the main change: handling an unexpected image configuration media type in the getArchitectures function.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from p0lyn0mial and sjenning April 20, 2026 12:54
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 20, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bitoku
Once this PR has been reviewed and has the lgtm label, please assign neisw for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/clioptions/imagesetup/images.go`:
- Around line 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ed461195-7523-4380-8c3d-e5ed391b5a63

📥 Commits

Reviewing files that changed from the base of the PR and between ff48d7a and f79107d.

📒 Files selected for processing (1)
  • pkg/clioptions/imagesetup/images.go

Comment on lines +141 to +143
} 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
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.

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 20, 2026

@bitoku: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-serial-2of2 f79107d link true /test e2e-aws-ovn-serial-2of2
ci/prow/e2e-vsphere-ovn-upi f79107d link true /test e2e-vsphere-ovn-upi
ci/prow/e2e-gcp-ovn f79107d link true /test e2e-gcp-ovn
ci/prow/e2e-metal-ipi-ovn-ipv6 f79107d link true /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-vsphere-ovn f79107d link true /test e2e-vsphere-ovn
ci/prow/e2e-aws-ovn-serial-1of2 f79107d link true /test e2e-aws-ovn-serial-1of2
ci/prow/e2e-gcp-csi f79107d link true /test e2e-gcp-csi
ci/prow/e2e-gcp-ovn-upgrade f79107d link true /test e2e-gcp-ovn-upgrade

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@bitoku bitoku changed the title WIP: NO-JIRA: Handle unexpected image configuration media type in getArchitectures NO-JIRA: Handle unexpected image configuration media type in getArchitectures Apr 21, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants