@@ -82,7 +82,7 @@ end_phase() {
82
82
phase=$( tail -n 1 " ${SCALETEST_PHASE_FILE} " | grep " START:${phase_num} :" | cut -d' ' -f3-)
83
83
if [[ -z ${phase} ]]; then
84
84
log " BUG: Could not find start phase ${phase_num} in ${SCALETEST_PHASE_FILE} "
85
- exit 1
85
+ return 1
86
86
fi
87
87
log " End phase ${phase_num} : ${phase} "
88
88
echo " $( date -Ins) END:${phase_num} : ${phase} " >> " ${SCALETEST_PHASE_FILE} "
@@ -132,6 +132,7 @@ annotate_grafana() {
132
132
' {time: $time, tags: $tags | split(","), text: $text}' <<< ' {}'
133
133
) "
134
134
if [[ ${DRY_RUN} == 1 ]]; then
135
+ echo " FAKEID:${tags} :${text} :${start} " >> " ${SCALETEST_STATE_DIR} /grafana-annotations"
135
136
log " Would have annotated Grafana, data=${json} "
136
137
return 0
137
138
fi
@@ -171,23 +172,18 @@ annotate_grafana_end() {
171
172
tags=" ${tags} ,${GRAFANA_EXTRA_TAGS} "
172
173
fi
173
174
174
- if [[ ${DRY_RUN} == 1 ]]; then
175
- log " Would have updated Grafana annotation (end=${end} ): ${text} [${tags} ]"
176
- return 0
177
- fi
178
-
179
175
if ! id=$( grep " :${tags} :${text} :${start} " " ${SCALETEST_STATE_DIR} /grafana-annotations" | sort -n | tail -n1 | cut -d: -f1) ; then
180
176
log " NOTICE: Could not find Grafana annotation to end: '${tags} :${text} :${start} ', skipping..."
181
177
return 0
182
178
fi
183
179
184
- log " Annotating Grafana (end=${end} ): ${text} [${tags} ]"
180
+ log " Updating Grafana annotation (end=${end} ): ${text} [${tags} , add= ${GRAFANA_ADD_TAGS :- } ]"
185
181
186
182
if [[ -n ${GRAFANA_ADD_TAGS:- } ]]; then
187
183
json=" $(
188
184
jq -n \
189
185
--argjson timeEnd " ${end} " \
190
- --argjson tags " ${tags} ,${GRAFANA_ADD_TAGS} " \
186
+ --arg tags " ${tags} ,${GRAFANA_ADD_TAGS} " \
191
187
' {timeEnd: $timeEnd, tags: $tags | split(",")}'
192
188
) "
193
189
else
@@ -275,7 +271,7 @@ coder_pods() {
275
271
fetch_coder_full () {
276
272
if [[ -x " ${SCALETEST_CODER_BINARY} " ]]; then
277
273
log " Full Coder binary already exists at ${SCALETEST_CODER_BINARY} "
278
- return
274
+ return 0
279
275
fi
280
276
ns=$( namespace)
281
277
if [[ -z " ${ns} " ]]; then
@@ -286,12 +282,12 @@ fetch_coder_full() {
286
282
pods=$( coder_pods)
287
283
if [[ -z ${pods} ]]; then
288
284
log " Could not find coder pods!"
289
- return
285
+ return 1
290
286
fi
291
287
pod=$( cut -d ' ' -f 1 <<< " ${pods}" )
292
288
if [[ -z ${pod} ]]; then
293
289
log " Could not find coder pod!"
294
- return
290
+ return 1
295
291
fi
296
292
log " Fetching full Coder binary from ${pod} "
297
293
# We need --retries due to https://github.com/kubernetes/kubernetes/issues/60140 :(
@@ -309,8 +305,8 @@ fetch_coder_full() {
309
305
# com.coder.scaletest.status. It will overwrite the previous status.
310
306
set_pod_status_annotation () {
311
307
if [[ $# -ne 1 ]]; then
312
- log " must specify an annotation value"
313
- return
308
+ log " BUG: Must specify an annotation value"
309
+ return 1
314
310
else
315
311
maybedryrun " ${DRY_RUN} " kubectl --namespace " $( namespace) " annotate pod " $( hostname) " " com.coder.scaletest.status=$1 " --overwrite
316
312
fi
0 commit comments