forked from StackStorm/st2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request StackStorm#3177 from StackStorm/mistral-jinja-tests
Add integration test for jinja evaluation in mistral
- Loading branch information
Showing
4 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
21 changes: 21 additions & 0 deletions
21
contrib/examples/actions/mistral-jinja-workbook-complex.yaml
This file contains 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,21 @@ | ||
--- | ||
description: Run a series of simulated actions. | ||
enabled: true | ||
entry_point: workflows/mistral-jinja-workbook-complex.yaml | ||
name: mistral-jinja-workbook-complex | ||
pack: examples | ||
parameters: | ||
cpu_cores: | ||
default: 1 | ||
type: integer | ||
memory_mb: | ||
default: 1024 | ||
type: integer | ||
vm_name: | ||
required: true | ||
type: string | ||
workflow: | ||
default: examples.mistral-jinja-workbook-complex.main | ||
immutable: true | ||
type: string | ||
runner_type: mistral-v2 |
102 changes: 102 additions & 0 deletions
102
contrib/examples/actions/workflows/mistral-jinja-workbook-complex.yaml
This file contains 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,102 @@ | ||
version: "2.0" | ||
name: examples.mistral-jinja-workbook-complex | ||
description: > | ||
A sample workflow that demonstrates nested workflows, | ||
forks, join, and use of jinja expressions. | ||
workflows: | ||
|
||
main: | ||
type: direct | ||
input: | ||
- vm_name | ||
- cpu_cores | ||
- memory_mb | ||
output: | ||
vm_id: '{{ _.vm_id }}' | ||
ip: '{{ _.ip }}' | ||
tasks: | ||
register_dns: | ||
action: core.local | ||
input: | ||
cmd: "sleep 1; printf 'Registering {{ _.vm_name }}...'" | ||
publish: | ||
ip: "10.1.23.98" | ||
status_message: "DNS for {{ _.vm_name }} is registered." | ||
on-success: | ||
- configure_vm | ||
- notify | ||
create_vm: | ||
wait-before: 1 | ||
workflow: create_vm | ||
input: | ||
name: '{{ _.vm_name }}' | ||
cpu_cores: '{{ _.cpu_cores }}' | ||
memory_mb: '{{ _.memory_mb }}' | ||
publish: | ||
vm_id: "{{ task('create_vm').result.vm_id }}" | ||
status_message: "VM {{ _.vm_name }} is created." | ||
on-success: | ||
- configure_vm | ||
- notify | ||
configure_vm: | ||
join: all | ||
workflow: configure_vm | ||
input: | ||
vm_id: '{{ _.vm_id }}' | ||
ip: '{{ _.ip }}' | ||
publish: | ||
status_message: "VM {{ _.vm_name }} is reconfigured." | ||
on-success: | ||
- close_request | ||
- notify | ||
close_request: | ||
action: std.noop | ||
publish: | ||
status_message: "VM request is fulfilled." | ||
on-success: | ||
- notify | ||
notify: | ||
action: core.local | ||
input: | ||
cmd: "printf '{{ _.status_message }}'" | ||
|
||
create_vm: | ||
type: direct | ||
input: | ||
- name | ||
- cpu_cores | ||
- memory_mb | ||
output: | ||
vm_id: '{{ _.vm_id }}' | ||
tasks: | ||
create: | ||
action: core.local | ||
input: | ||
cmd: "printf 'vm6789'; sleep 5" | ||
publish: | ||
vm_id: "{{ task('create').result.stdout }}" | ||
|
||
configure_vm: | ||
type: direct | ||
input: | ||
- vm_id | ||
- ip | ||
vars: | ||
apps: | ||
- 'super mario brothers' | ||
- 'zelda' | ||
- 'donkey kong' | ||
tasks: | ||
add_disks: | ||
action: core.local | ||
input: | ||
cmd: "sleep 1; printf 'disks created'" | ||
add_nics: | ||
action: core.local | ||
input: | ||
cmd: "sleep 1; printf 'nics created'" | ||
install_apps: | ||
action: core.local | ||
input: | ||
cmd: "sleep 1; {% for app in _.apps %}printf '{{ app }} is installed.\n'; {% endfor %}" |
This file contains 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