generated from redhat-developer/new-project-template
-
Notifications
You must be signed in to change notification settings - Fork 55
RHIDP-9105: Best practices when creating a workflow #1424
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
Merged
Gerry-Forde
merged 10 commits into
redhat-developer:main
from
jmagak:RHIDP-9105-Best-practices-when-creating-a-workflow
Nov 5, 2025
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
04f0e0c
Update the best practices
invalid-email-address 5742ac3
Update the best practices
invalid-email-address 5ea6bc7
Update the best practices
invalid-email-address 0c0e7be
Merge branch 'main' into RHIDP-9105-Best-practices-when-creating-a-wo…
jmagak 58bf2fc
Apply suggestions
invalid-email-address 51aa4fe
Apply new suggestions
invalid-email-address cb1f001
Apply new suggestions
invalid-email-address 19945bd
Apply new suggestions
invalid-email-address 6d27ff6
Update new suggestions
invalid-email-address d9af45d
Merge branch 'main' into RHIDP-9105-Best-practices-when-creating-a-wo…
Gerry-Forde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
modules/orchestrator/ref-best-practices-for-creating-workflows.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
|
|
||
| [id="ref-best-practices-for-creating-workflows.adoc_{context}"] | ||
| = Best practices when creating serverless workflows | ||
|
|
||
| Create effective serverless workflows using thoughtful approaches to design, handle data, and manage error by following these best practices based on the Serverless Workflow Domain Specific Language (DSL) principles. These principles help you to build robust workflows. | ||
|
|
||
| Workflow design principles:: | ||
| + | ||
| The Serverless Workflow DSL prioritizes clarity and ease of use when writing workflows. | ||
|
|
||
| Priority of constituencies::: | ||
| + | ||
| When developing workflows or APIs, ensure the needs of the author (workflow writer) come first. The constituencies are prioritized in the following order: Authors > Operators > Implementors > Specifications writers. | ||
|
|
||
| Linguistic fluency and clarity::: | ||
| + | ||
| ** Use imperative verbs such as `Call`, `Emit`, `For`, `Fork`, `Raise`, `Run`, `Set`, `Switch`, and `Wait`. These simple, universally understood terms make your workflow simple to read and understand. | ||
|
|
||
| Structure and Extensibility::: | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| ** Use implicit default behaviors to reduce redundancy. | ||
| ** Declare components inline if they are not reusable to keep the definition self-contained. | ||
| ** Use external references to import and reuse shared components, which promotes a modular design. | ||
| ** Prioritize flexibility over strict enumerations to ensure extensibility and adaptability across different runtime environments. | ||
|
|
||
| Data flow and runtime management:: | ||
| + | ||
| Controlling data flow is critical for efficient workflows. Tasks are the fundamental computing units of a workflow. The Domain Specific Language defines several default task types that runtimes must do. These include `Do`, `Listen`, `Raise`, `Run`, `Try`, and `Wait`. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Security and error handling:: | ||
| + | ||
| Secrets::: Use Secrets with caution. Avoid passing them directly in call inputs as this might expose sensitive information. | ||
|
|
||
| Fault tolerance and error handling::: Serverless Workflow is designed with resilience in mind to recover from failures. | ||
|
|
||
| Orchestrator UI integration best practices:: | ||
| + | ||
| For your workflow results to be effectively displayed in the Orchestrator UI and to facilitate chaining of workflows, you must structure the output data according to the `WorkflowResult` schema. Additionally, include any error information as part of the workflow output so the UI and subsequent workflows can handle them accordingly. | ||
| + | ||
| Workflow output schema::: | ||
| + | ||
| Results placement:::: The primary output intended for subsequent processing should be placed under the `data.result` property. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Schema reference:::: Your output schema file (`schemas/workflow-output-schema.json`) should reference the `WorkflowResult` schema. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Outputs definition:::: Include an `outputs` section in your workflow definition. This section contains human-readable key/value pairs that the UI will display. | ||
| + | ||
| Structure of workflow: | ||
| + | ||
| [source,yaml] | ||
| ---- | ||
| id: my-workflow | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| version: "0.8" | ||
| specVersion: "0.8" | ||
| name: My Workflow | ||
| start: ImmediatelyEnd | ||
| dataInputSchema: schemas/basic__main-schema.json | ||
| extensions: | ||
| - extensionid: workflow-output-schema | ||
| outputSchema: schemas/workflow-output-schema.json | ||
| functions: | ||
| - name: print | ||
| type: custom | ||
| operation: sysout | ||
| - name: successResult | ||
| type: expression | ||
| operation: '{ | ||
| "result": { | ||
| "message": "Project " + .projectName + " active", | ||
| "outputs":[] | ||
| } | ||
| }' | ||
| start: "successResult" | ||
| states: | ||
| - name: successResult | ||
| type: operation | ||
| actions: | ||
| - name: setOutput | ||
| functionRef: | ||
| refName: successResult | ||
| end: true | ||
| ---- | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.