File tree 4 files changed +10
-2
lines changed
4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ If this setting is true and any errors are found in the JUnit XML files during
51
51
parsing, the annotation step will exit with a non-zero value, which should cause
52
52
the build to fail.
53
53
54
+ # ## `context` (optional)
55
+ Default : ` junit`
56
+
57
+ The buildkite annotation context to use. Useful to differentiate multiple runs of this plugin in a single pipeline.
58
+
54
59
# # Developing
55
60
56
61
To test the plugin hooks (in Bash) and the junit parser (in Ruby) :
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ if grep -q "<details>" "$annotation_path"; then
53
53
54
54
echo " --- :buildkite: Creating annotation"
55
55
# shellcheck disable=SC2002
56
- cat " $annotation_path " | buildkite-agent annotate --context junit --style error
56
+ cat " $annotation_path " | buildkite-agent annotate --context ${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_CONTEXT :- junit} --style error
57
57
58
58
if [[ " ${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAIL_BUILD_ON_ERROR:- false} " =~ (true| on| 1) ]]
59
59
then
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ configuration:
16
16
- file
17
17
fail-build-on-error :
18
18
type : boolean
19
+ context :
20
+ type : string
19
21
required :
20
22
- artifacts
21
23
additionalProperties : false
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ load "$BATS_PATH/load.bash"
65
65
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN=" custom_(*)_pattern.xml"
66
66
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT=" file"
67
67
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAIL_BUILD_ON_ERROR=false
68
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_CONTEXT=" junit_custom_context"
68
69
69
70
artifacts_tmp=" tests/tmp/$PWD /junit-artifacts"
70
71
annotation_tmp=" tests/tmp/$PWD /junit-annotation"
@@ -74,7 +75,7 @@ load "$BATS_PATH/load.bash"
74
75
" -d junit-annotate-plugin-annotation-tmp.XXXXXXXXXX : mkdir -p $annotation_tmp ; echo $annotation_tmp "
75
76
76
77
stub buildkite-agent " artifact download junits/*.xml /plugin/tests/tmp//plugin/junit-artifacts : echo Downloaded artifacts" \
77
- " annotate --context junit --style error : echo Annotation added"
78
+ " annotate --context junit_custom_context --style error : echo Annotation added"
78
79
79
80
stub docker " --log-level error run --rm --volume /plugin/tests/tmp//plugin/junit-artifacts:/junits --volume /plugin/hooks/../ruby:/src --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' ruby:2.5-alpine /src/bin/annotate /junits : echo '<details>Failure</details>'"
80
81
You can’t perform that action at this time.
0 commit comments