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

[DRAFT] feat(remote): disable cleanup with envvar #4836

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions snapcraft/commands/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,11 @@ def _run(self, parsed_args: argparse.Namespace, **kwargs: Any) -> int | None:
)
except RemoteBuildError:
emit.progress("Starting build failed.", permanent=True)
emit.progress("Cleaning up")
builder.cleanup()
self._cleanup()
raise
except lazr.restfulclient.errors.Conflict:
emit.progress("Remote repository already exists.", permanent=True)
emit.progress("Cleaning up")
builder.cleanup()
self._cleanup()
return 75

try:
Expand All @@ -254,10 +252,16 @@ def _run(self, parsed_args: argparse.Namespace, **kwargs: Any) -> int | None:
builder.cancel_builds()
returncode = 0
if returncode != 75: # TimeoutError
emit.progress("Cleaning up")
builder.cleanup()
self._cleanup()
return returncode

def _cleanup(self) -> None:
if os.getenv("SNAPCRAFT_REMOTE_BUILD_DISABLE_CLEANUP"):
emit.progress("Not cleaning up remote build.")
else:
emit.progress("Cleaning up")
self._services.remote_build.cleanup()

def _monitor_and_complete(
self, build_id: str | None, builds: Collection[Build]
) -> int:
Expand Down
Loading