The runner pages had drifted from the runner. They claimed Podman is unsupported, a registration retry limit of 10, a `container.env` proxy override that has no effect, and they used the deprecated `generate-config` command, while the actual instructions were buried under implementation details. The develop and 5.x pages are rewritten from the current runner sources (`main` is `v5.2.0`). They are shorter and aimed at operators, with a new page covering what jobs get. The reference generator now documents the `config` command, and the quickstart pages in every language use the `gitea-runner` binary name. Reviewed-on: https://gitea.com/gitea/docs/pulls/600 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: silverwind <[email protected]>
1.7 KiB
sidebar_position
| sidebar_position |
|---|
| 2 |
Post-task script
The post-task script runs on the runner's host after each job, once the runner has removed the job's containers. Use it for housekeeping such as pruning Docker images or freeing disk space.
runner:
post_task_script: /usr/local/bin/gitea-post-task.sh
post_task_script_timeout: 2m
#!/bin/sh
docker image prune -f
docker builder prune -f --filter 'until=24h'
The job's slot stays busy until the script exits. With capacity: 1, the runner accepts no new jobs while the script runs. The runner kills the script if it runs longer than post_task_script_timeout, which defaults to 5m. The runner also waits for the script during shutdown.
The runner writes the script's output to its own log, not to the job log. If the script exits with a non-zero status, the runner logs a warning without changing the job's result.
Environment
The script receives variables from runner.envs and runner.env_file, but not from the runner's own environment. Set PATH in one of these settings if the script needs it. The runner also sets these variables:
| Variable | Value |
|---|---|
GITEA_TASK_ID |
The task ID |
GITEA_RUN_ID |
The workflow run ID |
GITEA_REPOSITORY |
The repository as owner/name |
GITEA_WORKSPACE |
The job's workspace path, which may already be deleted |
GITEA_JOB_RESULT |
success, failure, cancelled, skipped or unknown |
Windows
The configured path must be an .exe, .bat or .cmd file. Wrap a PowerShell script in a batch file:
@echo off
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%~dp0post-task.ps1"
For work inside the job environment, use job hooks.