-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0009.yml
95 lines (78 loc) · 2.35 KB
/
c0009.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
doc_meta: |
folder: scope
title: externalize settings
head: |
This demos how to externalize the lengthy vars configuration to a reference file, load it during the runtime
sections:
- title: Why
content: |
It is ok to just put the a few vars configuration entries together in paralelle with tasks in one yml file. With project growing, we offten need to make the code tidy, clean and modulized. In our case, it refers to yml configurations. It will significantlly reduce the line of codes before you could have a quick glimpse of skeleton of the tasks
In this demo, we show that the global vars all go to the referece yml file in refdir. The refdir could be a global configurable settting apply to all
- title: Application
content: |
You could configure the group relationship in scope element and offload the details to separate files
For example: You could use follow directory structure to manage your vars:
```
scope:\
global.yml -> store all global vars
prod:\ -> prod group
dr:\
dr.yml
prod:\
prod.yml
db.yml
nonprod:\ -> nonprod group
dev:\
dev.yml -> dev settings
st:\
st.yml
staging:\
staging.yml
db.yml -> common db setttings for all nonprod group
```
- title: d0009-global.yml reference
filelookup: d0009-global.yml
- title: d0009-dev.yml reference
filelookup: d0009-dev.yml
- title: Demo
log: yes
notes:
goal:
- to test out vars reference in yml file
- refdir in scope itme can not be dynamic value as the scope is very fundamental
scopes:
-
name: global
ref: d0009-global.yml
refdir: ./tests/functests
-
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
ref: d0009-dev.yml
tasks:
-
name: task
task:
-
func: shell
do:
- echo "test out the var scopes only"