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

Long path issues with Windows Base #15

Open
vx-daniel opened this issue Jan 29, 2025 · 1 comment
Open

Long path issues with Windows Base #15

vx-daniel opened this issue Jan 29, 2025 · 1 comment

Comments

@vx-daniel
Copy link

I am currently evaluating runs-on for my company (totally digging it!) and was ran into some issues with the Windows base and thought this quick fix could be integrated into the base build for others.

After some searching around I found this issue actions/checkout#1985 and a comment mentioned a registry fix resolved the issue. I was able to located this article and patched my runner with the following code but would be handy if the build included this in the future. Thank you!

Runner Config:

  build-windows:
    runs-on:
      - runs-on=${{ github.run_id }}
      - image=windows22-base-x64
      - family=m7i
      - cpu=4

build-windows log:

Run actions/checkout@v4
Syncing repository: [REDACTED] 
Getting Git version info
Deleting the contents of 'C:\actions-runner\_work\[REDACTED]\[REDACTED]'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\[REDACTED]\[REDACTED]\f3e1a7ee-7cef-40ff-87ab-[35](https://github.com/[REDACTED]/[REDACTED]/actions/runs/13022550513/job/36326025590#step:3:37)420a704e3e.zip' -DestinationPath 'C:\actions-runner\_work\[REDACTED]\[REDACTED]\f3e1a7ee-7cef-40ff-87ab-35420a704e3e' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\[REDACTED]\[REDACTED]\f3e1a7ee-7cef-40ff-87ab-35420a704e3e.zip', 'C:\actions-runner\_work\[REDACTED]\[REDACTED]\f3e1a7ee-7cef-40ff-87ab-35420a704e3e', $true) }"
Remove-Item : Cannot find path 'C:\actions-runner\_work\[REDACTED]\[REDACTED]\f3e1a7ee-7cef-40ff-87ab-35420a704e3e\[REDACTED]-[REDACTED]-eb82d685fe62c88c5ff4[37](https://github.com/[REDACTED]/[REDACTED]/actions/runs/13022550513/job/36326025590#step:3:39)2e2a600ba02a4b3bda\.editorconfig' because it does not exist.
At 
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:411 
char:46
+ ...                 $expandedItems | % { Remove-Item $_ -Force -Recurse }
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\actions-runn...a\.editorconfig:String) [Remove-Item], ItemNotFoundEx 
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
 
Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1

Patch:

      # Patch Windows to enable long paths in Windows 10 on RunsOn windows22-base-x64
      # https://github.com/actions/checkout/issues/1985#issuecomment-2489125043
      # https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell
      - name: Patch - Enable long paths in Windows 10 
        shell: powershell
        run: | 
          New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force;
@crohr
Copy link
Contributor

crohr commented Jan 29, 2025

@vx-daniel Thanks for the report, I'll make sure to add it! Windows images are a beast to properly rebuild with all the software as published by GitHub, but I'll get there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants