Skip to content

MGMT-24783: Allow getting OS Images by RHCOS version#965

Open
giladravid16 wants to merge 1 commit into
openshift:mainfrom
giladravid16:MGMT-24783
Open

MGMT-24783: Allow getting OS Images by RHCOS version#965
giladravid16 wants to merge 1 commit into
openshift:mainfrom
giladravid16:MGMT-24783

Conversation

@giladravid16

@giladravid16 giladravid16 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

We're still going to allow getting OS Images by openshift version, but we want to also allow and prioritize getting them by RHCOS version.
We also don't want to keep in our storage multiple ISOs that are identical which happen when different openshift versions use the same RHCOS version, so we're going to dedup them before populating the image store.

How was this code tested?

Manually installed clusters with both full and minimal ISOs.
I had 2 openshift versions with the same RHCOS version, I could get the ISO for both of them and the storage directory only had a single copy.

Assignees

/cc @
/cc @

Links

Closes MGMT-24783

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

Summary by CodeRabbit

  • Bug Fixes
    • Improved ISO generation by deduplicating configured entries per version and architecture, reducing conflicting downloads and inconsistent results.
    • Standardized ISO, cache, and nmstatectl naming to align download, validation, and cleanup behavior.
    • Enhanced cache/path resolution for more reliable retrieval of required artifacts.
  • New Features
    • Minimal ISO creation now uses a streamlined version lookup flow, supporting both version and effective OpenShift version matching.
    • Path resolution improved to correctly handle version/architecture inputs for consistent processing.

@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 8, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 8, 2026

Copy link
Copy Markdown

@giladravid16: This pull request references MGMT-24783 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Description

We're still going to allow getting OS Images by openshift version, but we want to also allow and prioritize getting them by RHCOS version.
We also don't want to keep in our storage multiple ISOs that are identical which happen when different openshift versions use the same RHCOS version, so we're going to dedup them before populating the image store.

How was this code tested?

Manually installed clusters with both full and minimal ISOs.
I had 2 openshift versions with the same RHCOS version, I could get the ISO for both of them and the storage directory only had a single copy.

Assignees

/cc @
/cc @

Links

Closes MGMT-24783

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 8, 2026
@openshift-ci
openshift-ci Bot requested review from omer-vishlitzky and tsorya July 8, 2026 11:14
@openshift-ci

openshift-ci Bot commented Jul 8, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giladravid16

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:

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

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 1ec44eff-cafa-48e2-844c-7a01593cf703

📥 Commits

Reviewing files that changed from the base of the PR and between 14afea8 and ec9c364.

📒 Files selected for processing (2)
  • pkg/imagestore/imagestore.go
  • pkg/imagestore/imagestore_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/imagestore/imagestore.go
  • pkg/imagestore/imagestore_test.go

Walkthrough

Populate now deduplicates RHCOS entries per (version, cpu_architecture) before downloading and building minimal ISOs. ISO and nmstatectl paths use RHCOS-version-based naming, with updated lookup, cleanup, and test coverage.

Changes

RHCOS image storage

Layer / File(s) Summary
Populate deduplication and ISO generation
pkg/imagestore/imagestore.go, pkg/imagestore/imagestore_test.go
Deduplicates configured entries, downloads one ISO per RHCOS version and architecture, and creates minimal ISOs from the selected entries.
Version-based path resolution and cleanup
pkg/imagestore/imagestore.go, pkg/imagestore/imagestore_test.go
Updates ISO and nmstatectl naming, version lookup, cache paths, availability checks, cleanup, and related tests to use RHCOS versions.

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

Sequence Diagram(s)

sequenceDiagram
  participant Populate
  participant deduplicateVersions
  participant ISODownloader
  participant extractAndCacheNmstatectl
  Populate->>deduplicateVersions: configured RHCOS entries
  deduplicateVersions-->>Populate: selected entries
  Populate->>ISODownloader: download and validate full ISO
  Populate->>extractAndCacheNmstatectl: selected imageInfo
  extractAndCacheNmstatectl-->>Populate: cached nmstatectl
Loading

