Skip to content

Commit

Permalink
Merge remote-tracking branch 'thedyrt/pr/4'
Browse files Browse the repository at this point in the history
thedyrt#4

* thedyrt/pr/4:
  Fix tests and add example
  Better glob syntax according to shellcheck
  Clean build directory so old artifacts don't get picked up
  • Loading branch information
jasoncodes committed Sep 4, 2022
2 parents f87417f + 1424d0d commit 5fbb6b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hooks/checkout
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
set -euo pipefail

echo "--- Skipping checkout"
echo "Removing any old artifacts"
rm -rf ./*
11 changes: 11 additions & 0 deletions tests/checkout.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ post_checkout_hook="$PWD/hooks/post-checkout"
assert_output --partial "Skipping checkout"
}

@test "Removes old artifacts {
export BUILDKITE_BUILD_CHECKOUT_PATH=$tmp_dir
cd "$BUILDKITE_BUILD_CHECKOUT_PATH"
touch some_old_artifact
run "$checkout_hook"
assert_success
refute [ -f some_old_artifact ]
}
@test "Updates checkout directory when 'cd' is given" {
export BUILDKITE_BUILD_CHECKOUT_PATH=$tmp_dir
export BUILDKITE_PLUGIN_SKIP_CHECKOUT_CD="/var"
Expand Down

0 comments on commit 5fbb6b5

Please sign in to comment.