Done! The change now ensures cleanup scripts will commit their changes even when they fail. (#931)
**What changed:** - Added `success` flag: Process completed with exit code 0 (normal success path) - Added `cleanup_done` flag: Cleanup script finished in any state except Running - Commits are attempted if either condition is true **Result:** When a cleanup script fails, any file changes it made will still be committed to git, instead of being lost.
This commit is contained in:
committed by
GitHub
parent
c45e40717e
commit
8a9f398aaf
@@ -432,11 +432,20 @@ impl LocalContainerService {
|
||||
tracing::warn!("Failed to update executor session summary: {}", e);
|
||||
}
|
||||
|
||||
if matches!(
|
||||
let success = matches!(
|
||||
ctx.execution_process.status,
|
||||
ExecutionProcessStatus::Completed
|
||||
) && exit_code == Some(0)
|
||||
{
|
||||
) && exit_code == Some(0);
|
||||
|
||||
let cleanup_done = matches!(
|
||||
ctx.execution_process.run_reason,
|
||||
ExecutionProcessRunReason::CleanupScript
|
||||
) && !matches!(
|
||||
ctx.execution_process.status,
|
||||
ExecutionProcessStatus::Running
|
||||
);
|
||||
|
||||
if success || cleanup_done {
|
||||
// Commit changes (if any) and get feedback about whether changes were made
|
||||
let changes_committed = match container.try_commit_changes(&ctx).await {
|
||||
Ok(committed) => committed,
|
||||
|
||||
Reference in New Issue
Block a user