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 volumes if workspace preparation fails #1021

Merged

Conversation

lowjoel
Copy link
Contributor

@lowjoel lowjoel commented Aug 17, 2023

If workspace preparation fails, the temporary Docker volume is not cleaned up.

Test plan

I'll need help filling in this bit. Apart from manually inducing an error with the workspace process, how else? I could possibly build locally a broken batch-change container image that doesn't have Git nor unzip?

Copy link
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

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

Left one comment about preserving error reporting from the Close method. Thanks for the fix!

Comment on lines 232 to 233
_ = deleteVolume(ctx, w.volume)
return nil
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_ = deleteVolume(ctx, w.volume)
return nil
return deleteVolume(ctx, w.volume)

To keep the error reporting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'oh, not sure how I misread the code. I'll fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks for pointing out!

@lowjoel lowjoel force-pushed the cleanup-failed-prepared-workspaces branch from 24890ef to 0172845 Compare August 22, 2023 02:24
@lowjoel lowjoel force-pushed the cleanup-failed-prepared-workspaces branch from 0172845 to 970f0d3 Compare August 22, 2023 02:27
@lowjoel
Copy link
Contributor Author

lowjoel commented Aug 22, 2023

I also fixed the tests this round. Let me know what you think.

@lowjoel lowjoel requested a review from eseliger August 22, 2023 02:27
Copy link
Contributor

@BolajiOlajide BolajiOlajide left a comment

Choose a reason for hiding this comment

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

LGTM.

Thanks for the fix.

@BolajiOlajide BolajiOlajide merged commit 84ffc3e into sourcegraph:main Aug 23, 2023
2 checks passed
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