Skip to content

Commit a98ac66

Browse files
authored
Merge pull request #3 from buildkite-plugins/bm/bash_compat
🤡 Ensure it works on old Bash
2 parents cebcfd9 + 19f3139 commit a98ac66

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ steps:
4141
command: |
4242
bazel build //... --build_event_json_file=bazel-events.json
4343
plugins:
44-
- bazel-annotate#v0.1.0:
44+
- bazel-annotate#v0.1.1:
4545
bep_file: bazel-events.json
4646
```
4747
@@ -55,7 +55,7 @@ steps:
5555
# Command might not produce a BEP file
5656
bazel build //...
5757
plugins:
58-
- bazel-annotate#v0.1.0:
58+
- bazel-annotate#v0.1.1:
5959
skip_if_no_bep: true
6060
```
6161
@@ -69,7 +69,7 @@ steps:
6969
command: |
7070
bazel test //... --build_event_json_file=bazel-test-events.json
7171
plugins:
72-
- bazel-annotate#v0.1.0:
72+
- bazel-annotate#v0.1.1:
7373
bep_file: bazel-test-events.json
7474
```
7575
@@ -82,7 +82,7 @@ steps:
8282
cd my-workspace
8383
bazel build //... --build_event_json_file=bazel-events.json
8484
plugins:
85-
- bazel-annotate#v0.1.0:
85+
- bazel-annotate#v0.1.1:
8686
bep_file: my-workspace/bazel-events.json
8787
```
8888
@@ -94,21 +94,21 @@ steps:
9494
command: |
9595
bazel build //... --build_event_json_file=bazel-build-events.json
9696
plugins:
97-
- bazel-annotate#v0.1.0:
97+
- bazel-annotate#v0.1.1:
9898
bep_file: bazel-build-events.json
9999

100100
- label: "🧪 Test with Bazel"
101101
command: |
102102
bazel test //... --build_event_json_file=bazel-test-events.json
103103
plugins:
104-
- bazel-annotate#v0.1.0:
104+
- bazel-annotate#v0.1.1:
105105
bep_file: bazel-test-events.json
106106

107107
- label: "📦 Package with Bazel"
108108
command: |
109109
bazel run //:package --build_event_json_file=bazel-package-events.json
110110
plugins:
111-
- bazel-annotate#v0.1.0:
111+
- bazel-annotate#v0.1.1:
112112
bep_file: bazel-package-events.json
113113
```
114114

lib/bazel-bep.bash

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ process_bep() {
8383

8484
# Arrays for successful targets
8585
declare -a successful_targets=()
86+
declare -a successful_targets_sorted=()
8687

8788
# Arrays for test performance tracking
8889
declare -a slowest_tests=()
@@ -364,8 +365,9 @@ process_bep() {
364365
365366
"
366367

367-
# Sort the targets for better readability
368-
readarray -t successful_targets_sorted < <(printf '%s\n' "${successful_targets[@]}" | sort)
368+
if [ ${#successful_targets[@]} -gt 0 ]; then
369+
mapfile -t successful_targets_sorted < <(printf '%s\n' "${successful_targets[@]}" | sort)
370+
fi
369371

370372
# Show all targets
371373
for target in "${successful_targets_sorted[@]}"; do

0 commit comments

Comments
 (0)