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

Clean up failed releases #546

Merged
merged 2 commits into from
Sep 26, 2024
Merged

Clean up failed releases #546

merged 2 commits into from
Sep 26, 2024

Conversation

lionel-
Copy link
Contributor

@lionel- lionel- commented Sep 26, 2024

It's currently possible for our workflows to leave a new release in a failed or incomplete state:

  • A release build completes
  • We create a new release
  • But then we either fail to download release artifacts from build jobs, or fail to upload a release asset

To avoid this, we now clean up releases in case of propagated failure.

Another change made here is that the Slack failure report will now also be sent if an upload-release step fails. Previously we would only report build failures.

Making sure we don't create partial releases should help with posit-dev/positron#4815.

Approach: This uses the gh CLI tool to check for existence of a release and delete it if any.

name: Clean up Failed Releases
if: ${{ failure() }}
runs-on: ubuntu-latest
needs: [upload_release_binaries, get_version]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
needs: [upload_release_binaries, get_version]
needs: [upload_release_binaries]

Is there any reason not to just do this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I guess that gives us needs.get_version.outputs.ARK_VERSION?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

Comment on lines 187 to 197
- name: Delete failed release if any
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG=${{ needs.get_version.outputs.ARK_VERSION }}
if gh release view $TAG > /dev/null 2>&1; then
echo "Cleaning up release $TAG"
gh release delete $TAG -y --cleanup-tag
else
echo "No release to clean up"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than gh release view should we just use the same "release exists" action from above? (it needs to be updated too, but the consistency feels nice)

            - name: Check for existing release tag
              uses: mukunku/[email protected]
              id: check_tag
              with:
                  tag: ${{ needs.get_version.outputs.ARK_VERSION }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, and I've updated the action

@lionel- lionel- force-pushed the feature/release-cleanup branch 4 times, most recently from 8bffef9 to 7582bb5 Compare September 26, 2024 14:45
@lionel- lionel- merged commit 7e957a2 into main Sep 26, 2024
3 checks passed
@lionel- lionel- deleted the feature/release-cleanup branch September 26, 2024 14:54
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants