dvars in call
Demo dvars merge in local scope in execution time
Note
Demo
source
Main task yaml file
TODO:
- not clear if dvar in calleed should be overriden as well??
- need a review on this later on
scopes:
- name: global
vars:
student:
name: Tom
gender: Male
address:
suburb:
name: sydney
postcode: 2000
CBD: yes
school: Sydney Grammar
- name: nonprod
members:
- dev
- staging
vars:
a: non-prod-a
b: non-prod-b
c: non-prod-c
d: non-prod-d
dvars:
- name: school
value: |
address:
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: yes
school: {{.student.address.school}}
flags: [toObj]
- name: dev
tasks:
- name: task
task:
- func: call
vars:
a: local-a
b: local-b
dvars:
- name: school
value: |
address:
state: NSW
city: sydney
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: LOCAL
school: {{.student.address.school}}
principal: Mr Right
flags: [toObj]
do:
- show_school_details
- name: show_school_details
task:
- func: shell
vars:
a: show-school-details-a
b: show-school-details-b
dvars:
- name: class_room
value: 3K
- name: school
value: |
address:
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: no
school: {{.student.address.school}}
principal: Mr Peter
something: ref task does not have this field
flags: [toObj]
do:
- echo """1.school -> {{.school}}"""
- echo """2.school object CBD -> {{.school_object.address.suburb.CBD}}"""
- echo """3.school object-> {{.school_object.address.school}}"""
- echo """4.school object-> {{.school_object.principal}}"""
- echo """5.a {{.a}}"""
- echo """6.b {{.b}}"""
- echo """7.school object-> {{.school_object|printObj}}"""
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 -> c0034
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/c0034
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0,
"a": "local-a",
"b": "local-b",
"c": "non-prod-c",
"d": "non-prod-d",
"school": "address:\n state: NSW\n city: sydney\n suburb:\n name: sydney\n postcode: 2000\n CBD: LOCAL\n school: Sydney Grammar\nprincipal: Mr Right\n",
"school_object": {
"address": {
"school": "Sydney Grammar",
"state": "NSW",
"city": "sydney",
"suburb": {
"CBD": "LOCAL",
"name": "sydney",
"postcode": 2000
}
},
"principal": "Mr Right"
},
"student": {
"name": "Tom",
"gender": "Male",
"address": {
"school": "Sydney Grammar",
"suburb": {
"CBD": true,
"name": "sydney",
"postcode": 2000
}
}
}
})
=Task2: [task ==> show_school_details: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"d": "non-prod-d",
"school_object": {
"address": {
"school": "Sydney Grammar",
"state": "NSW",
"city": "sydney",
"suburb": {
"CBD": false,
"name": "sydney",
"postcode": 2000
}
},
"principal": "Mr Peter",
"something": "ref task does not have this field"
},
"school": "address:\n suburb:\n name: sydney\n postcode: 2000\n CBD: no\n school: Sydney Grammar\nprincipal: Mr Peter\nsomething: ref task does not have this field\n",
"student": {
"name": "Tom",
"gender": "Male",
"address": {
"school": "Sydney Grammar",
"suburb": {
"postcode": 2000,
"CBD": true,
"name": "sydney"
}
}
},
"class_room": "3K",
"b": "local-b",
"up_runtime_task_layer_number": 1,
"c": "non-prod-c",
"a": "local-a"
})
cmd( 1):
echo """1.school -> {{.school}}"""
-
1.school -> address:
suburb:
name: sydney
postcode: 2000
CBD: no
school: Sydney Grammar
principal: Mr Peter
something: ref task does not have this field
-
.. ok
cmd( 2):
echo """2.school object CBD -> {{.school_object.address.suburb.CBD}}"""
-
2.school object CBD -> false
-
.. ok
cmd( 3):
echo """3.school object-> {{.school_object.address.school}}"""
-
3.school object-> Sydney Grammar
-
.. ok
cmd( 4):
echo """4.school object-> {{.school_object.principal}}"""
-
4.school object-> Mr Peter
-
.. ok
cmd( 5):
echo """5.a {{.a}}"""
-
5.a local-a
-
.. ok
cmd( 6):
echo """6.b {{.b}}"""
-
6.b local-b
-
.. ok
cmd( 7):
echo """7.school object-> {{.school_object|printObj}}"""
{
"something": "ref task does not have this field",
"address": {
"suburb": {
"CBD": false,
"name": "sydney",
"postcode": 2000
},
"school": "Sydney Grammar",
"state": "NSW",
"city": "sydney"
},
"principal": "Mr Peter"
}
{
"something": "ref task does not have this field",
"address": {
"state": "NSW",
"city": "sydney",
"suburb": {
"name": "sydney",
"postcode": 2000,
"CBD": false
},
"school": "Sydney Grammar"
},
"principal": "Mr Peter"
}
-
7.school object-> {
something: ref task does not have this field,
address: {
state: NSW,
city: sydney,
suburb: {
CBD: false,
name: sydney,
postcode: 2000
},
school: Sydney Grammar
},
principal: Mr Peter
}
-
.. ok
. ok
Logs with different verbose level
Raw logs with different verbose level