f0188_vvvvv
Log reference:
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> f0188
Verbose -> vvvvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
:release version: 1.0.0
:verbose level: vvvvv
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/f0188
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
-------full vars in scopes------
(*impl.Scopes)(0xc0001e5400)(<nil>)
---------group vars----------
global: (*core.Cache)({
})
groups members:[]
merged[ dev ] runtime vars:
(*core.Cache)({
})
(*core.Cache)(0xc000126908)({
})
[runtime global] dvar expanded result:
{
}
-------runtime global final merged with dvars-------
(*core.Cache)({
})
located task-> 1 [task]:
Task1: [task ==> task: ]
Executing task stack layer: 1
-Step1: [
expect sub_task to close file each time in loop iteration
]
{
Name: "",
Do: {
"sub_task"
},
Dox: <nil>,
Func: "call",
Vars: <nil>,
Dvars: <nil>,
Desc: "expect sub_task to close file each time in loop iteration\n",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: {
"item1",
"item2",
"item3"
},
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"up_runtime_task_layer_number": 0
}
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0
})
caller's vars to task (sub_task)::
(*core.Cache)({
"up_runtime_task_layer_number": 0,
"loopitem": "item1",
"loopindex": 0,
"loopindex1": 1
})
located task-> 2 [sub_task]:
=Task2: [task ==> sub_task: without rescue, the execution will return a non-zero return code in shell and also report the error
with rescue, the program will return 0
]
Executing task stack layer: 2
--Step1:
{
Name: "",
Do: {
{
"name": "print",
"cmd": "case {{.loopitem}}"
}
},
Dox: <nil>,
Func: "cmd",
Vars: <nil>,
Dvars: <nil>,
Desc: "",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopindex1": 1,
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"loopitem": "item1",
"loopindex": 0,
"loopindex1": 1,
"up_runtime_task_layer_number": 1
}
self: final context exec vars:
(*core.Cache)({
"loopindex": 0,
"loopindex1": 1,
"up_runtime_task_layer_number": 1,
"loopitem": "item1"
})
case {{.loopitem}}
~~SubStep1: [print: ]
case item1
--Step2: [step1: conditionall trigger the error ]
{
Name: "step1",
Do: {
"echo \"case {{.loopitem}} \"",
"echo \"hello\"|grep \"world\""
},
Dox: <nil>,
Func: "shell",
Vars: <nil>,
Dvars: <nil>,
Desc: "conditionall trigger the error",
Reg: "",
Flags: <nil>,
If: "{{eq .loopitem \"item2\"}}",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopindex1": 1,
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"loopindex1": 1,
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0
}
self: final context exec vars:
(*core.Cache)({
"loopindex": 0,
"loopindex1": 1,
"up_runtime_task_layer_number": 1,
"loopitem": "item1"
})
condition failed, skip executing step step1
--Step3: [
step2in this case, since there is no ignoreError, the exception was captured by task level finaly code block
opened file is safely closed
to make the flow to continue to reach step2, use ignoreError
]
{
Name: "step2",
Do: {
{
"name": "print",
"cmd": "step 2"
}
},
Dox: <nil>,
Func: "cmd",
Vars: <nil>,
Dvars: <nil>,
Desc: "in this case, since there is no ignoreError, the exception was captured by task level finaly code block\nopened file is safely closed\nto make the flow to continue to reach step2, use ignoreError\n",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"last_result": (*utils.ExecResult)(<nil>),
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0,
"loopindex1": 1
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0,
"loopindex1": 1,
"last_result": (*utils.ExecResult)(<nil>)
}
self: final context exec vars:
(*core.Cache)({
"loopindex": 0,
"loopindex1": 1,
"last_result": (*utils.ExecResult)(<nil>),
"up_runtime_task_layer_number": 1,
"loopitem": "item1"
})
step 2
~~SubStep1: [print: ]
step 2
task Finally:
-Step1: [
close_fileensure the opened file is closed
]
{
Name: "close_file",
Do: {
"echo \"close the file .....\""
},
Dox: <nil>,
Func: "shell",
Vars: <nil>,
Dvars: <nil>,
Desc: "ensure the opened file is closed\n",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0,
"loopindex1": 1
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"loopindex1": 1,
"up_runtime_task_layer_number": 1,
"loopitem": "item1",
"loopindex": 0
}
self: final context exec vars:
(*core.Cache)({
"loopitem": "item1",
"loopindex": 0,
"loopindex1": 1,
"up_runtime_task_layer_number": 1
})
cmd( 1):
echo "close the file ....."
cmd=>:
echo "close the file ....."
-
close the file .....
-
.. ok
(utils.ExecResult) {
Cmd: (string) (len=27) "echo \"close the file .....\"",
Code: (int) 0,
Output: (string) (len=20) "close the file .....",
ErrMsg: (string) ""
}
. ok
caller's vars to task (sub_task)::
(*core.Cache)({
"loopindex": 1,
"loopindex1": 2,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 0,
"loopitem": "item2"
})
located task-> 2 [sub_task]:
=Task2: [task ==> sub_task: without rescue, the execution will return a non-zero return code in shell and also report the error
with rescue, the program will return 0
]
Executing task stack layer: 2
--Step1:
{
Name: "",
Do: {
{
"name": "print",
"cmd": "case {{.loopitem}}"
}
},
Dox: <nil>,
Func: "cmd",
Vars: <nil>,
Dvars: <nil>,
Desc: "",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
})
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 1,
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2
}
self: final context exec vars:
(*core.Cache)({
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 1
})
case {{.loopitem}}
~~SubStep1: [print: ]
case item2
--Step2: [step1: conditionall trigger the error ]
{
Name: "step1",
Do: {
"echo \"case {{.loopitem}} \"",
"echo \"hello\"|grep \"world\""
},
Dox: <nil>,
Func: "shell",
Vars: <nil>,
Dvars: <nil>,
Desc: "conditionall trigger the error",
Reg: "",
Flags: <nil>,
If: "{{eq .loopitem \"item2\"}}",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopindex": 1,
"loopindex1": 2,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 1,
"loopitem": "item2"
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 1
}
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
})
})
cmd( 1):
echo "case {{.loopitem}} "
cmd=>:
echo "case item2 "
-
case item2
-
.. ok
(utils.ExecResult) {
Cmd: (string) (len=18) "echo \"case item2 \"",
Code: (int) 0,
Output: (string) (len=10) "case item2",
ErrMsg: (string) ""
}
cmd( 2):
echo "hello"|grep "world"
cmd=>:
echo "hello"|grep "world"
-
-
.. failed(suppressed if it is not the last step)
(utils.ExecResult) {
Cmd: (string) (len=25) "echo \"hello\"|grep \"world\"",
Code: (int) 1,
Output: (string) "",
ErrMsg: (string) (len=13) "exit status 1"
}
task Finally:
Recovered from: ERROR: Failed And Not Ignored! [You may want to continue and ignore the error]
--Step1: [
close_fileensure the opened file is closed
]
{
Name: "close_file",
Do: {
"echo \"close the file .....\""
},
Dox: <nil>,
Func: "shell",
Vars: <nil>,
Dvars: <nil>,
Desc: "ensure the opened file is closed\n",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"up_runtime_task_layer_number": 1,
"loopitem": "item2",
"loopindex": 1,
"loopindex1": 2
}
self: final context exec vars:
(*core.Cache)({
"loopindex": 1,
"loopindex1": 2,
"up_runtime_task_layer_number": 1,
"loopitem": "item2"
})
cmd( 1):
echo "close the file ....."
cmd=>:
echo "close the file ....."
-
close the file .....
-
.. ok
(utils.ExecResult) {
Cmd: (string) (len=27) "echo \"close the file .....\"",
Code: (int) 0,
Output: (string) (len=20) "close the file .....",
ErrMsg: (string) ""
}
. ok
WARN: [Rescued in task level, but not advised!] - [setting rescue to yes/true to continue is not recommended
it is advised to locate root cause of the problem, fix it and re-run the task again
it is the best practice to test the execution in your ci pipeline to eliminate problems rather than dynamically fix using rescue]
caller's vars to task (sub_task)::
(*core.Cache)({
"up_runtime_task_layer_number": 0,
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
})
})
located task-> 2 [sub_task]:
==Task2: [task/sub_task ==> sub_task: without rescue, the execution will return a non-zero return code in shell and also report the error
with rescue, the program will return 0
]
Executing task stack layer: 3
---Step1:
{
Name: "",
Do: {
{
"cmd": "case {{.loopitem}}",
"name": "print"
}
},
Dox: <nil>,
Func: "cmd",
Vars: <nil>,
Dvars: <nil>,
Desc: "",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
})
}
self: final context exec vars:
(*core.Cache)({
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2
})
case {{.loopitem}}
~~~SubStep1: [print: ]
case item3
---Step2: [step1: conditionall trigger the error ]
{
Name: "step1",
Do: {
"echo \"case {{.loopitem}} \"",
"echo \"hello\"|grep \"world\""
},
Dox: <nil>,
Func: "shell",
Vars: <nil>,
Dvars: <nil>,
Desc: "conditionall trigger the error",
Reg: "",
Flags: <nil>,
If: "{{eq .loopitem \"item2\"}}",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
}),
"up_runtime_task_layer_number": 2
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
})
}
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"close the file .....\"",
Code: 0,
Output: "close the file .....",
ErrMsg: ""
})
})
condition failed, skip executing step step1
---Step3: [
step2in this case, since there is no ignoreError, the exception was captured by task level finaly code block
opened file is safely closed
to make the flow to continue to reach step2, use ignoreError
]
{
Name: "step2",
Do: {
{
"cmd": "step 2",
"name": "print"
}
},
Dox: <nil>,
Func: "cmd",
Vars: <nil>,
Dvars: <nil>,
Desc: "in this case, since there is no ignoreError, the exception was captured by task level finaly code block\nopened file is safely closed\nto make the flow to continue to reach step2, use ignoreError\n",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"last_result": (*utils.ExecResult)(<nil>),
"up_runtime_task_layer_number": 2
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"last_result": (*utils.ExecResult)(<nil>),
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3
}
self: final context exec vars:
(*core.Cache)({
"loopindex1": 3,
"last_result": (*utils.ExecResult)(<nil>),
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2
})
step 2
~~~SubStep1: [print: ]
step 2
task Finally:
--Step1: [
close_fileensure the opened file is closed
]
{
Name: "close_file",
Do: {
"echo \"close the file .....\""
},
Dox: <nil>,
Func: "shell",
Vars: <nil>,
Dvars: <nil>,
Desc: "ensure the opened file is closed\n",
Reg: "",
Flags: <nil>,
If: "",
Else: <nil>,
Loop: <nil>,
Until: "",
RefDir: "",
VarsFile: "",
Timeout: 0,
Finally: <nil>,
Rescue: false
}
current exec runtime vars:
(*core.Cache)({
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3,
"up_runtime_task_layer_number": 2
})
[local] dvar expanded result:
{
}
scope[local] merged: {
"loopindex1": 3,
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2
}
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 2,
"loopitem": "item3",
"loopindex": 2,
"loopindex1": 3
})
cmd( 1):
echo "close the file ....."
cmd=>:
echo "close the file ....."
-
close the file .....
-
.. ok
(utils.ExecResult) {
Cmd: (string) (len=27) "echo \"close the file .....\"",
Code: (int) 0,
Output: (string) (len=20) "close the file .....",
ErrMsg: (string) ""
}
. ok
Recovered from: ERROR: Failed And Not Ignored! [You may want to continue and ignore the error]
WARN: [Not rescued in task level] - [please assess the panic problem and cause, fix it before re-run the task]
task finally -> ERROR: Failed And Not Ignored! [You may want to continue and ignore the error]
-----trace for reference-----
Logs with different verbose level
References