Also you could have a global defined scope for common vars for all groups to inherit their vars to be the default from if not defined in that scope
So put it in simple example, if you have nonprod and prod group defined, then your runtime instance id (eg dev) belonging to a nonprod id will automatically inherit all vars definition from top to down, from vars defintion in global group, to nonprod group, then dev, then global runtime, during func execution runtime, they will merge with the local vars
run shell command: up ngo task -d ./tests/functests -t c0008.yml -i dev -v vvv –configdir=./tests/functests
An execution of UP cli cmd can take an instance id for execution, in this demo, it is dev as example, if you do not use any instance id, by default, your execution will inherit from global group, then global runtime, then local vars
scopes:
- name: global
vars:
a: global-a
b: global-b
c: global-c
d: global-d
- name: prod
members: [dr, prod]
vars:
a: prod-a
c: prod-c
- name: nonprod
members:
- dev
- st
- staging
vars:
a: non-prod-a
b: non-prod-b
c: non-prod-c
- name: staging
vars:
a: staging-a
b: staging-b
- name: dev
vars:
a: dev-a
c: dev-c
tasks:
- name: task
task:
- func: shell
do:
- echo "test out the var scopes only"
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0008
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/c0008
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"a": "dev-a",
"b": "non-prod-b",
"c": "dev-c",
"d": "global-d",
"up_runtime_task_layer_number": 0
})
cmd( 1):
echo "test out the var scopes only"
-
test out the var scopes only
-
.. ok
. ok
This demo will have an expected result of
overall final exec vars:
(*core.Cache)({
"a": "dev-a",
"b": "non-prod-b",
"c": "dev-c",
"d": "global-d"
})