mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-06-21 17:24:23 +02:00
- Adds `runner.post_task_script` and `runner.post_task_script_timeout` (default `5m`) to run a host executable after each task’s built-in cleanup (post-steps, container teardown, bind-workdir removal). - Stops task heartbeats via `Reporter.StopHeartbeats()` while the script runs so Gitea won’t assign overlapping work; the final task acknowledgement still happens in `reporter.Close()`. - Script output goes to the runner process log; non-zero exits are warned only and do not change the job result. - Documents lifecycle, offline behavior, timeouts, and Windows limits (`.ps1` not supported yet) in `docs/post-task-script.md`. Reviewed-on: https://gitea.com/gitea/runner/pulls/1026 Reviewed-by: Zettat123 <39446+zettat123@noreply.gitea.com>
25 lines
671 B
Go
25 lines
671 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go:build !windows && !plan9
|
|
|
|
package process
|
|
|
|
import "syscall"
|
|
|
|
// SysProcAttr returns the platform attributes used to start a process so that a
|
|
// Killer can later tear down its whole process tree. On Unix the process becomes
|
|
// the leader of a new process group (or session, for the PTY path), so a
|
|
// signal to the negative PID reaches every descendant that stayed in the group.
|
|
func SysProcAttr(_ string, tty bool) *syscall.SysProcAttr {
|
|
if tty {
|
|
return &syscall.SysProcAttr{
|
|
Setsid: true,
|
|
Setctty: true,
|
|
}
|
|
}
|
|
return &syscall.SysProcAttr{
|
|
Setpgid: true,
|
|
}
|
|
}
|