Skip to content

Commit 60eb175

Browse files
authored
Merge pull request #148 from JanSF/main
fix: Have download:false respect binary_folder
2 parents a43ecfe + 8b6fc7d commit 60eb175

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,19 +449,19 @@ steps:
449449
wait: true
450450
```
451451

452-
### `download_folder` (optional)
452+
### `binary_folder` (optional)
453453

454454
Default: `BUILDKITE_PLUGINS_PATH`
455455

456-
This is the filesystem folder where the Go binary will be download to.
456+
This is the filesystem folder where the Go binary will be kept.
457457

458458
## Example
459459
```yaml
460460
steps:
461461
- label: "Triggering pipelines"
462462
plugins:
463463
- monorepo-diff#v1.8.0:
464-
download_folder: "/var/buildkite-agent"
464+
binary_folder: "/var/buildkite-agent"
465465
watch:
466466
- path: "bar-service/"
467467
config:

hooks/command

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ err() {
1717
exit 1
1818
}
1919

20-
executable_dir="${BUILDKITE_PLUGIN_MONOREPO_DIFF_DOWNLOAD_FOLDER:-${BUILDKITE_PLUGINS_PATH}}"
20+
executable_dir="${BUILDKITE_PLUGIN_MONOREPO_DIFF_BINARY_FOLDER:-${BUILDKITE_PLUGINS_PATH}}"
2121

2222
# Default to current directory if not set
2323
if [[ -z "${executable_dir}" || ${BUILDKITE_PLUGIN_MONOREPO_DIFF_BUILDKITE_PLUGIN_TEST_MODE:-false} == "true" ]]; then
@@ -34,7 +34,7 @@ if [[ ! -w "${executable_dir}" ]]; then
3434
err "Directory not writable: ${executable_dir}"
3535
fi
3636

37-
executable="${executable_dir}/monorepo-diff-buildkite-plugin"
37+
executable="${executable_dir%/}/monorepo-diff-buildkite-plugin"
3838
executable_version_file="${executable}.version"
3939

4040
check_cmd() {
@@ -202,10 +202,13 @@ download_binary_and_run() {
202202
}
203203

204204
run_preinstalled_binary() {
205-
local _executable="monorepo-diff-buildkite-plugin"
205+
local _executable="${executable}"
206206

207-
if ! check_cmd "$_executable"; then
208-
err "Binary '$_executable' not found in PATH. Please install it or set download: true"
207+
if ! check_cmd "${_executable}"; then
208+
_executable="$(basename "${executable}")"
209+
if ! check_cmd "${_executable}"; then
210+
err "Binary '$_executable' not found in PATH or binary_folder option. Please install it or set download: true"
211+
fi
209212
fi
210213

211214
${_executable} "$@"

plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ configuration:
1515
type: boolean
1616
env:
1717
type: array
18-
download_folder:
18+
binary_folder:
1919
type: string
2020
notify:
2121
type: [array]

0 commit comments

Comments
 (0)