-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0049.yml
75 lines (65 loc) · 1.87 KB
/
c0049.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
doc_meta: |
folder: env-vars
title: env vars in scopes
head: |
This showcases:
* The env var using dvar will be just like other dvar working in scopes
This makes the environment variables' management very elegant and tidy. Not only you could use dvar to manage dynamic properties, but also you could manage environment variable the same way and a set of env vars could be put into a profile for an environment context. This is important nowadays for CD/CI and integration automation with build tools as envionrment variables are normally the client facing to these tools, such as GoCD, Jenkins, Gitlab CI etc.
sections:
- title: Demo
log: yes
notes:
goal:
- test the shell env var behaves the save that it could override in scopes
results: |
executing shell commands
cmd( 1):
env |grep STUDENT_NAME
STUDENT_NAME=Tom Hanks
cmd( 2):
env |grep STUDENT_AGE
STUDENT_AGE=18
step( 2):
executing shell commands
cmd( 1):
env |grep STUDENT_NAME
STUDENT_NAME=James Bond
cmd( 2):
env |grep STUDENT_AGE
STUDENT_AGE=18
cmd( 3):
env |grep SCHOOL
SCHOOL=James Rules
scopes:
- name: global
dvars:
- name: SCHOOL
value: James Rules
flags: [envVar]
dvars:
- name: STUDENT_NAME
value: James Bond
flags: [envVar]
- name: STUDENT_AGE
value: "18"
flags: [envVar]
tasks:
-
name: task
task:
- func: shell
dvars:
- name: STUDENT_NAME
value: Tom Hanks
flags: [envVar]
do:
- env |grep STUDENT_NAME
- env |grep STUDENT_AGE
- func: shell
desc: |
since there is no local envVar for STUDENT_NAME
it should use global envVar value 'james bond'
do:
- env |grep STUDENT_NAME
- env |grep STUDENT_AGE
- env |grep SCHOOL