1) Cache act_runner phải nằm trên volume. Mặc định cache.dir rỗng -> act_runner ghi vào $HOME/.cache/actcache, tức WRITABLE LAYER của container. Đo thực tế trên ba máy: 278 GB / 95 GB / 32 GB nằm ở đó, mất sạch chỉ với một lệnh docker compose up -d. Thêm volume runner-cache mount vào /cache và đặt cache.dir="/cache". Hai chỗ này phải luôn đổi cùng nhau. 2) Ghim image theo digest thay vì :nightly. Tag tự cập nhật nghĩa là compose pull có thể tạo lại container sau lưng, kéo theo mất cache. Nâng cấp có chủ đích: đổi digest, commit, rồi mới áp dụng. 3) XOÁ runner.sh. Nó lỗi thời (đã thay bằng docker compose) và quan trọng hơn: nó chứa GITEA_RUNNER_REGISTRATION_TOKEN dạng plaintext đã commit vào git. Ai có token đó đăng ký được runner vào Gitea, tức chạy job tuỳ ý trên hạ tầng này. XOÁ FILE LÀ CHƯA ĐỦ - token vẫn nằm trong lịch sử git, BẮT BUỘC phải thu hồi và cấp lại token trong Gitea. 4) README: bổ sung bước clone cho máy builder mới, cảnh báo phải kiểm tra job đang chạy trước khi tạo lại runner (tạo lại là mồ côi job đang chạy), và phần dọn rác trong DinD (image/volume/build cache không tự dọn - một máy đo được 515 image thừa và 71 GB build cache).
57 lines
2.0 KiB
YAML
57 lines
2.0 KiB
YAML
log:
|
|
level: info
|
|
|
|
runner:
|
|
# Run multiple jobs concurrently. Overridden by env at compose level too.
|
|
capacity: 4
|
|
timeout: 3h
|
|
# Keep the runner alive; jobs are ephemeral containers.
|
|
insecure: false
|
|
# Env injected into every job. Speeds up Rust builds.
|
|
envs:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: "0"
|
|
CARGO_NET_RETRY: "10"
|
|
fetch_timeout: 5s
|
|
fetch_interval: 2s
|
|
# Labels decide which docker image runs each job. Jobs use `runs-on: ubuntu-latest`.
|
|
labels:
|
|
- "ubuntu-latest:docker://catthehacker/ubuntu:act-22.04"
|
|
- "ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04"
|
|
- "ubuntu-24.04:docker://catthehacker/ubuntu:act-24.04"
|
|
|
|
cache:
|
|
# Built-in cache server so actions/cache works (Rust deps, target/, etc.)
|
|
enabled: true
|
|
# PHẢI trỏ vào volume. Để rỗng thì act_runner ghi vào $HOME/.cache/actcache
|
|
# tức writable layer của container -> mất sạch mỗi lần container bị tạo lại.
|
|
# Phải khớp với mount runner-cache:/cache trong docker-compose.yml.
|
|
dir: "/cache"
|
|
# Empty host -> auto-detect outbound IP reachable from job containers.
|
|
host: ""
|
|
port: 0
|
|
|
|
container:
|
|
# Talk to the DinD daemon, not the host.
|
|
network: ""
|
|
privileged: false
|
|
options: ""
|
|
workdir_parent: ""
|
|
# Allow workflows to mount caches from the DinD volume.
|
|
valid_volumes:
|
|
- "**"
|
|
# act_runner bind-mounts this path (from its own container's filesystem) into
|
|
# every job/service container as /var/run/docker.sock -- it does not pass
|
|
# DOCKER_HOST through as an env var, and only unix:// (or bare) paths are
|
|
# recognized (see getDockerDaemonSocketMountPath in act_runner's source; a
|
|
# "tcp://" value is silently treated as unknown and falls back to the
|
|
# nonexistent default path). This is dind's docker.sock exposed over the
|
|
# dind-sock volume shared between the dind and runner services in
|
|
# docker-compose.yml, so job steps that call `docker` directly (e.g. `docker
|
|
# build`) reach the real DinD daemon.
|
|
docker_host: "unix:///dind-sock/docker.sock"
|
|
force_pull: false
|
|
|
|
host:
|
|
workdir_parent: ""
|