@@ -25,7 +25,7 @@ export annotation_input="tests/tmp/annotation.input"
2525    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
2626
2727  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" 
2929
3030  run " $PWD /hooks/command" 
3131
@@ -53,7 +53,7 @@ export annotation_input="tests/tmp/annotation.input"
5353    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
5454
5555  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" 
5757
5858  run " $PWD /hooks/command" 
5959
@@ -80,7 +80,7 @@ export annotation_input="tests/tmp/annotation.input"
8080    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
8181
8282  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" 
8484
8585  run " $PWD /hooks/command" 
8686
@@ -107,7 +107,7 @@ export annotation_input="tests/tmp/annotation.input"
107107    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
108108
109109  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" 
111111
112112  run " $PWD /hooks/command" 
113113
@@ -132,7 +132,7 @@ export annotation_input="tests/tmp/annotation.input"
132132    " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" 
133133
134134  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'" 
136136
137137  run " $PWD /hooks/command" 
138138
@@ -156,7 +156,7 @@ export annotation_input="tests/tmp/annotation.input"
156156    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
157157
158158  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'" 
160160
161161  run " $PWD /hooks/command" 
162162
@@ -195,7 +195,7 @@ export annotation_input="tests/tmp/annotation.input"
195195    " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" 
196196
197197  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" 
199199
200200  run " $PWD /hooks/command" 
201201
@@ -227,7 +227,7 @@ export annotation_input="tests/tmp/annotation.input"
227227    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
228228
229229  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" 
231231
232232  run " $PWD /hooks/command" 
233233
@@ -257,7 +257,7 @@ export annotation_input="tests/tmp/annotation.input"
257257    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
258258
259259  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" 
261261
262262  run " $PWD /hooks/command" 
263263
@@ -286,7 +286,7 @@ export annotation_input="tests/tmp/annotation.input"
286286    " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" 
287287
288288  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" 
290290
291291  run " $PWD /hooks/command" 
292292
@@ -312,7 +312,7 @@ export annotation_input="tests/tmp/annotation.input"
312312    " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" 
313313
314314  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" 
316316
317317  run " $PWD /hooks/command" 
318318
@@ -359,7 +359,7 @@ export annotation_input="tests/tmp/annotation.input"
359359    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
360360
361361  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'" 
363363
364364  run " $PWD /hooks/command" 
365365
@@ -385,7 +385,7 @@ export annotation_input="tests/tmp/annotation.input"
385385    " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" 
386386
387387  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'" 
389389
390390  run " $PWD /hooks/command" 
391391
@@ -411,7 +411,7 @@ export annotation_input="tests/tmp/annotation.input"
411411    " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved" 
412412
413413  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" 
415415
416416  run " $PWD /hooks/command" 
417417
@@ -421,4 +421,32 @@ export annotation_input="tests/tmp/annotation.input"
421421  unstub mktemp
422422  unstub buildkite-agent
423423  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} " 
424452}
0 commit comments