config.yaml
翻译及原始 config.example.yaml
yaml
# 示例配置文件,可以安全地将其复制为默认配置文件而无需任何修改。
# 您不必将此文件复制到您的实例中,
# 只需运行 `./act_runner generate-config > config.yaml` 即可生成配置文件。
log:
# 日志级别,可以是 trace、debug、info、warn、error、fatal
level: info
runner:
# 存储注册结果的位置。
file: .runner
# 同时执行多少个任务。
capacity: 1
# 运行作业时的额外环境变量。
envs:
A_TEST_ENV_NAME_1: a_test_env_value_1
A_TEST_ENV_NAME_2: a_test_env_value_2
# 从文件中获取运行作业的额外环境变量。
# 如果文件为空或不存在,则会忽略该文件。
env_file: .env
# 作业完成的超时时间。
# 请注意,Gitea 实例也有一个超时时间(默认为3小时)。
# 如果 Gitea 实例的超时时间短于此时间,则作业可能会被 Gitea 实例停止。
timeout: 3h
# 关闭时等待运行作业完成的超时时间。
# 任何在此超时时间后仍未完成的运行作业将被取消。
shutdown_timeout: 0s
# 是否跳过验证 Gitea 实例的 TLS 证书。
insecure: false
# 从 Gitea 实例获取作业的超时时间。
fetch_timeout: 5s
# 从 Gitea 实例获取作业的间隔时间。
fetch_interval: 2s
# 运行器的标签用于确定运行器可以运行哪些作业以及如何运行它们。
# 例如:"macos-arm64:host" 或 "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
# 在 https://gitea.com/docker.gitea.com/runner-images 找到更多 Gitea 提供的镜像。
# 如果在注册时为空,将要求输入标签。
# 如果在执行 `daemon` 时为空,将使用 `.runner` 文件中的标签。
labels:
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
cache:
# 启用缓存服务器以使用 actions/cache。
enabled: true
# 存储缓存数据的目录。
# 如果为空,缓存数据将存储在 $HOME/.cache/actcache 中。
dir: ""
# 缓存服务器的主机地址。
# 这不是要监听的地址,而是作业容器连接的地址。
# 因此 0.0.0.0 是一个错误的选择,留空以自动检测。
host: ""
# 缓存服务器的端口。
# 0 表示使用随机可用端口。
port: 0
# 外部缓存服务器 URL。仅在启用时有效。
# 如果指定,act_runner 将使用此 URL 作为 ACTIONS_CACHE_URL,而不是自己启动服务器。
# URL 通常以 "/" 结尾。
external_server: ""
container:
# 指定容器将连接的网络。
# 可以是 host、bridge 或自定义网络的名称。
# 如果为空,act_runner 将自动创建一个网络。
network: ""
# 启动任务容器时是否使用特权模式(Docker-in-Docker 需要特权模式)。
privileged: false
# 容器启动时要使用的其他选项(例如,--add-host=my.gitea.url:host-gateway)。
options:
# 作业工作目录的父目录。
# 注意:无需添加路径的第一个 '/',因为 act_runner 会自动添加。
# 如果路径以 '/' 开头,'/' 将被删除。
# 例如,如果父目录是 /path/to/my/dir,则 workdir_parent 应该是 path/to/my/dir
# 如果为空,将使用 /workspace。
workdir_parent:
# 可以将卷(包括绑定挂载)挂载到容器。支持 Glob 语法,参见 https://github.com/gobwas/glob
# 您可以指定多个卷。如果序列为空,则无法挂载任何卷。
# 例如,如果您只允许容器挂载 `data` 卷和 `/src` 中的所有 json 文件,您应该将配置更改为:
# valid_volumes:
# - data
# - /src/*.json
# 如果您想允许任何卷,请使用以下配置:
# valid_volumes:
# - '**'
valid_volumes: []
# 使用指定的 docker 客户端主机覆盖默认设置。
# 如果为空,act_runner 将自动查找可用的 docker 主机。
# 如果为 "-",act_runner 将自动查找可用的 docker 主机,但 docker 主机不会挂载到作业容器和服务容器。
# 如果不为空或不为 "-",将使用指定的 docker 主机。如果不起作用,将返回错误。
docker_host: ""
# 即使已存在也拉取 docker 镜像
force_pull: true
# 即使已存在也重新构建 docker 镜像
force_rebuild: false
host:
# 作业工作目录的父目录。
# 如果为空,将使用 $HOME/.cache/act/。
workdir_parent:
yaml
# Example configuration file, it's safe to copy this as the default config file without any modification.
# You don't have to copy this file to your instance,
# just run `./act_runner generate-config > config.yaml` to generate a config file.
log:
# The level of logging, can be trace, debug, info, warn, error, fatal
level: info
runner:
# Where to store the registration result.
file: .runner
# Execute how many tasks concurrently at the same time.
capacity: 1
# Extra environment variables to run jobs.
envs:
A_TEST_ENV_NAME_1: a_test_env_value_1
A_TEST_ENV_NAME_2: a_test_env_value_2
# Extra environment variables to run jobs from a file.
# It will be ignored if it's empty or the file doesn't exist.
env_file: .env
# The timeout for a job to be finished.
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
timeout: 3h
# The timeout for the runner to wait for running jobs to finish when shutting down.
# Any running jobs that haven't finished after this timeout will be cancelled.
shutdown_timeout: 0s
# Whether skip verifying the TLS certificate of the Gitea instance.
insecure: false
# The timeout for fetching the job from the Gitea instance.
fetch_timeout: 5s
# The interval for fetching the job from the Gitea instance.
fetch_interval: 2s
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
# Like: "macos-arm64:host" or "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
# Find more images provided by Gitea at https://gitea.com/docker.gitea.com/runner-images .
# If it's empty when registering, it will ask for inputting labels.
# If it's empty when execute `daemon`, will use labels in `.runner` file.
labels:
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
cache:
# Enable cache server to use actions/cache.
enabled: true
# The directory to store the cache data.
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
dir: ""
# The host of the cache server.
# It's not for the address to listen, but the address to connect from job containers.
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
host: ""
# The port of the cache server.
# 0 means to use a random available port.
port: 0
# The external cache server URL. Valid only when enable is true.
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
# The URL should generally end with "/".
external_server: ""
container:
# Specifies the network to which the container will connect.
# Could be host, bridge or the name of a custom network.
# If it's empty, act_runner will create a network automatically.
network: ""
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
privileged: false
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
options:
# The parent directory of a job's working directory.
# NOTE: There is no need to add the first '/' of the path as act_runner will add it automatically.
# If the path starts with '/', the '/' will be trimmed.
# For example, if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir
# If it's empty, /workspace will be used.
workdir_parent:
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
# You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
# For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
# valid_volumes:
# - data
# - /src/*.json
# If you want to allow any volume, please use the following configuration:
# valid_volumes:
# - '**'
valid_volumes: []
# overrides the docker client host with the specified one.
# If it's empty, act_runner will find an available docker host automatically.
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
docker_host: ""
# Pull docker image(s) even if already present
force_pull: true
# Rebuild docker image(s) even if already present
force_rebuild: false
host:
# The parent directory of a job's working directory.
# If it's empty, $HOME/.cache/act/ will be used.
workdir_parent: