Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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