swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

Support installing toolchains from pull requests

Open FranzBusch opened this issue 9 months ago • 6 comments

The Swift CI is capable of producing toolchains on a PR for testing purposes. It would be great if Swiftly could help installing those by just pointing Swiftly at a PR or download URL. As an example this PR did produce a toolchain https://github.com/swiftlang/swift/pull/80316.

FranzBusch avatar Mar 27 '25 08:03 FranzBusch

This would be a really useful feature, for sure!

cmcgee1024 avatar Mar 27 '25 21:03 cmcgee1024

Is it possible to figure out jenkin's CI run No ahead of time to build the download string? The 1888 in the file is CI build No, then 80316 is the PR.

If not, would adding an extra flag like swiftly install --swift-ci <URL> a good idea?

EXAMPLE LINK: https://ci.swift.org/job/swift-PR-toolchain-macos/1888/artifact/branch-main/swift-PR-80316-1888-osx.tar.gz

louisunlimited avatar Apr 10 '25 06:04 louisunlimited

Chiming in to say that this feature would be very useful for testing after a team pushes a fix to swift/main for bugs I've reported, so that I don't have to wait for the next main snapshot to pass all of its tests and get released to test with my full project.

ADKaster avatar Apr 11 '25 00:04 ADKaster

@louisunlimited I think that it would be preferable to do something that's more structured that bare links to the toolchain tarball. It would need some investigation to see if there are ways to go from a PR down to one of those artifacts.

Something also to consider is that these artifacts are not as safe as the swift toolchain releases. There will need to be some special treatment and warnings in swiftly for that so that the user is aware of the risks.

cmcgee1024 avatar Apr 11 '25 18:04 cmcgee1024

I did some digging and I don't think I found anything that can go from a PR number directly to build artifacts. However, (correct me if I'm wrong) I was thinking that A PR might have multiple CI runs (failed runs, runs with updated code, etc) it could make more sense to let the user support a Jenkins Run Number instead of a PR number, which also gives them more control as to which build they want to install.

The good side is that it's relatively easy to find build artifacts based on a CI Run, for example:

For the PR listed above: Jenkins Build #1888

We can easily get infos for the artifact(s) with Jenkin's API:

https://ci.swift.org/job/swift-PR-toolchain-macos/1888/api/json

which returns a bunch of stuff related to this Run, and it includes

    "artifacts": [
        {
            "displayPath": "swift-PR-80316-1888-osx.tar.gz",
            "fileName": "swift-PR-80316-1888-osx.tar.gz",
            "relativePath": "branch-main/swift-PR-80316-1888-osx.tar.gz"
        }
    ],

From here, all we need to do to get the download link is:

https://ci.swift.org/job/swift-PR-toolchain-macos/<CI_RUN_NUMBER>/artifact/<RELATIVE_PATH>

louisunlimited avatar Apr 14 '25 04:04 louisunlimited

Bump to see if anyone have looked in to this recently🫡

louisunlimited avatar Jun 05 '25 04:06 louisunlimited