Skip to content

NO-ISSUE: Improve osimagestream pkg API#6271

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
pablintino:improve-osimagestream-interfaces
Jul 8, 2026
Merged

NO-ISSUE: Improve osimagestream pkg API#6271
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
pablintino:improve-osimagestream-interfaces

Conversation

@pablintino

@pablintino pablintino commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

- What I did

This change makes some changes to the internal osimagestream package to extract some common sources logic into a separated entity with shared behavior.

- How to verify it

Simple internal change that should be good with just regular CI e2e's passing.

- Description for the changelog

This change makes some changes to the internal osimagestream package to extract some common sources logic into a separated entity with shared behavior.

Summary by CodeRabbit

  • New Features
    • Improved OS image stream discovery across multiple image sources, including better handling of partial or missing image data.
  • Bug Fixes
    • Skips invalid or incomplete images instead of failing the entire stream lookup.
    • Preserves successful results when some image checks encounter errors.
    • Keeps empty inputs from producing unexpected results.
  • Refactor
    • Stream fetching now uses a shared discovery path, making behavior more consistent across different source types.

This change makes some changes to the internal osimagestream package to
extract some common sources logic into a separated entity with shared
behavior.

Signed-off-by: Pablo Rodriguez Nava <git@amail.pablintino.eu>
@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: LGTM 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 Jul 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

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

Details

In response to this:

- What I did

This change makes some changes to the internal osimagestream package to extract some common sources logic into a separated entity with shared behavior.

- How to verify it

Simple internal change that should be good with just regular CI e2e's passing.

- Description for the changelog

This change makes some changes to the internal osimagestream package to extract some common sources logic into a separated entity with shared behavior.

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.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

Walkthrough

This PR introduces a new StreamDiscoverer type in pkg/osimagestream that centralizes image inspection, label extraction, and grouping into OS image stream sets. ImageStreamStreamSource, OSImagesURLStreamSource, and the factory (DefaultStreamSourceFactory.Create) are refactored to delegate to this shared discoverer instead of performing inline inspection/extraction logic. Corresponding tests are updated and some redundant test cases removed.

Changes

StreamDiscoverer Extraction

Layer / File(s) Summary
StreamDiscoverer type and Discover logic
pkg/osimagestream/discoverer.go, pkg/osimagestream/discoverer_test.go
New StreamDiscoverer struct with NewStreamDiscoverer constructor and Discover method that inspects images, extracts labels, skips failures/missing labels, and groups results into []*mcfgv1.OSImageStreamSet; table-driven tests cover empty input, global errors, per-image skips, and multi-stream grouping.
ImageStreamStreamSource delegation
pkg/osimagestream/imagestream_source.go, pkg/osimagestream/imagestream_source_test.go
ImageStreamStreamSource now holds a *StreamDiscoverer instead of separate inspector/extractor fields; FetchStreams reads the ImageStream, filters tag digests, and calls discoverer.Discover; tests updated to wire NewStreamDiscoverer and remove obsolete inspector-error cases.
OSImagesURLStreamSource delegation
pkg/osimagestream/urls_source.go, pkg/osimagestream/urls_source_test.go
OSImagesURLStreamSource now holds a *StreamDiscoverer; FetchStreams fetches URLs and delegates to discoverer.Discover; tests updated to use NewStreamDiscoverer, with three obsolete inspector-error test functions removed.
Factory wiring
pkg/osimagestream/osimagestream.go
DefaultStreamSourceFactory.Create builds a shared discoverer and passes it into both NewOSImagesURLStreamSource and NewImageStreamStreamSource calls.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Factory as DefaultStreamSourceFactory
  participant Source as StreamSource
  participant Discoverer as StreamDiscoverer
  participant Inspector as ImagesInspector
  participant Extractor as ImageDataExtractor

  Factory->>Discoverer: NewStreamDiscoverer(imagesInspector, imagesExtractor)
  Factory->>Source: NewImageStreamStreamSource/NewOSImagesURLStreamSource(discoverer, provider)
  Source->>Source: FetchStreams(ctx)
  Source->>Discoverer: Discover(ctx, images)
  Discoverer->>Inspector: Inspect(images)
  Inspector-->>Discoverer: results, error
  Discoverer->>Extractor: extract labels per image
  Extractor-->>Discoverer: image metadata
  Discoverer-->>Source: []OSImageStreamSet, error
  Source-->>Factory: []OSImageStreamSet, error
Loading

Compact metadata:

  • Related issues: None specified
  • Related PRs: None specified
  • Suggested labels: refactor, testing
  • Suggested reviewers: None specified

🐰 A discoverer hops through images with care,
Pulling labels and streams from the air,
Old inspectors retired, their duties now shared,
One tidy path where three used to be paired.

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

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 6, 2026

@isabella-janssen isabella-janssen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

Clear cleanup & tests look to be passing

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2026
@openshift-ci

openshift-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: isabella-janssen, pablintino

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [isabella-janssen,pablintino]

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

@pablintino

Copy link
Copy Markdown
Contributor Author

/pipeline required

@pablintino

Copy link
Copy Markdown
Contributor Author

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 7, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@pablintino: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

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-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 5dbdd0a and 2 for PR HEAD e3dfc3c in total

@pablintino

Copy link
Copy Markdown
Contributor Author

/test e2e-hypershift

@pablintino

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci

openshift-ci Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@pablintino: all tests passed!

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.

@openshift-merge-bot openshift-merge-bot Bot merged commit f2f78c2 into openshift:main Jul 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants