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

build: move Electron releases fetch to Forge generateAssets hook #1316

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

dsanders11
Copy link
Member

Pull releases.json in generateAssets so that it is always the latest and there are no more generated PRs.

Minor drawback is that builds will no longer be fully reproducible since releases.json will be pulled at the time you do the build and may be different than your last build.

@dsanders11 dsanders11 requested review from a team and codebytere as code owners April 15, 2023 01:31
@dsanders11 dsanders11 merged commit b11e77b into electron:main Apr 18, 2023
3 checks passed
@dsanders11 dsanders11 deleted the generateAssets-releases branch April 18, 2023 00:25
@andersk
Copy link
Contributor

andersk commented May 8, 2023

Minor drawback is that builds will no longer be fully reproducible since releases.json will be pulled at the time you do the build and may be different than your last build.

This has also broken the Electron Fiddle package that I maintain for NixOS. All NixOS packages are built in a sandbox with no external network access (except fixed-output derivations that check a hash of their output, for downloading sources).

@dsanders11
Copy link
Member Author

Sorry about that @andersk. Would gracefully failing if the fetch fails and allowing the build to continue work for you? That's what happens with maybeFetchContributors, which has been a build-time step for a while now.

@andersk
Copy link
Contributor

andersk commented May 9, 2023

Yeah that sounds good; the release data will be re-fetched at runtime right?

An alternate option might be to skip the fetches if the SOURCE_DATE_EPOCH environment variable is present, indicating that a reproducible build was requested.

@dsanders11
Copy link
Member Author

Yeah that sounds good; the release data will be re-fetched at runtime right?

It will be, although I'm not sure how the UI will react if it's started up with an empty releases.json, I'll have to test that when I make the change. There's also an open issue (#1222) where the intellisense for Node.js typings only uses the static version of releases.json, but I have a fix coming for that and should have a release which fixes that released in a couple weeks.

I'm curious, though, how does the credits page in settings look in the NixOS packaged version? That file is exclusively fetched at build-time, so if that fails due to no network I'd imagine the credits page is just empty.

Doing a cursory look at the NixOS/nixpkgs repo I see that packages can include patches - I wonder if the most robust solution would be make the change to gracefully fail if no network access, but then when you bump the Fiddle version for the package, use yarn electron-releases to populate releases.json and then dump that into a patch (same with contributors). That would effectively be what was being done before this PR landed, just without us needing to juggle generated PRs to keep that file up-to-date in this repo.

@andersk
Copy link
Contributor

andersk commented May 9, 2023

I'm curious, though, how does the credits page in settings look in the NixOS packaged version?

Yeah, it’s empty. (Maybe we could fallback with a link to https://github.com/electron/fiddle/graphs/contributors if there’s no pre-fetched data?)

Screenshots

credits
about

Doing a cursory look at the NixOS/nixpkgs repo I see that packages can include patches -

Certainly an option, though it will complicate maintenance, meaning less frequent updates.

@dsanders11
Copy link
Member Author

Thanks for the screenshots!

I've tested building main with no internet access and it looks like the (unshipped) change in #1344 means the fetch releases build step gracefully fails, although there's a TS error since that JSON is inlined at build time so TS can tell it is an empty array. However, the app doesn't load properly if there are no known versions, throwing an error at this line.

I've put up a PR (#1351) to ensure it doesn't clobber any existing static/releases.json if fetching new releases fails, which ensures any patches to static/releases.json will be effective.

Certainly an option, though it will complicate maintenance, meaning less frequent updates.

There's a lot changing in this repo at the moment as I'm landing a lot of refactors and fixes, leading to more releases at the moment. After another few releases the release cadence will likely slow down significantly as otherwise this repo doesn't get frequent changes.

So, v0.32.6 will be released this week (short of any hiccups) which will include gracefully handling network failure at build time. With that version, I'd recommend floating a patch to populate static/releases.json for the immediate future, and we can revisit this in the future after the current flurry of changes in this repo stabilize. As previously mentioned, it should be fine for that patch to get a little stale as the latest versions will be fetched on app start.

Thanks for bringing it to our attention, and for maintaining the NixOS package. 👍

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.

None yet

3 participants