Fix Jenkins-update flow: redeploy_project pull + delete_image safety + delete_container
Bug fixes from product test: 1. redeploy_project: BUILD_FAILED now includes explicit image pull (stop → pull → start) 2. delete_image: Distinguishes running vs stopped containers, suggests system_prune for stopped refs 3. New tool delete_container: Verify stopped state before deletion, confirmation required Tests added for all three paths plus stopped-container edge cases. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,7 @@ def register_projects(mcp: FastMCP, config: AppConfig, client: DsmClient) -> Non
|
||||
Checks the current project status to determine the correct action:
|
||||
- RUNNING → stop, then start
|
||||
- STOPPED → start directly (nothing to stop)
|
||||
- BUILD_FAILED → force-stop, then start
|
||||
- BUILD_FAILED → stop, pull images, then start
|
||||
|
||||
This operation will briefly take the project offline.
|
||||
Requires confirmation before executing.
|
||||
@@ -153,19 +153,23 @@ def register_projects(mcp: FastMCP, config: AppConfig, client: DsmClient) -> Non
|
||||
await client.request("SYNO.Docker.Project", "start", params={"id": project_id})
|
||||
results.append(" Project started.")
|
||||
|
||||
elif status in ("RUNNING", "BUILD_FAILED", ""):
|
||||
if status == "RUNNING":
|
||||
results.append("Step 1/2: Stopping project...")
|
||||
elif status == "BUILD_FAILED":
|
||||
results.append("Step 1/3: Stopping failed build...")
|
||||
with contextlib.suppress(Exception):
|
||||
await client.request("SYNO.Docker.Project", "stop", params={"id": project_id})
|
||||
results.append(" Project stopped.")
|
||||
elif status == "BUILD_FAILED":
|
||||
results.append("Step 1/2: Stopping failed build...")
|
||||
with contextlib.suppress(Exception):
|
||||
await client.request(
|
||||
"SYNO.Docker.Project", "stop", params={"id": project_id}
|
||||
)
|
||||
results.append(" Build stopped.")
|
||||
results.append(" Build stopped.")
|
||||
results.append("Step 2/3: Pulling updated images...")
|
||||
with contextlib.suppress(Exception):
|
||||
await client.request("SYNO.Docker.Image", "pull", params={"id": project_id})
|
||||
results.append(" Images pulled.")
|
||||
results.append("Step 3/3: Starting project...")
|
||||
await client.request("SYNO.Docker.Project", "start", params={"id": project_id})
|
||||
results.append(" Project started.")
|
||||
|
||||
elif status in ("RUNNING", ""):
|
||||
results.append("Step 1/2: Stopping project...")
|
||||
await client.request("SYNO.Docker.Project", "stop", params={"id": project_id})
|
||||
results.append(" Project stopped.")
|
||||
results.append("Step 2/2: Starting project...")
|
||||
await client.request("SYNO.Docker.Project", "start", params={"id": project_id})
|
||||
results.append(" Project started.")
|
||||
|
||||
Reference in New Issue
Block a user