From 8f872a636d0f4ebc0852ac135a69c40f0f82bd72 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Tue, 24 Dec 2024 20:32:57 +0000 Subject: [PATCH] Document for `GITEA_RUNNER_REGISTRATION_TOKEN` env (#132) Co-authored-by: Lunny Xiao Reviewed-on: https://gitea.com/gitea/docs/pulls/132 Reviewed-by: Lunny Xiao Co-authored-by: Zettat123 Co-committed-by: Zettat123 --- docs/usage/actions/act-runner.md | 10 ++++++++++ .../current/usage/actions/act-runner.md | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/usage/actions/act-runner.md b/docs/usage/actions/act-runner.md index 9c940724..d57090fa 100644 --- a/docs/usage/actions/act-runner.md +++ b/docs/usage/actions/act-runner.md @@ -62,6 +62,16 @@ A registration token can also be obtained from the gitea [command-line interface gitea --config /etc/gitea/app.ini actions generate-runner-token ``` +You can also use `GITEA_RUNNER_REGISTRATION_TOKEN`/`GITEA_RUNNER_REGISTRATION_TOKEN_FILE` environment variable to set a global runner registration token when Gitea starts, for example: + +``` +openssl rand -hex 24 > /some-dir/runner-token +export GITEA_RUNNER_REGISTRATION_TOKEN_FILE=/some-dir/runner-token +./gitea --config ... +``` + +The token from environment is valid until you reset the token (re-create a new one) via web UI or API. + Tokens are valid for registering multiple runners, until they are revoked and replaced by a new token using the token reset link in the web interface. ### Configuration diff --git a/i18n/zh-cn/docusaurus-plugin-content-docs/current/usage/actions/act-runner.md b/i18n/zh-cn/docusaurus-plugin-content-docs/current/usage/actions/act-runner.md index d6c38bf6..5d9f1aa6 100644 --- a/i18n/zh-cn/docusaurus-plugin-content-docs/current/usage/actions/act-runner.md +++ b/i18n/zh-cn/docusaurus-plugin-content-docs/current/usage/actions/act-runner.md @@ -106,6 +106,22 @@ Runner级别决定了从哪里获取注册令牌。 注册令牌也可以通过 Gitea 的 [命令行](../../administration/command-line.md#actions-generate-runner-token) 获得: +``` +gitea --config /etc/gitea/app.ini actions generate-runner-token +``` + +用户也可以使用 `GITEA_RUNNER_REGISTRATION_TOKEN` 或 `GITEA_RUNNER_REGISTRATION_TOKEN_FILE` 环境变量以在 Gitea 启动时设置全局的注册令牌,例如: + +``` +openssl rand -hex 24 > /some-dir/runner-token +export GITEA_RUNNER_REGISTRATION_TOKEN_FILE=/some-dir/runner-token +./gitea --config ... +``` + +来自环境变量的令牌在通过 Web 界面或 API 重置(重新创建新令牌)前将一直有效。 + +令牌可用于注册多个 Runner,直到使用 Web 界面中的令牌重置链接将其撤销并替换为新令牌。 + ### 注册Runner 可以通过运行以下命令来注册Act Runner: