Skip to content

Commit

Permalink
[Fix_#856] Add debug task
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
  • Loading branch information
fjtirado committed May 27, 2024
1 parent 2d79abe commit fdf9ec7
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
42 changes: 42 additions & 0 deletions ctk/features/debug.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Feature: Debug Task
As an implementer of the workflow DSL
I want to ensure that debug tasks can be executed within the workflow
So that my implementation conforms to the expected behaviour

# Tests Debug with literal constant
Scenario: Debug with literal constant
Given a workflow with definition:
"""yaml
document:
dsl: 1.0.0-alpha1
namespace: default
name: debug
do:
printMessage:
debug: Hello world!
"""
And given the workflow input is:
"""yaml
"""
When the workflow is executed
Then the workflow should complete

# Tests Debug with expression
Scenario: Debug with expression
Given a workflow with definition:
"""yaml
document:
dsl: 1.0.0-alpha1
namespace: default
name: debug
do:
printMessage:
debug: ${Hello \(.name)!}
"""
And given the workflow input is:
"""yaml
name: John
"""
When the workflow is executed
Then the workflow should complete

17 changes: 17 additions & 0 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [Set](#set)
- [Try](#try)
- [Wait](#wait)
- [Debug](#debug)
+ [Flow Directive](#flow-directive)
+ [External Resource](#external-resource)
+ [Authentication](#authentication)
Expand Down Expand Up @@ -973,6 +974,22 @@ do:
seconds: 10
```

#### Debug

Allows workflows to print information to standart output. It accepts a string that can be a literal or an expr

##### Examples
```yaml
document:
dsl: '1.0.0-alpha1'
namespace: test
name: sample-workflow
version: '0.1.0'
do:
printMessage:
debug: Hello world!
```

### Flow Directive

Flow Directives are commands within a workflow that dictate its progression.
Expand Down
3 changes: 2 additions & 1 deletion dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task
- [Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution.
- [Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption.
- [Wait](dsl-reference.md#wait), used to pause or wait for a specified duration before proceeding to the next task.
- [Debug] (dsl-reference.md#debug), used to print information to standard output

To ensure they conform to the DSL, runtimes **should** pass all the feature conformance test scenarii defined in the [ctk](ctk/README.md).
To ensure they conform to the DSL, runtimes **should** pass all the feature conformance test scenario defined in the [ctk](ctk/README.md).

##### Secret

Expand Down
7 changes: 7 additions & 0 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ $defs:
- $ref: '#/$defs/switchTask'
- $ref: '#/$defs/tryTask'
- $ref: '#/$defs/waitTask'
- $ref: '#/$defs/debugTask'
callTask:
type: object
oneOf:
Expand Down Expand Up @@ -533,6 +534,12 @@ $defs:
description: The amount of time to wait.
required: [ wait ]
description: Allows workflows to pause or delay their execution for a specified period of time.
debugTask:
type: object
properties:
debug:
type: string
description: Print a message (a literal string or an expression) to standard output
authenticationPolicy:
type: object
oneOf:
Expand Down

0 comments on commit fdf9ec7

Please sign in to comment.