Skip to content

Conversation

@vfreex
Copy link
Contributor

@vfreex vfreex commented Dec 24, 2025

This change eliminates direct access to old-style repo configurations (group_config.repos or group_config['repos']) by using runtime.repos which handles both old-style and new-style repo configs.

Changes:

  • Add to_dict() method to Repo class to export configuration as dict
  • Refactor calculate_config_digest() to use runtime.repos[].to_dict()
  • Refactor images_streams_gen_buildconfigs() to use runtime.repos

This simplifies code and ensures consistent repo handling across both old-style and new-style configurations.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 24, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sosiouxme 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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 24, 2025

Walkthrough

Three files are modified to refactor how repository configurations are sourced and represented. Instead of directly accessing runtime.group_config.repos, code now uses runtime.repos and converts entries to Model objects via a new to_dict() method. This affects configuration construction in images_streams.py and digest calculation in image.py.

Changes

Cohort / File(s) Summary
Repository Configuration Method
doozer/doozerlib/repos.py
Adds public method to_dict(self) -> Dict to Repo class to export repository configuration as a plain dictionary
Repository Configuration Refactoring
doozer/doozerlib/cli/images_streams.py, doozer/doozerlib/image.py
Refactors rpm_repos_conf and digest repos resolution to source from runtime.repos instead of group_config.repos; uses to_dict() conversion for Model object compatibility; replaces old dual-branch logic in image.py

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

This change eliminates direct access to old-style repo configurations
(group_config.repos or group_config['repos']) by using runtime.repos
which handles both old-style and new-style repo configs.

Changes:
- Add to_dict() method to Repo class to export configuration as dict
- Refactor calculate_config_digest() to use runtime.repos[].to_dict()
- Refactor images_streams_gen_buildconfigs() to use runtime.repos

This simplifies code and ensures consistent repo handling across both
old-style and new-style configurations.
@vfreex vfreex force-pushed the fix-old-style-repo-leftovers branch from 1da7099 to fb2d13d Compare December 24, 2025 05:32
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 24, 2025

@vfreex: The following test 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/security fb2d13d link false /test security

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.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
doozer/doozerlib/repos.py (1)

210-212: LGTM! Clean API addition for repo configuration export.

The new to_dict() method provides a clean interface for exporting repository configuration as a dictionary, enabling the refactoring in other files. The delegation to self._data.primitive() correctly handles recursive conversion of Model objects to plain dicts.

Optional: Consider more specific return type annotation

The return type could be more specific for better type safety:

-    def to_dict(self) -> Dict:
+    def to_dict(self) -> Dict[str, Any]:

This matches the pattern used in other similar methods and provides clearer type information.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between c48038f and fb2d13d.

📒 Files selected for processing (3)
  • doozer/doozerlib/cli/images_streams.py
  • doozer/doozerlib/image.py
  • doozer/doozerlib/repos.py
🧰 Additional context used
🧬 Code graph analysis (2)
doozer/doozerlib/cli/images_streams.py (2)
artcommon/artcommonlib/model.py (1)
  • Model (116-155)
doozer/doozerlib/repos.py (2)
  • to_dict (210-212)
  • items (482-483)
doozer/doozerlib/repos.py (1)
doozer/doozerlib/lockfile.py (3)
  • to_dict (83-98)
  • to_dict (134-145)
  • to_dict (192-199)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: tests
🔇 Additional comments (2)
doozer/doozerlib/image.py (1)

633-634: LGTM! Clean refactoring to unified repo access.

The change correctly replaces direct group_config.repos access with runtime.repos, which handles both old-style and new-style configurations. The use of to_dict() provides a clean API for exporting repo configurations.

doozer/doozerlib/cli/images_streams.py (1)

518-520: LGTM! Well-documented refactoring with backward compatibility.

The change correctly switches to runtime.repos while maintaining compatibility with existing code that expects dot-notation access. The Model wrapper is necessary since downstream code (e.g., lines 596-600) accesses properties like repo_desc.conf and repo_conf.ci_alignment. The comments clearly explain both the repo source change and the Model wrapping rationale.

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.

1 participant