-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathapp.yaml
185 lines (152 loc) · 6.47 KB
/
app.yaml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
bases:
- base1.yaml
jinja2-macros:
helloWorld: |
{%- macro helloWorld(msg) -%}
Hello world msg = {{msg}}
{%- endmacro -%}
variables:
myVar1: "test"
cicd-contexts:
stage:
channel: stage
pipelines:
build:
#
# Example of "generators" for --generate
#
generators:
# here is a "generator" named "dockerfile"
dockerfile:
# here is one generatorConfig named "alpine"
alpine:
# our optional condition that if yields non-blank
# will cause all K/Vs in 'set' to be written into
# cicdContextData
if: "{%- if 'alpine' in state.gitTag -%}true{%- endif -%}"
set:
- key: "state.build.dockerfileInfo.targetImageName"
value: "{{state.gitAppName}}"
- key: "state.build.dockerfileInfo.generateDockerfileCmd"
value: |
./gendockerfile.sh -f alpine:latest -x {{state.gitTag}} -z {{ctx.var1}} -q {{ctx.var2}}
# here is one generatorConfig named "centos"
centos:
# our optional condition that if yields non-blank
# will cause all K/Vs in 'set' to be written into
# cicdContextData
if: "{%- if 'centos' in state.gitTag -%}true{%- endif -%}"
set:
- key: "state.build.dockerfileInfo.targetImageName"
value: "{{state.gitAppName}}"
- key: "state.build.dockerfileInfo.generateDockerfileCmd"
value: |
./gendockerfile.sh -f centos:latest -x {{state.gitTag}} -z {{ctx.var1}} -q {{ctx.var2}}
event-handlers:
testEvent:
notify:
message: |
{{ basicMacro('testEventFired!!! yes...') }}
testNotifyEvent:
notify:
message: |
{{ basicMacro('build is successful') }}
capture-response-data:
- from: "{{ body.data.channel }}"
to: state.lastPostedToNotifyChannel
- from: "{{ body|tojson }}"
to: state.lastPostedHttpResponse
testRespondEvent:
respond:
someArbitraryKey: "lastPostedDataRandomId={{ state.lastPostedDataRandomId }}"
if: "{{ state.lastPostedHttpResponse }}"
url: "{{ (state.lastPostedHttpResponse|from_json).url }}"
message: |
dummy responder message for {{ state.lastPostedDataRandomId }}
testSetValuesEvent:
set-values:
extractLastPostedNotifyMessage:
if: |
{%- if state.lastPostedHttpResponse -%}
1
{%- endif -%}
set:
- from: |
{%- set lastPostedHttpResponse = (state.lastPostedHttpResponse|from_json) -%}
{{- lastPostedHttpResponse.data.message -}}
to: "state.lastPostedNotifyMessage"
testTriggerPipelineEvent:
# see config.yaml for additional headers
# and auto-args that will supplement what is
# specified here
trigger-pipeline:
name: build
args:
whatever: "{{state.postedData[state.lastPostedDataRandomId].headers.userAgent}}"
testManualChoiceEvent:
manual-choice:
title: |
{{ basicMacro('here are my choices') }}
choices:
choiceGroup1:
header: "Choice group one:"
options:
- text: "Choice 1"
value: "c1"
- text: "Choice 2"
value: "c2"
choiceGroup2:
header: "Choice group two {{ echo('blah') }}:"
options:
- text: "{{state.postedData[state.lastPostedDataRandomId].headers.userAgent}}"
value: "{{state.postedData[state.lastPostedDataRandomId].headers.userAgent}}"
testEmbeddedJsonEvent:
notify:
message: |
Here is some JSON from c:\windowspath\test and "quotes" { "dog":"beagle" }
# example of disabling something inheriterd from a base
test:
event-handlers:
another-event:
notify:
enabled: False
# example for manual choice generators
test2:
event-handlers:
blah-event:
manual-choice:
title: "test manual choice with choice-generators"
capture-response-data:
- from: "{{ body|json_dumps }}"
to: state.lastPostedHttpResponseFromManualChoice
choice-generators:
testGenerator1:
# The cicdContextData JsonPath that should yield a dictionary
# This can also OPTIONALLY be a jinja2 template that will be parsed to
# render the jsonPath expression that will then be used to find
# the foreach dictionary that will be iterated over
foreach: 'state.choiceGeneratorItems'
# the name that each key within the yielded `foreach` can be
# referenced as within the template below
iterator: 'currentItem'
# the template, which will render out one or more "choices"
# that will be appended to the overall list of manual-choice.choices
template: >
testkey-{{currentItem.name}}:
header: |
{{'{{'}} echo('{{currentItem.name}}') {{'}}'}}
options:
- style: primary
value: "{{'{{'}} echo('{{currentItem.name}} {{currentItem.description}}') {{'}}'}}"
text: '{{currentItem.name}}'
- style: primary
value: "{{'{{'}} echo('{{currentItem.name}} {{currentItem.description}}') {{'}}'}}"
text: '{{currentItem.name}}'
choices:
choiceGroup1:
header: "Choice group one:"
options:
- text: "Choice 1"
value: "c1"
- text: "Choice 2"
value: "c2"