-
Notifications
You must be signed in to change notification settings - Fork 5
/
input.groovy
53 lines (46 loc) · 948 Bytes
/
input.groovy
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
def get_team(json) {
def namespace = []
json.each { k,v ->
namespace += k
}
return namespace.join('\n')
}
def get_project(json, team) {
def projects = []
json[team].each { k,v ->
projects += k
}
return projects.join('\n')
}
def get_env(json, team, project) {
envs = []
json[team][project].each { node ->
envs += node
}
return envs.join('\n')
}
def validate_team(json, team) {
def namespace = []
json.each { k,v ->
namespace += k
}
return namespace.contains(team)
}
def validate_project(json, team, project) {
def projects = []
json[team].each { k,v ->
projects += k
}
return projects.contains(project)
}
def validate_env(json, team, project, env) {
envs = []
json[team][project].each { node ->
envs += node
}
return envs.contains(env)
}
def bash_escape(string) {
return string.replaceAll(/([\|\!\"\#\$\&\'\(\)\*\;\<\>\?\[\]\^\\\`\{\}\~\ ])/, '\\\\$1')
}
return this;