Skip to content

Fixes #38477 - Allow rolling CVs in arbitrary environments #11407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

quba42
Copy link
Contributor

@quba42 quba42 commented Jun 5, 2025

Initial state for rolling content views with arbitrary lifecycle environments.

Things that are missing from this "Draft" PR:

  • Tests for the API controller and backend actions.
  • Checking the new API parameter for consistent behavior with similar existing parameters.

In general, there are various possible combinations of API parameters and situations I have not yet tested.

Summary by Sourcery

Add support for specifying arbitrary lifecycle environments for rolling content views by extending the UI, API, and backend actions.

New Features:

  • Expose lifecycle environment selection in content view creation and details screens for rolling content views.
  • Introduce environment_ids parameter in API create and update endpoints with sanitization.

Enhancements:

  • Adapt backend plan actions (Create, Update, AddRollingRepoClone, RemoveRollingRepoClone) to process repository clones across specified environments.
  • Refactor helper find_related_rolling_repos to use the correct library instance scope.

Tests:

  • Extend frontend tests and fixtures to cover lifecycle environment selection and ensure environment_ids are handled correctly.

Copy link

sourcery-ai bot commented Jun 5, 2025

Reviewer's Guide

This PR extends rolling content views to support arbitrary lifecycle environments by introducing an environment_ids parameter end-to-end, updating the UI to let users select environments, and modifying backend actions and the API to plan and execute cloning/removal per environment.

File-Level Changes

Change Details Files
Add environment selection UI in rolling CV forms and details
  • Import EnvironmentPaths component, actions, selectors
  • Manage selectedEnvs state, dispatch getEnvironmentPaths on mount
  • Flatten and load available environments via useMemo
  • Render lifecycle environments list and Save button under rolling sections
  • Include environment_ids in create/update dispatch calls
webpack/scenes/ContentViews/Details/ContentViewInfo.js
webpack/scenes/ContentViews/Create/CreateContentViewForm.js
Extend API controller to accept and sanitize environment_ids
  • Add :environment_ids param and association
  • Permit environment_ids in view_params unless empty on update
  • Implement sanitized_environment_ids helper
  • Pass sanitized_environment_ids to sync_task for create and update
app/controllers/katello/api/v2/content_views_controller.rb
Update ContentView actions to handle multiple environments
  • Change plan signatures to accept environment_ids
  • Iterate over environments in AddRollingRepoClone, RemoveRollingRepoClone, Create, Update
  • Plan AddToEnvironment and RemoveFromEnvironment for added/removed envs
  • Pass environment_ids to rolling clone actions
app/lib/actions/katello/content_view/add_rolling_repo_clone.rb
app/lib/actions/katello/content_view/remove_rolling_repo_clone.rb
app/lib/actions/katello/content_view/create.rb
app/lib/actions/katello/content_view/update.rb
Adjust rolling CV repository helper query
  • Replace in_environment filtering with library_instances_inverse scope
app/lib/actions/helpers/rolling_cv_repos.rb
Update frontend unit tests for environment_ids and UI
  • Add environment_ids to test fixtures
  • Assert Lifecycle Environments section visibility in details test
  • Ensure environment section not shown for non-rolling CV
webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js
webpack/scenes/ContentViews/Details/__tests__/contentViewRollingDetail.test.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@quba42
Copy link
Contributor Author

quba42 commented Jun 5, 2025

Note, there is also already a accompanying documentation PR: theforeman/foreman-documentation#3902

@quba42
Copy link
Contributor Author

quba42 commented Jun 5, 2025

New UI elements:

rolling_environments
rolling_environments_creation

@quba42
Copy link
Contributor Author

quba42 commented Jun 10, 2025

I am not currently aware of any known issues with the latest state. I do still plan to add more test coverage.

@quba42 quba42 force-pushed the rolling_lifecycle_environments branch from 8d783d8 to f207e5b Compare June 11, 2025 11:49
Co-authored-by: Manisha Singhal <singhal@atix.de>
Co-authored-by: Markus Bucher <bucher@atix.de>
@quba42 quba42 force-pushed the rolling_lifecycle_environments branch from f207e5b to e24b30b Compare June 11, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant