From a3f6a7e4c2d7a21c0ae22277d91999aa1393bcc7 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Mon, 5 Jun 2023 15:12:04 +0800 Subject: [PATCH 1/4] Introduce how to configure cache when starting a Runner with Docker image --- .../doc/usage/actions/act-runner.en-us.md | 23 +++++++++++++++++++ .../doc/usage/actions/act-runner.zh-cn.md | 22 ++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/docs/content/doc/usage/actions/act-runner.en-us.md b/docs/content/doc/usage/actions/act-runner.en-us.md index ef8ed35019ff..bfda7d1b0294 100644 --- a/docs/content/doc/usage/actions/act-runner.en-us.md +++ b/docs/content/doc/usage/actions/act-runner.en-us.md @@ -172,6 +172,29 @@ It is because the act runner will run jobs in docker containers, so it needs to As mentioned, you can remove it if you want to run jobs in the host directly. To be clear, the "host" actually means the container which is running the act runner now, instead of the host machine. +### Configuring cache when starting a Runner with Docker image +When starting a runner using a Docker image, it is essential to configure the cache action to ensure its proper functioning. Follow these steps: +1. Obtain the LAN IP address of the host machine where the runner container is located. +2. Find an available port number on the host machine where the runner container is running. +3. Configure the following settings in the configuration file: +```yaml +cache: + enabled: true + dir: "" + # Use the LAN IP obtained in step 1 + host: "192.168.8.17" + # Use the port number obtained in step 2 + port: 8088 + +``` +4. When starting the container, map the cache port to the host machine: +```bash +docker run \ + --name gitea-docker-runner \ + -p 8088:8088 \ + -d gitea/act_runner:nightly +``` + ### Labels The labels of a runner are used to determine which jobs the runner can run, and how to run them. diff --git a/docs/content/doc/usage/actions/act-runner.zh-cn.md b/docs/content/doc/usage/actions/act-runner.zh-cn.md index dc73f4cd6fb8..a1cc74bdfc0f 100644 --- a/docs/content/doc/usage/actions/act-runner.zh-cn.md +++ b/docs/content/doc/usage/actions/act-runner.zh-cn.md @@ -169,6 +169,28 @@ docker run \ 如前所述,如果要在主机上直接运行Job,可以将其移除。 需要明确的是,这里的 "主机" 实际上指的是当前运行 Act Runner的容器,而不是主机机器本身。 +### 当你使用 Docker 镜像启动 Runner,如何配置 Cache +当您使用 Docker 镜像启动 Runner,如果不进行以下配置,cache action 将无法正常工作。 +1. 获取 Runner 容器所在主机的 LAN(本地局域网) IP 地址。 +2. 获取一个 Runner 容器所在主机的空闲端口号。 +3. 在配置文件中如下配置: +```yaml +cache: +enabled: true +dir: "" +# 使用步骤 1. 获取的 LAN IP +host: "192.168.8.17" +# 使用步骤 2. 获取的端口号 +port: 8088 +``` +4. 启动容器时, 将 Cache 端口映射至主机。 +```bash +docker run \ + --name gitea-docker-runner \ + -p 8088:8088 \ + -d gitea/act_runner:nightly +``` + ### 标签 Runner的标签用于确定Runner可以运行哪些Job以及如何运行它们。 From b94f67acedd2cd0b255b7de08491d2bc1cc7395e Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Mon, 5 Jun 2023 15:21:20 +0800 Subject: [PATCH 2/4] update --- docs/content/doc/usage/actions/act-runner.zh-cn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/usage/actions/act-runner.zh-cn.md b/docs/content/doc/usage/actions/act-runner.zh-cn.md index a1cc74bdfc0f..89c4fe75e184 100644 --- a/docs/content/doc/usage/actions/act-runner.zh-cn.md +++ b/docs/content/doc/usage/actions/act-runner.zh-cn.md @@ -169,7 +169,7 @@ docker run \ 如前所述,如果要在主机上直接运行Job,可以将其移除。 需要明确的是,这里的 "主机" 实际上指的是当前运行 Act Runner的容器,而不是主机机器本身。 -### 当你使用 Docker 镜像启动 Runner,如何配置 Cache +### 当您使用 Docker 镜像启动 Runner,如何配置 Cache 当您使用 Docker 镜像启动 Runner,如果不进行以下配置,cache action 将无法正常工作。 1. 获取 Runner 容器所在主机的 LAN(本地局域网) IP 地址。 2. 获取一个 Runner 容器所在主机的空闲端口号。 From f763f5890629e823dd280fc9de84124b620e9c65 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Mon, 5 Jun 2023 15:36:30 +0800 Subject: [PATCH 3/4] fix lint --- docs/content/doc/usage/actions/act-runner.en-us.md | 14 +++++++++----- docs/content/doc/usage/actions/act-runner.zh-cn.md | 13 +++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/content/doc/usage/actions/act-runner.en-us.md b/docs/content/doc/usage/actions/act-runner.en-us.md index bfda7d1b0294..6a5d66b9b11e 100644 --- a/docs/content/doc/usage/actions/act-runner.en-us.md +++ b/docs/content/doc/usage/actions/act-runner.en-us.md @@ -173,10 +173,13 @@ As mentioned, you can remove it if you want to run jobs in the host directly. To be clear, the "host" actually means the container which is running the act runner now, instead of the host machine. ### Configuring cache when starting a Runner with Docker image + When starting a runner using a Docker image, it is essential to configure the cache action to ensure its proper functioning. Follow these steps: -1. Obtain the LAN IP address of the host machine where the runner container is located. -2. Find an available port number on the host machine where the runner container is running. -3. Configure the following settings in the configuration file: + +- 1.Obtain the LAN IP address of the host machine where the runner container is located. +- 2.Find an available port number on the host machine where the runner container is running. +- 3.Configure the following settings in the configuration file: + ```yaml cache: enabled: true @@ -185,9 +188,10 @@ cache: host: "192.168.8.17" # Use the port number obtained in step 2 port: 8088 - ``` -4. When starting the container, map the cache port to the host machine: + +- 4.When starting the container, map the cache port to the host machine: + ```bash docker run \ --name gitea-docker-runner \ diff --git a/docs/content/doc/usage/actions/act-runner.zh-cn.md b/docs/content/doc/usage/actions/act-runner.zh-cn.md index 89c4fe75e184..c2b49e59b427 100644 --- a/docs/content/doc/usage/actions/act-runner.zh-cn.md +++ b/docs/content/doc/usage/actions/act-runner.zh-cn.md @@ -170,10 +170,13 @@ docker run \ 需要明确的是,这里的 "主机" 实际上指的是当前运行 Act Runner的容器,而不是主机机器本身。 ### 当您使用 Docker 镜像启动 Runner,如何配置 Cache + 当您使用 Docker 镜像启动 Runner,如果不进行以下配置,cache action 将无法正常工作。 -1. 获取 Runner 容器所在主机的 LAN(本地局域网) IP 地址。 -2. 获取一个 Runner 容器所在主机的空闲端口号。 -3. 在配置文件中如下配置: + +- 1.获取 Runner 容器所在主机的 LAN(本地局域网) IP 地址。 +- 2.获取一个 Runner 容器所在主机的空闲端口号。 +- 3.在配置文件中如下配置: + ```yaml cache: enabled: true @@ -183,7 +186,9 @@ host: "192.168.8.17" # 使用步骤 2. 获取的端口号 port: 8088 ``` -4. 启动容器时, 将 Cache 端口映射至主机。 + +- 4.启动容器时, 将 Cache 端口映射至主机。 + ```bash docker run \ --name gitea-docker-runner \ From 54c185dec2e463ab49ab5e3cc82819b02f3dc7c9 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Mon, 5 Jun 2023 16:13:50 +0800 Subject: [PATCH 4/4] add why configure --- docs/content/doc/usage/actions/act-runner.en-us.md | 13 ++++++++++--- docs/content/doc/usage/actions/act-runner.zh-cn.md | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/content/doc/usage/actions/act-runner.en-us.md b/docs/content/doc/usage/actions/act-runner.en-us.md index 6a5d66b9b11e..888b4cca36a7 100644 --- a/docs/content/doc/usage/actions/act-runner.en-us.md +++ b/docs/content/doc/usage/actions/act-runner.en-us.md @@ -172,11 +172,18 @@ It is because the act runner will run jobs in docker containers, so it needs to As mentioned, you can remove it if you want to run jobs in the host directly. To be clear, the "host" actually means the container which is running the act runner now, instead of the host machine. -### Configuring cache when starting a Runner with Docker image +### Configuring cache when starting a Runner using docker image -When starting a runner using a Docker image, it is essential to configure the cache action to ensure its proper functioning. Follow these steps: +If you do not intend to use `actions/cache` in workflow, you can ignore this section. -- 1.Obtain the LAN IP address of the host machine where the runner container is located. +If you use `actions/cache` without any additional configuration, it will return the following error: +> Failed to restore: getCacheEntry failed: connect ETIMEDOUT : + +The error occurs because the runner container and job container are on different networks, so the job container cannot access the runner container. + +Therefore, it is essential to configure the cache action to ensure its proper functioning. Follow these steps: + +- 1.Obtain the LAN IP address of the host machine where the runner container is running. - 2.Find an available port number on the host machine where the runner container is running. - 3.Configure the following settings in the configuration file: diff --git a/docs/content/doc/usage/actions/act-runner.zh-cn.md b/docs/content/doc/usage/actions/act-runner.zh-cn.md index c2b49e59b427..3230eecb2b4a 100644 --- a/docs/content/doc/usage/actions/act-runner.zh-cn.md +++ b/docs/content/doc/usage/actions/act-runner.zh-cn.md @@ -171,7 +171,13 @@ docker run \ ### 当您使用 Docker 镜像启动 Runner,如何配置 Cache -当您使用 Docker 镜像启动 Runner,如果不进行以下配置,cache action 将无法正常工作。 +如果你不打算在工作流中使用 `actions/cache`,你可以忽略本段。 + +如果您在使用 `actions/cache` 时没有进行额外的配置,将会返回以下错误信息: +> Failed to restore: getCacheEntry failed: connect ETIMEDOUT : + +这个错误的原因是 runner 容器和作业容器位于不同的网络中,因此作业容器无法访问 runner 容器。 +因此,配置 cache 动作以确保其正常运行是非常重要的。请按照以下步骤操作: - 1.获取 Runner 容器所在主机的 LAN(本地局域网) IP 地址。 - 2.获取一个 Runner 容器所在主机的空闲端口号。