swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.39k stars 10.34k forks source link

[Windows] Support Nightly Toolchains for main and release/5.10 #69484

Open shahmishal opened 11 months ago

shahmishal commented 11 months ago

Windows toolchain needs to be built on ci-external.swift.org for main and release/5.10 branch.

shahmishal commented 10 months ago

It failed again for same error:

T:\toolchains\ : warning WIX8503: Failed to extract attached container. This most often happens when extracting a stripped bundle from the package cache, which is not supported.
Error: msiexec.exe exited with code 1619.
compnerd commented 10 months ago

@shahmishal we don't delete the installer if it existing, it might require some manual intervention to clean that up.

shahmishal commented 10 months ago

Where does the installer get installed? is it in T:\?

compnerd commented 10 months ago

Yeah, the installer itself is downloaded to T: but we extract the content into T:\toolchains IIRC

shahmishal commented 10 months ago

Can we delete this dir if it invalid and re-try extracting the toolchain?

shahmishal commented 10 months ago

@compnerd its still failing on another node, https://ci-external.swift.org/job/swift-main-windows-toolchain/29/console

shahmishal commented 10 months ago

I thought this would delete the virtual drive:

            subst T: /d
compnerd commented 10 months ago

Yes, that removes the "virtual drive", but does not remove the contents that were mapped there.

shahmishal commented 10 months ago

I also have rd /s /q %WORKSPACE%\\build in the job, so it should download new toolchain every time.

            set BuildRoot=%SourceRoot%\\build

            md %BuildRoot%
            subst T: /d
            subst T: %BuildRoot% || (exit /b)
compnerd commented 10 months ago

Interesting - and the download doesn't say that the toolchain installer is invalid. So, it could be that it is failing to pass the signature check :/ I don't think that I have a way to diagnose this without actually interacting with the host.

shahmishal commented 10 months ago

Can we add verbose mode to the signature check?

shahmishal commented 10 months ago

msiexec_failure.log Attached log from

msiexec.exe /lv T:\toolchains\log.log /qn /a T:\toolchains\a0 TARGETDIR=T:\toolchains\swift-5.9-RELEASE-windows10
MSI (s) (E8:5C) [01:08:01:773]: Found shell folder  by spelunking through the registry.
MSI (s) (E8:5C) [01:08:01:773]: Note: 1: 2103 2: 26 
MSI (s) (E8:5C) [01:08:01:774]: Error: Failed to Create AppData Cache Path with Product ID
MSI (s) (E8:5C) [01:08:01:774]: Note: 1: 2205 2:  3: Error 
MSI (s) (E8:5C) [01:08:01:774]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2103 
DEBUG: Error 2103:  Could not resolve path for shell folder 26.
MSI (s) (E8:5C) [01:08:01:778]: Note: 1: 2205 2:  3: Error 
MSI (s) (E8:5C) [01:08:01:778]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709 
MSI (s) (E8:5C) [01:08:01:778]: Product: Swift Runtime for Windows x86_64 -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2103. The arguments are: 26, , 
shahmishal commented 10 months ago
bat '''
            "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\vsdevcmd.bat -arch=amd64 -host_arch=amd64"

            rd /s /q %LocalAppData%\\clang\\ModuleCache

            set CMAKE_BUILD_TYPE=Release
            set PYTHON_HOME="%ProgramFiles(x86)%\\Microsoft Visual Studio\\Shared\\Python37_64"

            set SourceRoot=%WORKSPACE%
            set BuildRoot=%SourceRoot%\\build

            md %BuildRoot%
            subst T: /d
            subst T: %BuildRoot% || (exit /b 1)

            set BuildRoot=T:

            set PackageRoot=%BuildRoot%\\artifacts

            md %PackageRoot%

            :: Setup temporary directories
            md %BuildRoot%\\tmp
            set TEMP=%BuildRoot%\\tmp
            set TMP=%BuildRoot%\\tmp
            set TMPDIR=%BuildRoot%\\tmp

            set NINJA_STATUS=[%%f/%%t][%%p][%%es]

            set TestArg=-Test swift,dispatch,foundation,xctest

            set "SkipPackagingArg= "
            set "swift="

            rd /s /q %WORKSPACE%\\build

            powershell.exe -ExecutionPolicy RemoteSigned -File %WORKSPACE%\\swift\\utils\\build.ps1 ^
            -SourceCache %SourceRoot% ^
            -BinaryCache %BuildRoot% ^
            -ImageRoot %BuildRoot% ^
            -BuildType %CMAKE_BUILD_TYPE% ^
            %SkipPackagingArg% ^
            %TestArg% ^
            -Stage %PackageRoot% || (exit /b 1)
            '''

Thats the current script, let me know if I missed something Re-running it https://ci-external.swift.org/job/swift-main-windows-toolchain/31/console

compnerd commented 10 months ago

I was thinking of adding the /lvx! ... to the arguments, seems that you did the same thing! This is interesting - the error is definitely Error 2103: Could not resolve path for shell folder 26.. Now, the question is why is that happening 🤔

compnerd commented 10 months ago

I wonder if the builders are running as different users. LOCAL SYSTEM (service account) might encounter some issues - I wonder if we can quickly test with:

msiexec.exe /lvx! T:\toolchains\log.log /qn /a T:\toolchains\a0 TARGETDIR=T:\toolchains\swift-5.9-RELEASE-windows10 ALLUSERS=1
compnerd commented 10 months ago

https://github.com/apple/swift/pull/69852 adds the logging for future use as well.

compnerd commented 10 months ago

@shahmishal seems that the last re-run succeeded

shahmishal commented 10 months ago

@compnerd sent link in private for review for nightly main toolchain.

compnerd commented 10 months ago

@shahmishal - reviewed, seems ready to go to me!

shahmishal commented 10 months ago

main branch nightly Windows toolchain available on swift.org

compnerd commented 9 months ago

@shahmishal - it seems that the main branch nightlies do not auto-update? There was a snapshot from 11/27, but the other platforms are on 12/7.

compnerd commented 9 months ago

@shahmishal any progress on the auto-updated nightlies? It seems that the Windows target is out of date by a month.

compnerd commented 8 months ago

ping again on this @shahmishal - the Windows snapshot on main is now ~2m out of date and we still do not have a 5.10 release snapshot. This really risks the 5.10 release as we will need extra time to validate the Windows releases.

shahmishal commented 8 months ago

@compnerd I am looking into getting this configured, due to other tasks I was not able to get to this. Hopefully, I will be able to focus on this soon.

shahmishal commented 8 months ago

Started new builds

shahmishal commented 8 months ago

main failed:

swift-ci@EC2AMAZ-JCVOGM7 C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain>powershell.exe -ExecutionPolicy RemoteSigned -File C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\utils\build.ps1             -SourceCache C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain             -BinaryCache T:             -ImageRoot T:             -BuildType Release                           -Test swift,dispatch,foundation,xctest             -Stage T:\artifacts   || (exit /b 1 ) 
C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\utils\build.ps1 : A parameter cannot be found 
that matches parameter name 'BuildType'.
    + CategoryInfo          : InvalidArgument: (:) [build.ps1], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : NamedParameterNotFound,build.ps1

cc: @compnerd

compnerd commented 8 months ago

Ah, right, we dropped the -BuildType parameter a while ago to allow us to support sccache. You should just be able to remove the -BuildType Release from the invocation (it will always generate release mode builds).

shahmishal commented 8 months ago

New build started: https://ci-external.swift.org/job/swift-main-windows-toolchain/34/console

shahmishal commented 8 months ago

Ah, right, we dropped the -BuildType parameter a while ago to allow us to support sccache. You should just be able to remove the -BuildType Release from the invocation (it will always generate release mode builds).

Can we also cherry-pick this to release/5.10?

compnerd commented 8 months ago

Sure, let me look into that!

shahmishal commented 8 months ago

Nightly 5.10 released on swift.org - https://github.com/apple/swift-org-website/pull/488

compnerd commented 8 months ago

Trying to pull in the changes for -BuildType into 5.10 at https://github.com/apple/swift/pull/71117