Skip to content

Swift.org install api to support installer tools (Swiftly) #720

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

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

shahmishal
Copy link
Member

Swift.org install api to support installer tools (Swiftly)

To support Swiftly, I propose static JSON API endpoints from YAML files that will be created during the Jekyll build phase. These endpoints will allow users to access a list of releases at swift.org/api/v1/install/releases.json, containing information about tags, platforms, architectures, and docker tags. The dev endpoint, swift.org/api/v1/install/dev/<branch>/<platform>.json, will provide a list of development toolchain information. In the future, we should provide REST APIs which can be dynamic and supports query parameters.

├── api
│   └── v1
│       └── install
│           ├── dev
│           │   ├── 6.0
│           │   │   ├── amazonlinux2.json
│           │   │   ├── centos7.json
│           │   │   ├── macos.json
│           │   │   ├── static-sdk.json
│           │   │   ├── ubi9.json
│           │   │   ├── ubuntu2004.json
│           │   │   ├── ubuntu2204.json
│           │   │   └── windows10.json
│           │   └── main
│           │       ├── amazonlinux2.json
│           │       ├── centos7.json
│           │       ├── macos.json
│           │       ├── static-sdk.json
│           │       ├── ubi9.json
│           │       ├── ubuntu2004.json
│           │       ├── ubuntu2204.json
│           │       └── windows10.json
│           └── releases.json

Copy link
Member

@alexandersandberg alexandersandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be amazing if we could use e.g. https://github.com/avillafiorita/jekyll-datapage_gen (do we even need a plugin? I'm no Jekyll expert) to dynamically generate these endpoints based on a single source of truth data file—I guess _data/builds/swift_releases.yml would be enough?

This data file could then also be used to generate the pages for /install, instead of manually creating them as well as their content for each new supported platform/version, since this can easily lead to inconsistencies.

@shahmishal
Copy link
Member Author

In this pull request, the data are generated from the yml file during the build phase so it would signal source of truth.

for example, its reading the value from the _data and converting it to json.

{{ site.data.builds.swift-6_0-branch.amazonlinux2-aarch64 | jsonify}}

@alexandersandberg
Copy link
Member

In this pull request, the data are generated from the yml file during the build phase so it would signal source of truth.

for example, its reading the value from the _data and converting it to json.

{{ site.data.builds.swift-6_0-branch.amazonlinux2-aarch64 | jsonify}}

I mean to generate the "template" endpoint files for each version as well, so we don't have to create a new api/v1/install/dev/6.0/{platform/version}.json JSON file when we add support for more platforms/versions.

I guess now we would also have to duplicate the platform/version JSON files for each new Swift version as well. If they were generated, adding support for a future Swift version would be as simple as only updating the source of truth data file.

@shahmishal
Copy link
Member Author

I will look into https://github.com/avillafiorita/jekyll-datapage_gen plugin, I noticed the repo has not been updated for 2 years (it might be fine).

Copy link
Member

@kaishin kaishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well enough for the time being, even though I agree with @alexandersandberg that we can benefit from generating the JSON files dynamically.

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great step in the right direction! Do appear to be missing the newer platforms though

@shahmishal
Copy link
Member Author

shahmishal commented Jun 13, 2024

Looks like a great step in the right direction! Do appear to be missing the newer platforms though

The new platforms are available part of the releases.json only because nightly toolchains currently have an issue with new platforms on main and release/6.0 branches.

@shahmishal
Copy link
Member Author

@swift-ci test

@shahmishal shahmishal enabled auto-merge (squash) August 6, 2024 05:02
@shahmishal shahmishal merged commit e829b1e into main Aug 6, 2024
1 check passed
@shahmishal shahmishal deleted the static-api-support-for-release-n-dev-toolchains branch August 6, 2024 05:03
@kkebo
Copy link
Contributor

kkebo commented Mar 11, 2025

When do you plan to add dev/6.1 to swift.org install API?

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

Successfully merging this pull request may close these issues.

5 participants