diff --git a/ctk/features/debug.feature b/ctk/features/debug.feature new file mode 100644 index 00000000..2726d748 --- /dev/null +++ b/ctk/features/debug.feature @@ -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 + diff --git a/dsl-reference.md b/dsl-reference.md index f4fd9ad0..fb31667b 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -28,6 +28,7 @@ - [Set](#set) - [Try](#try) - [Wait](#wait) + - [Debug](#debug) + [Flow Directive](#flow-directive) + [External Resource](#external-resource) + [Authentication](#authentication) @@ -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. diff --git a/dsl.md b/dsl.md index 900c5fb0..4543a350 100644 --- a/dsl.md +++ b/dsl.md @@ -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 diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 0d14745d..8ac9ca5d 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -127,6 +127,7 @@ $defs: - $ref: '#/$defs/switchTask' - $ref: '#/$defs/tryTask' - $ref: '#/$defs/waitTask' + - $ref: '#/$defs/debugTask' callTask: type: object oneOf: @@ -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: