aboutsummaryrefslogtreecommitdiffstats
path: root/models/actions/task.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/actions/task.go')
-rw-r--r--models/actions/task.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/actions/task.go b/models/actions/task.go
index 43f11b2730..63259582f6 100644
--- a/models/actions/task.go
+++ b/models/actions/task.go
@@ -336,6 +336,11 @@ func UpdateTask(ctx context.Context, task *ActionTask, cols ...string) error {
sess.Cols(cols...)
}
_, err := sess.Update(task)
+
+ // Automatically delete the ephemeral runner if the task is done
+ if err == nil && task.Status.IsDone() && util.SliceContainsString(cols, "status") {
+ return DeleteEphemeralRunner(ctx, task.RunnerID)
+ }
return err
}