actions / runner-images

GitHub Actions runner images
MIT License
10.28k stars 3.09k forks source link

Getting error New-Item : The path is not of a legal form for Windows builds #11077

Open angaaruriakhil opened 1 day ago

angaaruriakhil commented 1 day ago

Description

As part of commit https://github.com/actions/runner-images/commit/5a263020f559343719f2dbacfd1065e94a691c11 , the code was changed so that a new temp directory is now being used under D:\temp for both Windows 2022 and Windows 2019 builds.

Now, when running a build, it fails to create the temp folder under the D:\ filesystem, with a "The path is not of a legal form" error.

Our build continues and then fails later on when there is no directory to refer to.

_azure-arm.build_vhd: New-Item : The path is not of a legal form. azure-arm.build_vhd: Directory: C:\ azure-arm.build_vhd: azure-arm.build_vhd: azure-arm.build_vhd: Mode LastWriteTime Length Name azure-arm.build_vhd: ---- ------------- ------ ---- azure-arm.build_vhd: d----- 12/2/2024 4:56 PM image azure-arm.build_vhd: D:\temp azure-arm.build_vhd: C:\image ==> azure-arm.build_vhd: At C:\Windows\Temp\script-674de6be-9e8b-7fe2-a892-4428e383d125.ps1:6 char:1 ==> azure-arm.build_vhd: + New-Item -Path $temp_dir -ItemType Directory -Force ==> azure-arm.build_vhd: + ~~~~~~~~~~~ ==> azure-arm.build_vhd: + CategoryInfo : InvalidArgument: (D:\:String) [New-Item], ArgumentException ==> azure-arm.build_vhd: + FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShell.Commands.NewItemCommand ==> azure-arm.buildvhd:

Platforms affected

Runner images affected

Image version and build link

Self hosted VMSS

Is it regression?

Yes

Expected behavior

New-Item should provision the temp directory as needed

Actual behavior

Receiving this error:

 azure-arm.build_vhd: New-Item : The path is not of a legal form.
    azure-arm.build_vhd:     Directory: C:\
    azure-arm.build_vhd:
    azure-arm.build_vhd:
    azure-arm.build_vhd: Mode                 LastWriteTime         Length Name
    azure-arm.build_vhd: ----                 -------------         ------ ----
    azure-arm.build_vhd: d-----         12/2/2024   4:56 PM                image
    azure-arm.build_vhd: D:\temp
    azure-arm.build_vhd: C:\image
==> azure-arm.build_vhd: At C:\Windows\Temp\script-674de6be-9e8b-7fe2-a892-4428e383d125.ps1:6 char:1
==> azure-arm.build_vhd: + New-Item -Path $temp_dir -ItemType Directory -Force
==> azure-arm.build_vhd: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> azure-arm.build_vhd:     + CategoryInfo          : InvalidArgument: (D:\:String) [New-Item], ArgumentException
==> azure-arm.build_vhd:     + FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShell.Commands.NewItemCommand
==> azure-arm.build_vhd:

Repro steps

Clone down runner-images repo and perform an image build of either Windows 2019 or Windows 2022 with Packer

jshield commented 1 day ago

I'm also getting a number of errors related to the haphazard merge of the new temp_dir changes, using a vm sku that has a scratch disk appears to now be mandatory.

particularly the VS Log Collect tool appears to write the logs to $TEMP, but the scripts expect it in $TEMP_DIR, and thus breaks the build because the expected path isn't being passed to the collect tool.

hemanthmanga commented 23 hours ago

Hi @angaaruriakhil, Thank you for bringing this issue to our attention. We are looking into this issue and will update you on this issue after investigating