Skip to content

Add Callbacks for Workflow lifecycle events - #11

Merged
daviddavis merged 1 commit into
mainfrom
add-workflow-callbacks
Jun 3, 2026
Merged

daviddavis merged 1 commit into
mainfrom
add-workflow-callbacks

Conversation

@daviddavis

Copy link
Copy Markdown
Collaborator

Introduces CallbackService (an admin-registered executable script, modeled after pulpcore's SigningService but fully API-managed) and WorkflowCallback (a join table to Workflow with a callback_type drawn from the workflow lifecycle states plus a 'finished' wildcard). When a Workflow transitions states, matching callbacks are dispatched as Pulp tasks that invoke the script with PULP_WORKFLOW_NAME / STATE / PK / LABELS / LABEL_ in the environment.

closes #10

Assisted-By: GitHub Copilot (Claude)

Copilot AI review requested due to automatic review settings May 8, 2026 18:18
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 9dcf218 to 0df1898 Compare May 8, 2026 18:18
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 0df1898 to 0111ee0 Compare May 8, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a workflow lifecycle callback extension point to pulp_workflow by introducing an API-managed CallbackService (an admin-registered executable script) and WorkflowCallback attachments on Workflow that dispatch callback invocations as Pulp tasks when workflows transition states.

Changes:

  • Added CallbackService and WorkflowCallback models (plus migration) and exposed them via serializers/viewsets.
  • Dispatched callback tasks on workflow state transitions (running, completed, failed, canceled, plus finished wildcard).
  • Added functional/unit test coverage, documentation updates, and a changelog entry.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Updates README overview to mention callbacks.
CHANGES/+10.feature Documents the new callback feature and environment variables.
pulp_workflow/app/migrations/0003_callbackservice_workflowcallback.py Adds DB tables for CallbackService and WorkflowCallback.
pulp_workflow/app/models.py Introduces callback-related models/constants and script execution logic.
pulp_workflow/app/serializers.py Adds serializers for callback services and nested workflow callbacks.
pulp_workflow/app/tasks.py Dispatches callback tasks on workflow state transitions and implements run_callback.
pulp_workflow/app/viewsets.py Adds CallbackServiceViewSet and fires cancel-related callbacks.
pulp_workflow/pytest_plugin.py Adds factories and monitor_workflow helper fixture for functional tests.
pulp_workflow/tests/unit/test_viewsets.py Adds access policy and locked-role tests for CallbackServiceViewSet.
pulp_workflow/tests/functional/api/test_crud_callback_services.py Adds CRUD functional tests for callback services.
pulp_workflow/tests/functional/api/test_workflow_callbacks.py Adds end-to-end lifecycle callback dispatch tests.
pulp_workflow/tests/functional/api/test_execute_workflow.py Refactors workflow execution test to use shared helpers (extract_pk, monitor_workflow).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pulp_workflow/app/serializers.py Outdated
Comment thread pulp_workflow/app/serializers.py
Comment thread pulp_workflow/pytest_plugin.py
Comment thread pulp_workflow/app/models.py Outdated
Comment thread README.md Outdated
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 0111ee0 to a550750 Compare May 8, 2026 18:24
@daviddavis daviddavis changed the title Add CallbackServices for Workflow lifecycle events Add callbacks for Workflow lifecycle events May 8, 2026
@daviddavis daviddavis changed the title Add callbacks for Workflow lifecycle events Add Callbacks for Workflow lifecycle events May 8, 2026
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from a550750 to af65e61 Compare May 8, 2026 18:30
Copilot AI review requested due to automatic review settings May 11, 2026 13:13
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from af65e61 to fef70cb Compare May 11, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Comment thread pulp_workflow/app/models.py Outdated
Comment thread pulp_workflow/app/models.py
Comment thread pulp_workflow/app/serializers.py Outdated
Comment thread template_config.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Comment thread pulp_workflow/pytest_plugin.py
Comment thread pulp_workflow/app/models.py
Comment thread pulp_workflow/app/models.py
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from d784c71 to 624cfb9 Compare May 11, 2026 13:57
Copilot AI review requested due to automatic review settings May 14, 2026 13:34
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 624cfb9 to 2d1bfa4 Compare May 14, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Comment thread pulp_workflow/pytest_plugin.py
Comment thread pulp_workflow/app/models.py
Comment thread pulp_workflow/app/serializers.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Comment thread pulp_workflow/pytest_plugin.py
Comment thread pulp_workflow/tests/unit/test_models.py
Comment thread pulp_workflow/tests/unit/test_models.py
Comment thread pulp_workflow/tests/unit/test_models.py
Comment thread pulp_workflow/tests/unit/test_models.py
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from e325799 to b4703aa Compare June 2, 2026 14:39
Copilot AI review requested due to automatic review settings June 2, 2026 14:40
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from b4703aa to da7586d Compare June 2, 2026 14:40
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from da7586d to 73bd1c1 Compare June 2, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Comment thread pulp_workflow/app/viewsets.py Outdated
Comment thread pulp_workflow/app/viewsets.py Outdated
Comment thread pulp_workflow/pytest_plugin.py
Comment thread docs/demo/README.md
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 73bd1c1 to 64240a8 Compare June 2, 2026 14:49
Copilot AI review requested due to automatic review settings June 2, 2026 14:56
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 64240a8 to 62e8080 Compare June 2, 2026 14:56
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 62e8080 to ef6888b Compare June 2, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Comment thread pulp_workflow/app/tasks.py
Comment thread pulp_workflow/app/tasks.py
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from ef6888b to 8b2ff58 Compare June 2, 2026 15:08
Copilot AI review requested due to automatic review settings June 2, 2026 15:18
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 8b2ff58 to caab655 Compare June 2, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment thread docs/demo/README.md Outdated
Comment thread docs/demo/README.md Outdated
Comment thread README.md
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from caab655 to 8241c94 Compare June 2, 2026 15:55
Copilot AI review requested due to automatic review settings June 2, 2026 16:04
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 8241c94 to 88a5fe3 Compare June 2, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment thread pulp_workflow/app/models.py
Comment thread CHANGES/10.feature
Comment thread pulp_workflow/tests/unit/test_models.py
Introduces CallbackService (an admin-registered executable script,
modeled after pulpcore's SigningService) and WorkflowCallback (a join
table to Workflow with a callback_type drawn from the workflow lifecycle
states plus a 'finished' option). When a Workflow transitions states,
matching callbacks are dispatched as Pulp tasks that invoke the script.

closes #10

Assisted-By: GitHub Copilot (Claude)
@daviddavis
daviddavis force-pushed the add-workflow-callbacks branch from 88a5fe3 to 50d2746 Compare June 2, 2026 20:02
@daviddavis
daviddavis merged commit 66a0d3c into main Jun 3, 2026
10 checks passed
@daviddavis
daviddavis deleted the add-workflow-callbacks branch June 8, 2026 17:29
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.

Add user-registered callbacks that fire on Workflow lifecycle events

3 participants