1
0
Fork 0

deletion of ws\src if it does not match remote

This commit is contained in:
Mikhail Goncharov 2023-08-28 16:54:52 +00:00
parent 9ee7fac437
commit ef4117f870
2 changed files with 6 additions and 6 deletions

View file

@ -1,10 +1,9 @@
$env:BUILDKITE_BUILD_CHECKOUT_PATH="$env:BUILDKITE_BUILD_PATH/src"
# $env:BUILDKITE_BUILD_CHECKOUT_PATH="$env:BUILDKITE_BUILD_PATH/src"
echo "BUILDKITE_BUILD_CHECKOUT_PATH: $env:BUILDKITE_BUILD_CHECKOUT_PATH"
echo "BUILDKITE_BUILD_PATH: $env:BUILDKITE_BUILD_PATH"
echo "unlocking git"
taskkill /F /IM git.exe
rm -Force "$env:BUILDKITE_BUILD_CHECKOUT_PATH/.git/index.lock"
echo "BUILDKITE_BUILD_CHECKOUT_PATH: $env:BUILDKITE_BUILD_CHECKOUT_PATH"
echo "BUILDKITE_BUILD_PATH: $env:BUILDKITE_BUILD_PATH"
echo 'running processes (before)'
Get-Process | Where-Object {$_.Path -like "$env:BUILDKITE_BUILD_CHECKOUT_PATH*"} | Select-Object -ExpandProperty Path
echo "unlocking $env:BUILDKITE_BUILD_CHECKOUT_PATH"
@ -20,8 +19,8 @@ if (Test-Path -Path $env:BUILDKITE_BUILD_CHECKOUT_PATH) {
echo "current remote URL: $remoteUrl"
if ($remoteUrl -ne $env:BUILDKITE_REPO) {
Write-Host "Remote URL does not match. Deleting and recreating the directory."
Set-Location -Path "C:\"
Remove-Item -Path $env:BUILDKITE_BUILD_CHECKOUT_PATH -Recurse -Force
Set-Location -Path "c:\"
Remove-Item -Recurse -Force -ErrorAction Ignore $env:BUILDKITE_BUILD_CHECKOUT_PATH
}
}

View file

@ -1,6 +1,7 @@
git clone https://github.com/google/llvm-premerge-checks.git c:\llvm-premerge-checks
New-Item c:\ws -Force -ItemType Directory
$env:BUILDKITE_BUILD_PATH = "c:\ws"
$env:BUILDKITE_BUILD_CHECKOUT_PATH = "c:\ws\src"
# Install Buildkite agent.
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/buildkite/agent/master/install.ps1'))