fix: parallel release creation with Keygen publisher #6989
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looks like the previous changes for the Keygen publisher (moving from v1.0 to v1.1 of Keygen's API) contained a bug that slipped through the cracks, as far as automated tests go. I didn't do any manual tests, so this wasn't caught.
Under a normal publish, electron-builder will upload multiple artifacts. The Keygen publisher has a find-or-create method for creating a new release bucket, before uploading artifacts. What I didn't account for in #6941 was that electron-builder uploads these artifacts in parallel, so the find-or-create method isn't as robust as it needed to be.
This results in electron-builder trying to create the same release n times in parallel (n = number of artifacts to upload), causing all but 1 of the release creation requests to fail due to conflict errors.
This results in a failed publish for all users using the Keygen provider and electron-builder v23.3.0.
This wasn't caught in tests because the test for the Keygen publisher only uploaded a single artifact, so a conflict will never occur. That test has been modified to upload multiple artifacts, rather than a single artifact.
This PR resolves the issue by making an additional fetch if a conflict error is encountered.