@@ -25,7 +25,7 @@ export annotation_input="tests/tmp/annotation.input"
25
25
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
26
26
27
27
stub docker \
28
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
28
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
29
29
30
30
run " $PWD /hooks/command"
31
31
@@ -53,7 +53,7 @@ export annotation_input="tests/tmp/annotation.input"
53
53
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
54
54
55
55
stub docker \
56
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
56
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
57
57
58
58
run " $PWD /hooks/command"
59
59
@@ -80,7 +80,7 @@ export annotation_input="tests/tmp/annotation.input"
80
80
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
81
81
82
82
stub docker \
83
- " --log-level error run --rm --volume \* --volume \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
83
+ " --log-level error run --rm --volume \* --volume \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
84
84
85
85
run " $PWD /hooks/command"
86
86
@@ -107,7 +107,7 @@ export annotation_input="tests/tmp/annotation.input"
107
107
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
108
108
109
109
stub docker \
110
- " --log-level error run --rm --volume \* --volume \* --env \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
110
+ " --log-level error run --rm --volume \* --volume \* --env \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
111
111
112
112
run " $PWD /hooks/command"
113
113
@@ -132,7 +132,7 @@ export annotation_input="tests/tmp/annotation.input"
132
132
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
133
133
134
134
stub docker \
135
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
135
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
136
136
137
137
run " $PWD /hooks/command"
138
138
@@ -156,7 +156,7 @@ export annotation_input="tests/tmp/annotation.input"
156
156
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
157
157
158
158
stub docker \
159
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
159
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
160
160
161
161
run " $PWD /hooks/command"
162
162
@@ -195,7 +195,7 @@ export annotation_input="tests/tmp/annotation.input"
195
195
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
196
196
197
197
stub docker \
198
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
198
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
199
199
200
200
run " $PWD /hooks/command"
201
201
@@ -227,7 +227,7 @@ export annotation_input="tests/tmp/annotation.input"
227
227
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
228
228
229
229
stub docker \
230
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
230
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
231
231
232
232
run " $PWD /hooks/command"
233
233
@@ -257,7 +257,7 @@ export annotation_input="tests/tmp/annotation.input"
257
257
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
258
258
259
259
stub docker \
260
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
260
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
261
261
262
262
run " $PWD /hooks/command"
263
263
@@ -286,7 +286,7 @@ export annotation_input="tests/tmp/annotation.input"
286
286
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
287
287
288
288
stub docker \
289
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
289
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
290
290
291
291
run " $PWD /hooks/command"
292
292
@@ -312,7 +312,7 @@ export annotation_input="tests/tmp/annotation.input"
312
312
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
313
313
314
314
stub docker \
315
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 147"
315
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 147"
316
316
317
317
run " $PWD /hooks/command"
318
318
@@ -359,7 +359,7 @@ export annotation_input="tests/tmp/annotation.input"
359
359
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
360
360
361
361
stub docker \
362
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
362
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
363
363
364
364
run " $PWD /hooks/command"
365
365
@@ -385,7 +385,7 @@ export annotation_input="tests/tmp/annotation.input"
385
385
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
386
386
387
387
stub docker \
388
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo 'Total tests: 100'"
388
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 100'"
389
389
390
390
run " $PWD /hooks/command"
391
391
@@ -411,7 +411,7 @@ export annotation_input="tests/tmp/annotation.input"
411
411
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
412
412
413
413
stub docker \
414
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
414
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
415
415
416
416
run " $PWD /hooks/command"
417
417
@@ -421,4 +421,32 @@ export annotation_input="tests/tmp/annotation.input"
421
421
unstub mktemp
422
422
unstub buildkite-agent
423
423
unstub docker
424
+ }
425
+
426
+ @test " runs the annotator and creates the annotation with special image" {
427
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
428
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_RUBY_IMAGE=" ruby:special"
429
+
430
+ stub mktemp \
431
+ " -d \* : mkdir -p '$artifacts_tmp '; echo '$artifacts_tmp '" \
432
+ " -d \* : mkdir -p '$annotation_tmp '; echo '$annotation_tmp '"
433
+
434
+ stub buildkite-agent \
435
+ " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" \
436
+ " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
437
+
438
+ stub docker \
439
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:special ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
440
+
441
+ run " $PWD /hooks/command"
442
+
443
+ assert_success
444
+
445
+ assert_output --partial " Annotation added with context junit and style error"
446
+ assert_equal " $( cat " ${annotation_input} " ) " ' <details>Failure</details>'
447
+
448
+ unstub mktemp
449
+ unstub buildkite-agent
450
+ unstub docker
451
+ rm " ${annotation_input} "
424
452
}
0 commit comments