Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows long path enable in CICD #3819

Merged
merged 3 commits into from
Jan 30, 2025
Merged
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
29 changes: 25 additions & 4 deletions _ci/install-golang.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,31 @@ choco install golang --version 1.23.1 -y
Get-Command go
go version

# Configure long paths
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
try {
# Enable Developer Mode
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
# Enable long paths in Git configuration
Write-Output "Enabling long paths in Git..."
git config --system core.longpaths true
git config --global core.longpaths true
git config --local core.longpaths true

# Enable long paths in Windows Registry
Write-Output "Enabling long paths in Windows Registry..."
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem"
Set-ItemProperty -Path $regPath -Name "LongPathsEnabled" -Value 1 -Type DWord

git config --system core.longpaths true
$longPathsEnabled = Get-ItemProperty -Path $regPath -Name "LongPathsEnabled"
$gitConfig = git config --system --get core.longpaths

if ($longPathsEnabled.LongPathsEnabled -eq 1 -and $gitConfig -eq "true") {
Write-Output "Successfully enabled long paths support"
exit 0
} else {
Write-Error "Failed to verify changes"
exit 1
}
} catch {
Write-Error "An error occurred: $_"
exit 1
}