shell
This commit is contained in:
parent
ef4117f870
commit
12e76518e2
2 changed files with 27 additions and 1 deletions
|
@ -1,2 +1,2 @@
|
|||
REM TODO: use powershell shell for hooks directly
|
||||
powershell c:\scripts\pre-checkout.ps1
|
||||
bash c:\scripts\pre-checkout.sh
|
26
containers/buildkite-windows/pre-checkout.sh
Normal file
26
containers/buildkite-windows/pre-checkout.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#/usr/bin/env bash
|
||||
|
||||
echo "BUILDKITE_BUILD_CHECKOUT_PATH: $BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
echo "BUILDKITE_BUILD_PATH: $BUILDKITE_BUILD_PATH"
|
||||
echo "unlocking git"
|
||||
pkill -f git.exe
|
||||
rm -f "$BUILDKITE_BUILD_CHECKOUT_PATH/.git/index.lock"
|
||||
echo 'running processes (before)'
|
||||
ps aux | grep "$BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
echo "unlocking $BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
handle -nobanner "$BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
powershell /c/scripts/unlock_path.ps1 "$BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
echo 'running processes (after)'
|
||||
ps aux | grep "$BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
|
||||
echo "BUILDKITE_REPO: $BUILDKITE_REPO"
|
||||
if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then
|
||||
cd "$BUILDKITE_BUILD_CHECKOUT_PATH" || exit
|
||||
remoteUrl=$(git remote get-url origin)
|
||||
echo "current remote URL: $remoteUrl"
|
||||
if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then
|
||||
echo "Remote URL does not match. Deleting and recreating the directory."
|
||||
cd /c/
|
||||
rm -rf "$BUILDKITE_BUILD_CHECKOUT_PATH"
|
||||
fi
|
||||
fi
|
Loading…
Reference in a new issue