Support YAML anchors
---
version: 1.0
description: Deploy staging application
.definitions:
action_succeeded: &action_succeeded
- task_message: "<% ctx('environment') %> deploy <% task().task_name %> :white_check_mark:"
someaction:
action: core.noop
retry:
count: 3
delay: 60
next:
- when: <% succeeded() %>
publish: *action_succeeded
do:
- notify_slack
- when: <% failed() %>
publish:
- task_message: "<% ctx('environment') %> deploy <% task().task_name %> :boom:"
- stderr: <% result().stderr %>
do:
- notify_slack
- fail
...
However when I run the workflow I get:
{
"errors": [
{
"message": "Additional properties are not allowed ('.definitions' was unexpected)",
"spec_path": null,
"schema_path": "additionalProperties",
"type": "syntax"
}
],
"output": null
}
Poking around it looks like this is more of schema enforcement than a yaml issue.
https://github.com/StackStorm/orquesta/blob/master/orquesta/specs/native/v1/models.py#L614
I think the challenge here is that anchors can be defined as anything and per the yaml spec the definition of the anchor is not removed afterwards. Because of this it would probably make it more difficult to clean up the rendered yaml before its committed to the database.
I guess in this case there would have to be a fully enforceable named key (like .definitions) that could be removed after rendering and before validating.
{
"version": 1.0,
"description": "Deploy staging application",
"action_succeeded": [
{
"task_message": "<% ctx('environment') %> deploy <% task().task_name %> :white_check_mark:"
}
],
"tasks": {
"someaction": {
"action": "core.noop",
"retry": {
"count": 3,
"delay": 60
},
"next": [
{
"when": "<% succeeded() %>",
"publish": [
{
"task_message": "<% ctx('environment') %> deploy <% task().task_name %> :white_check_mark:"
}
],
"do": [
"notify_slack"
]
}
]
}
}
}
Not sure if this is helpful or not, but this very simple workflow makes use of anchors and seems to work ok.
version: "1.0"
vars:
- billing_address: &add1
house: B1
street: My Street
tasks:
print_output:
action: core.echo
input:
message: *add1
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.