Skip to content

Conversation

@jturel
Copy link
Member

@jturel jturel commented Dec 22, 2025

What are the changes introduced in this pull request?

Removes the AutoPublishCompositeView event with a task that emulates the same behavior of the event + event queue retry function. Is the design totally insane or is there something to this?

Considerations taken when implementing this change?

Maintain the intention of the event in that the task will continue trying to trigger the Publish task until it's not locked by another task.

What are the testing steps for this pull request?

Publish a CV:
ForemanTasks.async_task(Actions::Katello::ContentView::AutoPublish, Katello::ContentView.find(2), description: 'fake', triggered_by: 49)

And while it's running:

ForemanTasks.async_task(Actions::Katello::ContentView::AutoPublish, Katello::ContentView.find(2), description: 'fake', triggered_by: 49)

Of course, you need your own values for the CV and triggered by id (which is a CVV)

Summary by Sourcery

Replace the AutoPublish composite view event mechanism with a task-based workflow that triggers composite content view auto-publish via ForemanTasks.

New Features:

  • Introduce an AutoPublish task action for content views that retries publish when locks are present and integrates with BulkAction for batching composite publishes.

Bug Fixes:

  • Ensure composite auto-publish is skipped when no eligible composite content views are configured, avoiding unnecessary background work.

Enhancements:

  • Trigger composite auto-publish from the publish action via an execution plan hook instead of the run phase.
  • Add helper methods on content view and content view version to compute composite views to auto-publish and the options passed to async tasks.

Tests:

  • Update publish action tests to cover the new auto-publish task behavior and remove event-based expectations.
  • Add unit tests for content view version auto_publish_composites! behavior, including the no-composites case.

Chores:

  • Remove the AutoPublishCompositeView event class, its registration, and associated tests now that the behavior is handled by tasks instead of events.

auto_publish_composites = content_view.auto_publish_component_composites
return unless auto_publish_composites.any?

ForemanTasks.async_task(Actions::BulkAction, Actions::Katello::ContentView::AutoPublish, auto_publish_composites, auto_publish_options)
Copy link
Member Author

Choose a reason for hiding this comment

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

AutoPublish can change to handle N >1 sub plans so a BulkAction probably shouldn't / needn't be used

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