Suggested reviewers: carbonin, omer-vishlitzky, tsorya

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: adding RHCOS-version-based OS image retrieval.
Description check ✅ Passed The description follows the template and covers the change, testing, links, assignees placeholders, and checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Added/changed Ginkgo titles are static strings; no timestamps, UUIDs, names, or formatted dynamic values appear in the test names.
Test Structure And Quality ✅ Passed Added Ginkgo tests use BeforeEach/AfterEach, clean temp dirs and ghttp servers, and add no cluster waits or shared-resource leaks in the changed blocks.
Microshift Test Compatibility ✅ Passed Changed Ginkgo tests are unit-style pkg/imagestore tests and contain no unsupported OpenShift APIs, namespaces, or MicroShift-only assumptions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The PR only updates pkg/imagestore unit tests; I found no SNO/multi-node assumptions, topology checks, node scheduling, or cluster-scaling behavior.
Topology-Aware Scheduling Compatibility ✅ Passed Only pkg/imagestore path/dedup logic and tests changed; no manifests, controllers, affinity/selectors, or topology-dependent replica logic were introduced.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes were added; main.go and suite setup lack fmt.Print* or stdout logger redirects, and imagestore changes only use logrus.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only pkg/imagestore unit tests changed; they use local ghttp servers and file paths, with no IPv4-only literals or public-internet dependencies.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or constant-time secret comparisons were added; changes are path/version handling only.
Container-Privileges ✅ Passed PR only changes pkg/imagestore Go code/tests; no container/K8s manifests were changed and no privileged/securityContext settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The PR removes openshift_version from log messages and adds only version/arch logs; no passwords, tokens, PII, or similar sensitive data are introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/imagestore/imagestore_test.go`:
- Around line 779-783: The test for deduplicateVersions is flaky because it
assumes a stable map-iteration order and checks dedupedVersions[0] directly.
Update the assertions in imagestore_test.go to locate the expected entry by its
(version, arch) key from deduplicateVersions’ result instead of relying on index
0, and include a failure message so the test clearly reports when the expected
version/arch entry is missing or incorrect.

In `@pkg/imagestore/imagestore.go`:
- Around line 392-429: The deduplicateVersions helper returns results in
non-deterministic order because it ranges over map m, so the flaky index-based
assertion should be fixed in the unit test instead of changing the helper.
Update the deduplicateVersions test to avoid depending on dedupedVersions[0] and
instead verify the expected entries by matching version and cpu_architecture,
keeping the existing Populate behavior unchanged.
🪄 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: Enterprise

Run ID: f592832b-777d-4d71-bcbc-3002164340d5

📥 Commits

Reviewing files that changed from the base of the PR and between c0314a2 and 14afea8.

📒 Files selected for processing (2)
  • pkg/imagestore/imagestore.go
  • pkg/imagestore/imagestore_test.go

Comment thread pkg/imagestore/imagestore_test.go
Comment thread pkg/imagestore/imagestore.go
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.17647% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.35%. Comparing base (a52ca33) to head (ec9c364).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
pkg/imagestore/imagestore.go 81.17% 13 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #965      +/-   ##
==========================================
+ Coverage   62.13%   62.35%   +0.22%     
==========================================
  Files          27       27              
  Lines        1793     1833      +40     
==========================================
+ Hits         1114     1143      +29     
- Misses        512      521       +9     
- Partials      167      169       +2     
Files with missing lines Coverage Δ
pkg/imagestore/imagestore.go 74.68% <81.17%> (-0.32%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@giladravid16

Copy link
Copy Markdown
Contributor Author

/retest-required

@giladravid16

Copy link
Copy Markdown
Contributor Author

/retest-required

@giladravid16

Copy link
Copy Markdown
Contributor Author

/cc @carbonin

@openshift-ci
openshift-ci Bot requested a review from carbonin July 16, 2026 16:37
@gamli75

gamli75 commented Jul 19, 2026

Copy link
Copy Markdown

@danielerez please review

Comment thread pkg/imagestore/imagestore_test.go Outdated
We're still going to allow getting OS Images by openshift version, but we want to also allow and prioritize getting them by RHCOS version.
We also don't want to keep in our storage multiple ISOs that are identical which happen when different openshift versions use the same RHCOS version, so we're going to dedup them before populating the image store.
@openshift-ci

openshift-ci Bot commented Jul 19, 2026

Copy link
Copy Markdown

@giladravid16: 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.

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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants