Skip to content

Implement workflow orchestration #1138

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: main
Choose a base branch
from
Draft

Implement workflow orchestration #1138

wants to merge 1 commit into from

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Apr 21, 2025

Description

Adds a new workflow-engine module that facilitates orchestration of workflows.

This implements ADR-002: Workflow Orchestration with the ultimate goal to implement ADR-001: Drop Kafka Dependency.

This PR does not include actual workflow implementations. Those will be added separately. For the time being, refer to some draft implementations in the older workflow-v2 branch: https://github.com/DependencyTrack/hyades-apiserver/tree/workflow-v2/src/main/java/org/dependencytrack/workflow

Addressed Issue

TODO

Additional Details

TODO

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

@nscuro nscuro added the enhancement New feature or request label Apr 21, 2025
@nscuro nscuro force-pushed the workflow-engine branch 3 times, most recently from 2ef29a5 to 882a31a Compare April 22, 2025 11:08
Copy link

codacy-production bot commented Apr 22, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-1.05% (target: -1.00%) 70.89% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (fd90635) 27304 22049 80.75%
Head commit (42519d7) 30489 (+3185) 24300 (+2251) 79.70% (-1.05%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1138) 3185 2258 70.89%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@nscuro nscuro force-pushed the workflow-engine branch 3 times, most recently from f3acab3 to 81c7420 Compare April 24, 2025 16:01
@nscuro nscuro requested a review from Copilot April 26, 2025 14:12
Copy link
Contributor

@Copilot Copilot AI left a comment

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 implements a new workflow orchestration module by introducing a workflow engine along with related components for executing and monitoring activities.

  • Introduces core components like ActivityTaskManager, ActivityTask, ActivityGroup, and ActivityContext.
  • Adds client APIs and REST resources for workflow runs along with serializers and test cases.

Reviewed Changes

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

Show a summary per file
File Description
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityTaskManager.java Implements task polling, processing, and abandonment logic for workflow activities.
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityTask.java Defines the record for individual activity tasks.
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityGroup.java Groups activity names and manages concurrency for a set of activities.
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityExecutor.java Declares the interface for activity executors.
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityContext.java Provides context for executing activities including heartbeat logic.
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityClient.java Creates a client wrapper for invoking activity calls.
workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityCallOptions.java Specifies options for activity invocation including retry policy.
apiserver/... Contains REST resources, response models, and serializers for workflow runs.
apiserver/src/main/java/org/dependencytrack/context/... Provides DI support and factory/binder for WorkflowEngine integration.
Files not reviewed (4)
  • apiserver/pom.xml: Language not supported
  • coverage-report/pom.xml: Language not supported
  • pom.xml: Language not supported
  • workflow-engine/pom.xml: Language not supported
Comments suppressed due to low confidence (1)

workflow-engine/src/main/java/org/dependencytrack/workflow/engine/ActivityTaskManager.java:124

  • [nitpick] The timeout scenario for task completion is not covered by tests; consider adding tests to validate behavior when a TimeoutException is thrown during task completion.
engine.completeActivityTask(task, result).join();

@nscuro nscuro force-pushed the workflow-engine branch 12 times, most recently from 301a1fb to 3485815 Compare May 2, 2025 17:34
@nscuro nscuro force-pushed the workflow-engine branch 2 times, most recently from 34b1903 to 0e50355 Compare May 8, 2025 22:13
@nscuro nscuro force-pushed the workflow-engine branch 6 times, most recently from 910fd99 to ad4af0a Compare May 20, 2025 18:19
@nscuro nscuro force-pushed the workflow-engine branch 3 times, most recently from 9185b32 to 720364a Compare May 20, 2025 20:15
@nscuro nscuro force-pushed the workflow-engine branch from 720364a to 419fef3 Compare May 23, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant