Skip to content

csv-generator: Populate name field in relatedImages entries#163

Merged
tiraboschi merged 1 commit intoopenshift-virtualization:mainfrom
nirdothan:fix-related-images
May 8, 2026
Merged

csv-generator: Populate name field in relatedImages entries#163
tiraboschi merged 1 commit intoopenshift-virtualization:mainfrom
nirdothan:fix-related-images

Conversation

@nirdothan
Copy link
Copy Markdown
Contributor

Summary

Fixes the relatedImages generation to populate both image and name fields, preventing empty name entries in the merged HCO CSV.

Problem

The buildRelatedImages() function introduced in #158 was creating RelatedImage entries with only the image field populated, leaving the name field empty:

relatedImages:
- image: registry.redhat.io/openshift4/ose-sriov-dp-admission-controller-rhel9@sha256:...

When the HCO bundle merge-manifests task combined all operator CSVs, this resulted in entries with name: "" in the final CSV, which is inconsistent with the expected HCO CSV format.

Solution

Updated buildRelatedImages() to set the Name field to the same value as the Image field for both the operator image and all additional images:

relatedImages:
- image: registry.redhat.io/openshift4/ose-sriov-dp-admission-controller-rhel9@sha256:...
  name: registry.redhat.io/openshift4/ose-sriov-dp-admission-controller-rhel9@sha256:...

This ensures consistency across all operator CSVs in the HCO bundle.

Changes

  • Modified buildRelatedImages() in cmd/csv-generator/main.go to populate the Name field
  • Updated all test cases in cmd/csv-generator/related_images_test.go to verify the correct behavior

Testing

All existing tests pass with the updated expectations.

$ go test ./cmd/csv-generator/... -v -run TestBuildRelatedImages
=== RUN   TestBuildRelatedImages
=== RUN   TestBuildRelatedImages/operator_image_only
=== RUN   TestBuildRelatedImages/operator_image_with_empty_additional_images_slice
=== RUN   TestBuildRelatedImages/operator_image_with_one_additional_image
=== RUN   TestBuildRelatedImages/operator_image_with_multiple_additional_images
--- PASS: TestBuildRelatedImages (0.00s)
PASS

The relatedImages section was generating entries with only the image
field populated, leaving the name field empty. This caused issues when
merging CSVs in the HCO bundle build pipeline, where entries appeared
with 'name: ""' in the final CSV.

The HCO CSV format expects both image and name fields to be set to
the same value for each relatedImages entry. This ensures consistency
across all operator CSVs and prevents empty name fields in the merged
output.

Assisted by: Claude Sonnet 4.5 <noreply@anthropic.com>

Signed-off-by: Nir Dothan <ndothan@redhat.com>
@nirdothan nirdothan force-pushed the fix-related-images branch from 0a738cc to 934707b Compare May 8, 2026 13:54
@nirdothan
Copy link
Copy Markdown
Contributor Author

/cc @tiraboschi

@tiraboschi tiraboschi merged commit 9069f5b into openshift-virtualization:main May 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants