check result
Demo the feature that you could use .last_result.Code and .last_result.Output as condition to orchestrate your workflow
Demo
source
Main task yaml file
tasks:
- name: task
desc: test the exit scenarios due to different types of validation
task:
- func: shell
desc: step1
do:
- echo hello
- echo world
- func: shell
desc: step2
do:
- echo tom
- echo "{{.last_result.Code}}"
- echo "{{.last_result.Output}}"
- echo hanks
- func: shell
desc: step3
dvars:
- name: greet
value: |
hello: {{.last_result.Output}}
do:
- echo tom
- echo "{{.last_result.Output}}"
- echo hanks
- echo "{{.greet}}"
Main log file
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0041
Verbose -> vvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/c0041
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: test the exit scenarios due to different types of validation ]
-Step1: [: step1 ]
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0
})
cmd( 1):
echo hello
-
hello
-
.. ok
cmd( 2):
echo world
-
world
-
.. ok
. ok
-Step2: [: step2 ]
self: final context exec vars:
(*core.Cache)({
"last_result": (*utils.ExecResult)({
Cmd: "echo world",
Code: 0,
Output: "world",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 0
})
cmd( 1):
echo tom
-
tom
-
.. ok
cmd( 2):
echo "{{.last_result.Code}}"
-
0
-
.. ok
cmd( 3):
echo "{{.last_result.Output}}"
-
world
-
.. ok
cmd( 4):
echo hanks
-
hanks
-
.. ok
. ok
-Step3: [: step3 ]
self: final context exec vars:
(*core.Cache)({
"last_result": (*utils.ExecResult)({
Cmd: "echo hanks",
Code: 0,
Output: "hanks",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 0,
"greet": "hello: hanks\n"
})
cmd( 1):
echo tom
-
tom
-
.. ok
cmd( 2):
echo "{{.last_result.Output}}"
-
hanks
-
.. ok
cmd( 3):
echo hanks
-
hanks
-
.. ok
cmd( 4):
echo "{{.greet}}"
-
hello: hanks
-
.. ok
. ok
Logs with different verbose level
Raw logs with different verbose level