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

.github: separate release creation from uploading assets #792

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Aug 16, 2023

Before this commit, the .github/bin/publish-release script handled both:

  • creating the draft release
  • uploading assets to the release

with the intention that the first build job to finish would create the release with one asset, and each later job would upload an asset.

The logic was like:

if ! gh release view "${build_tag}"; then
  gh release create [...]
else
  gh release upload [...]
fi

But this had a race. For example, if two build jobs finished at nearly the same moment, they could each create a draft release. This race was almost never encountered in practice, and was easily resolved by deleting a draft release and restarting a build job, but it's worth resolving.

Add an initial build job to create a draft release that has no assets, and make the later build jobs only upload to that release.

This fixes the race, and makes it easier to share logic between the native build jobs and the cross-compiling build jobs.

Fixes: #551
Refs: #789


To-do:

  • Test build job
  • Follow-up PR: rename build scripts (do separately to ensure that git can track the rename)
  • Follow-up PR: make cross-compilation job run in parallel with native build jobs

Before this commit, the publish-release script handled both:

- creating the draft release

- uploading assets to the release

with the intention that the first build job to finish would create the
release with one asset, and each later job would upload an asset.

The logic was like:

    if ! gh release view "${build_tag}"; then
      gh release create [...]
    else
      gh release upload [...]
    fi

But this had a race. For example, if two build jobs finished at nearly
the same moment, they could each create a draft release. This race was
almost never encountered in practice, and was easily resolved by
deleting a draft release and restarting a build job, but it's worth
resolving.

Add an initial build job to create a draft release that has no assets,
and make the later build jobs only upload to that release.

This fixes the race, and makes it easier to share logic between the
native build jobs and the cross-compiling build jobs.

Fixes: 551
Refs: 789
@ee7 ee7 requested a review from ErikSchierboom as a code owner August 16, 2023 09:18
@ee7
Copy link
Member Author

ee7 commented Aug 16, 2023

I manually triggered this PR's build workflow. It worked, and created this draft release.

CI indicates failure due to rate limiting in the macos fetch-configlet job. Edit: It worked after some restarts.

.github/workflows/build.yml Show resolved Hide resolved
@ee7 ee7 merged commit 88f367f into exercism:main Aug 16, 2023
@ee7 ee7 deleted the github-separate-release-creation branch August 16, 2023 11:38
@ee7 ee7 changed the title .github: separate release creation from uploading .github: separate release creation from uploading assets Aug 16, 2023
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.

build(publish-release): race between release view and release create
2 participants