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

Fix/recover from failed branch deletions #137

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

oatymart
Copy link
Contributor

Follow-up to #134

I noticed our release-packages.yml workflow failing in a few places:

  1. eslint-config-tao error in run, blocked NPM publish
➡ Clean up the place
Error: Error: To https://github.com/oat-sa/eslint-config-tao
!	:refs/heads/release-4.0.0	[remote rejected] (cannot lock ref 'refs/heads/release-4.0.0': unable to resolve reference 'refs/heads/release-4.0.0')
❎ To https://github.com/oat-sa/eslint-config-tao
Done
Pushing to https://github.com/oat-sa/eslint-config-tao
POST git-receive-pack (1[88](https://github.com/oat-sa/eslint-config-tao/actions/runs/10793376619/job/29935154252#step:4:89) bytes)
error: failed to push some refs to 'https://github.com/oat-sa/eslint-config-tao'
!	:refs/heads/release-4.0.0	[remote rejected] (cannot lock ref 'refs/heads/release-4.0.0': unable to resolve reference 'refs/heads/release-4.0.0')
Done
  1. read-aloud-client-fe error in run, blocked NPM publish
➡ Clean up the place
❎ To https://github.com/oat-sa/read-aloud-client-fe
!	:refs/heads/release-0.9.0	[remote rejected] (cannot lock ref 'refs/heads/release-0.9.0': unable to resolve reference 'refs/heads/release-0.9.0')
Error: Error: To https://github.com/oat-sa/read-aloud-client-fe
!	:refs/heads/release-0.9.0	[remote rejected] (cannot lock ref 'refs/heads/release-0.9.0': unable to resolve reference 'refs/heads/release-0.9.0')
Done
Pushing to https://github.com/oat-sa/read-aloud-client-fe
POST git-receive-pack (188 bytes)
error: failed to push some refs to 'https://github.com/oat-sa/read-aloud-client-fe'

Done
  1. live-design-system error in run
➡ Clean up the place
⚠ Cannot delete branch release-21.3.0: Error: Pushing to https://github.com/oat-sa/live-design-system
error: unable to delete 'release-21.3.0': remote ref does not exist
error: failed to push some refs to 'https://github.com/oat-sa/live-design-system'
 - Error: Pushing to https://github.com/oat-sa/live-design-system
error: unable to delete 'release-21.3.0': remote ref does not exist
error: failed to push some refs to 'https://github.com/oat-sa/live-design-system'

Based on the error messages, I think it could be the same problem that was addressed in #134 (but we should catch more error messages than we do).

This PR is a bit of a shot in the dark (untested). Looking for a second opinion before propagating to one of the broken workflows.

Copy link

Coverage Report

Totals Coverage
Statements: 46.65% ( 781 / 1674 )
Methods: 35.06% ( 95 / 271 )
Lines: 45.67% ( 427 / 935 )
Branches: 55.34% ( 259 / 468 )

StandWithUkraine

@@ -614,9 +614,11 @@ export default function taoExtensionReleaseFactory(params = {}) {
log.doing('Clean up the place');

try {
await gitClient.deleteBranch(data.releasingBranch);
await gitClient.deleteBranch(data.releasingBranch);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a second possibility, using if (gitClient.hasBranch) and no error.message check, instead of try/catch.

Copy link
Contributor

@gabrielfs7 gabrielfs7 left a comment

Choose a reason for hiding this comment

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

Thanks @oatymart

@oatymart oatymart self-assigned this Sep 11, 2024
Copy link
Contributor

@jsconan jsconan left a comment

Choose a reason for hiding this comment

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

It is worth a try. However, if a further git action is needed and the refs cannot be resolved it might still break on the next step. Let's see how it goes.

@oatymart oatymart merged commit 82a8983 into develop Sep 12, 2024
2 of 3 checks passed
@oatymart oatymart deleted the fix/recover-from-failed-branch-deletions branch September 12, 2024 08:20
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.

3 participants