Delete the old environment before setting the status to NEW#4414
Open
lubaihua33 wants to merge 3 commits intomainfrom
Open
Delete the old environment before setting the status to NEW#4414lubaihua33 wants to merge 3 commits intomainfrom
lubaihua33 wants to merge 3 commits intomainfrom
Conversation
This is to fix the issue that the resources are not cleaned when retrying to deploy a new environment
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes retry cleanup so that previously created environments are deleted before resetting status to NEW, preventing leaked resources across multiple retry attempts.
Changes:
- Trigger
_delete_environment_taskwhen_need_retry(environment)is true (before resetting status toNEW). - Update the env-retry selftest expectations to reflect additional delete operations during retries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lisa/runners/lisa_runner.py | Adds environment deletion during retry handling prior to resetting status to NEW. |
| selftests/runners/test_lisa_runner.py | Updates expected deleted-environment assertions for the retry flow. |
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change addresses the issue where environments were not cleaned up when the Environment retry count was greater than zero.
Description
This change addresses the issue where environments were not cleaned up when the Environment retry count was greater than zero.
Previously, when a retry was triggered, only the latest environment was deleted, while older environments remained uncleared. This resulted in leftover resources after multiple retries.
To resolve this issue, the _delete_environment_task has been added during retry operations to ensure that all previously created environments are properly cleaned up.
Related Issue
Before the fix
The related logs are:
Only the newest environment was deleted, while older environment lisa-None-20260414-022033-118-e0 is leftover.
2026-04-14 03:27:54.743[67164][INFO] lisa.[azure].del[generated_0] deleting resource group: lisa-None-20260414-022033-118-e0-1, wait: FalseType of Change
Checklist
Test Validation
After the fix, all old environments are deleted as expected.
Key Test Cases:
Impacted LISA Features:
Tested Azure Marketplace Images:
Test Results