diff --git a/.gitattributes b/.gitattributes index 5e700166..bda0a0c0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ * text=auto eol=lf +tests/fixtures/ci-sources/sources/** -text -whitespace # Official fixture captures keep their original bytes and vendor formatting. tests/fixtures/official-model-registry/sources/** -text -whitespace docs/embedded-browser-development-evidence/** -text whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol diff --git a/docs/CI-SOURCES.md b/docs/CI-SOURCES.md new file mode 100644 index 00000000..a44c7482 --- /dev/null +++ b/docs/CI-SOURCES.md @@ -0,0 +1,15 @@ +# CI 官方来源与执行范围 + +2026-11-07,承接 [M2 CI 计划](M2-CI-PLAN.md)。GitAtlas 公开只读 API 实返 Gitea **1.26.2**、当前仓库 `has_actions=true`;运行/runner 接口匿名均 HTTP 401,没有据此确认可用 runner。仓库 API 当前 `private=false` 作为观察保留,未修改其配置。 + +采用同一 1.26 文档系列(页面当前标注 1.26.4)的官方原文,逐份响应/原字节/SHA 保存于 `tests/fixtures/ci-sources/SOURCE.json`。它们解释工作流契约,不是本仓库远端执行回执: + +- [Quick Start](https://docs.gitea.com/1.26/usage/actions/quickstart/):工作流位于 `.gitea/workflows/`,实例/仓库 Actions 与已注册 runner 均为运行前置条件。 +- [Act Runner](https://docs.gitea.com/1.26/usage/actions/act-runner/):`runs-on` 匹配标签;Windows 使用明确的 `:host` 标签。默认容器的 Node 16 不满足本产品 Node 24 的构建身份。 +- [与 GitHub Actions 的差异](https://docs.gitea.com/1.26/usage/actions/comparison/):支持完整 action URL;不能依赖尚不支持的 workflow `timeout-minutes`/复杂 `runs-on` 等语法来判定执行结果。 + +原无尾斜杠入口的 308、旧 runner 路径的 301、所有匿名 401 及本次公开 API 原响应保留在 `.qa/m2-ci-2026-11-07/`,未跟随到带凭据的地址。无账户 token、真实模型 Key 或模型请求。 + +官方模型回归复用 I15 注册表、I14 请求版本/头和 I09/I11 原生缓存/状态的固定原件;新 CI 检查将其来源、规格版本、字段和弃用变化关联到实际回归输入。夹具及受控本机 HTTP 结果不代表官方服务、代理或真实模型自主交付已通过。 + +可移植契约检查与 Windows 全源码/实际桌面/隔离安装检查分别报告,环境缺失必须失败,不以跳过改绿。M3 真实跨版/schema2 迁移及新处理器结果后的回退仍是独立验收,不在 CI 文档中冒称正式安装完成。 diff --git a/docs/M2-CI-PLAN.md b/docs/M2-CI-PLAN.md new file mode 100644 index 00000000..ba55715c --- /dev/null +++ b/docs/M2-CI-PLAN.md @@ -0,0 +1,26 @@ +# M2 第六批:CI 与官方契约回归闭环 + +2026-11-07,基线 `470d694831c315c034e3f36891e4f3faf94cbe0f`,分支 `feat/task-agreement-1.25`,干净工作树。承接 I09/I11 已封存交付,不重做上一批。完成 I27 可重复的源码/契约/构建/安装检查入口与 I28 官方来源、版本差异及弃用的回归关联;随后 M3 单独冻结统一发行。 + +1. [complete] 固定470d6948基线/tree/锁文件/Node身份,planning catchup退出0。GitAtlas实际1.26.2且Actions启用,runner/runs匿名401,未确认执行器;1.26官方三篇HTTP200原件与重定向/401保存,见[来源](CI-SOURCES.md)。当前外部Python3.11.15缺pytest,缺环境失败原件保留。 +2. [in_progress] 实现锁定依赖/前置环境/源码身份检查和唯一输出目录,接入官方注册表原件核对及契约、版本、弃用回归;缺环境和实际失败必须非零退出。 +3. [pending] 建立 GitAtlas 工作流和可复用本地入口,区分可移植契约与 Windows 桌面/安装验证;检查源码包是否包含 CI 配置并用真实自有 Git ZIP 验证。 +4. [pending] 在独立干净源码与实际新装依赖环境执行,记录 Node/Python/Playwright/Electron 身份、原命令/失败/构建及测试结果;不以原 node_modules junction 冒充干净安装,不将本地结果称远端执行。 +5. [pending] 分阶段回顾与限定提交,核对最终输入、官方原字节、进程归属及封存记录;普通增量推送并逐 SHA 核远端。外部 runner 配置缺项需在完成具体实现和本地验证后准确列出。 + +新证据只写 `.qa/m2-ci-2026-11-07/`,原 I10/I13/I15/I14/I09-I11 封存根只读。本批不委派、不读真实模型 Key、不请求真实模型、不操作正式配置/数据/安装/重启,不续旧实验或用户工程,不安装持久 runner。公开 GitAtlas API/官方资料仅作只读调查,失败与无法确认状态均保留。 + +默认 unrestricted/passthrough/preserve 与持久 ask/auto/full 保持;CI 不恢复预算/上下文/输出/历史限制或逐步审批。W/AD/AE/AG 网络/unknown、重复读取普遍收益、R/W v2 真实剔除边界及 Purge 收益 unknown 不变。官方夹具只证明确定性契约,本批无真实供应商验证。M3 必须验证声明的 schema2 迁移增量及新处理器实际产生结果后的回退,不能删新账本或直接移除逐表全等守卫。 + +## 调查与原失败 + +- 接续读取组合输出过大导致工具截断,随后限定相关段落;未改产品或旧证据。 +- PowerShell 未引用的 `HEAD^{tree}` 被解释为脚本块,Git 调查失败;改用引号固定 revision 参数,未产生提交或数据改动。 +- 只读调查误猜 `visible-browser.test` / `request-contract.test` / `browser-launch` 和 PowerShell 不展开的 rg 路径通配符;改用实际文件列表,不记作产品失败。 +- GitAtlas 公开 API 实测 Gitea 1.26.2、仓库 Actions 启用;runner 和运行 API 匿名均 401,执行环境仍未知。当前仓库 API 的 `private=false` 作为观察保存,不更改用户仓库配置。 +- Gitea 无尾斜杠/旧 runner 入口返回 308/301,原件保持;另取对应 1.26 官方三篇 HTTP 200 正文,不能将重定向当原正文通过。 +- 外部Python3.11.15当前缺pytest,`import pytest`实收ModuleNotFoundError;计划新建独立QA环境并按带哈希的锁文件安装,不污染原解释器环境。 +- 来源准备首轮把Colorama实际`py2.py3`通用wheel误判为缺wheel;未处理的并行失败使其余部分响应未落盘。第二轮误假设所有响应都存在,实收ENOENT。第三轮顺序复用已存原件并仅补缺失PyPI元数据,7个精确wheel及SHA已固定;两原脚本/失败保持,不改成通过。 +- Checkout原metadata HTTPS首次fetch失败、第二次45秒超时、第三次公开Git clone连接被重置(128);第四次Gitea官方actions镜像按同一v4.2.2 commit取得HTTP200原metadata。四记录分开,不能称GitHub网络已恢复;工作流采用同commit镜像URL。 +- YAML依赖准备器首相对import多退一级,实收ERR_MODULE_NOT_FOUND;原脚本保持,第二轮正确import成功,只新增yaml和根依赖声明两个lock条目。 +- 官方快照首准备器把已有受控同级fixture引用误判为逃逸;原helper保存,改为整个固定`tests/fixtures`范围,仍逐原字节SHA核对,未改原SOURCE.json或来源正文。 diff --git a/findings.md b/findings.md index d0261dac..b98ede24 100644 --- a/findings.md +++ b/findings.md @@ -1,5 +1,9 @@ # 汇总发现 +I27/I28公开只读调查:GitAtlas实返Gitea1.26.2、仓库has_actions=true;当前API公开private=false,不擅自修改可见性。Actions运行与runner接口匿名均401,不能据此断言有可用执行器。已保存1.26版quickstart/act-runner/comparison三份HTTP200原HTML及SHA;最新入口的308/301亦保持,不当正文成功。本地固定Node24.22.1已核,planning catchup退出0无补遗。 + +I27/I28初核:现有构建依赖Node24与dist-server,Python测试需独立pytest8.4.2,Playwright/Electron版本锁在package-lock;没有既有.gitea/.github工作流,GitAtlas Actions版本/启用/runner未知。源码包按目录白名单导出,暂不含.gitea,需要实际Git ZIP核对。历史manual/restricted fixture保留,不能为CI删除旧断言或以原依赖junction宣称干净安装。 + I09/I11封存收口:5126原件、2008555583字节、5依赖junction不递归;原四M2根16171原件/manifest只读一致,22源码Git字节一致,实际候选进程/记录非正式端口监听0。源码/隔离验收完成与正式部署/真实缓存/Purge收益分别记录;下一CI后M3必须验证迁移增量与新结果回退。封存后误用Tianshu文档标题的失败patch只记录在新close/当前进展,不回写原证据根。 I09/I11最终Electron通过且实际复看1280新池编辑与390任务上下文:现有Orven布局/中文/长SHA/下拉与真实保存保留,输出“本次不限/不附加上限/由上游处理”与冻结状态分别呈现。网页绿/紫状态图亦复看,三配色和窄屏保持一致。两个端各5本机POST、3成功/2原400,6账本含原unknown;完成工具1、不重放,原metadata/cipher/snapshot/history全部exact。本批不证明真实缓存命中/上游普遍兼容。 diff --git a/progress.md b/progress.md index feba07ff..70d0f887 100644 --- a/progress.md +++ b/progress.md @@ -1,5 +1,11 @@ # 统一执行进度 +I27/I28阶段1来源固定:7份CI官方正文/action元数据、4 action逐commit的ls-remote、7个PyPI通用wheel精确SHA完成。Python准备器首Colorama标签与第二轮误认为并行响应已齐的失败保留,第三轮只补缺文件,未污染外部Python。Mnemo指定v1 README SHA一致,已写本地只读字段/接入依赖反馈,当前不接入/请求/回复源线程或混入CI提交。下一实现统一入口、官方规格差异与缺环境非零退出。 + +I27/I28调查2完成:基线tree cf362e31固定,GitAtlas匿名版本/仓库API成功,1.26.2且Actions启用,runner/runs均401;不提取账户token或安装runner。取得对应版本三官方正文,原重定向/失败完整记录。几次调查误猜测试/浏览器模块名和PowerShell通配符路径已保留为读取错误,后续只用rg实际文件列表;产品未修改。下一固定来源并实现可重复检查入口与官方更新回归。 + +I27/I28阶段1开始:470d6948干净,已读AGENTS/采用计划/1.25计划/路线和现有构建、源码打包、Python/官方注册表检查;规划catchup及固定Node身份核对。新证据根独立创建,尚未请求真实模型/Key/正式服务或GitAtlas API。接续输出过大截断、PowerShell未引用tree revision的只读调查错误已记入新计划;不重做I09/I11。 + I09/I11阶段1–5完成:71f18055/9e1feeeb/ee97aaae及验收1a897576已普通增量推送、远端逐SHA一致;5126原件/880输入/29编译/20图与22Git输入保持,原四根16171项只读exact。当前只提交回执和完成接续再普通推送核对;下一I27/I28 CI,然后M3迁移增量/新结果回退。不部署/重启/模型/Key/旧实验或原封存写入,历史unknown保持。 I09/I11 UI源码ee97aaae已限定提交,22变更冻结输入/Git原字节复核通过;5126份2008555583字节封存,MANIFEST c887364e54fe3f68e5f432155db87517fb8413966f5786156bedceddadbf2217,旧四根16171项只读exact,自有进程及记录非正式端口监听0。当前验收/机器记录/接续入口提交及普通GitAtlas增量推送收尾;新封存根只读,后续写独立close根。一次接续文档patch误用Tianshu标题整体未应用,按实际标题重做,不追加原封存。 diff --git a/task_plan.md b/task_plan.md index ab9c6ab9..976d3072 100644 --- a/task_plan.md +++ b/task_plan.md @@ -1,5 +1,7 @@ # Agent Workbench:核心代理能力研究与产品计划 +M2第六批I27/I28开始:基线470d6948干净/远端一致,见[CI计划](docs/M2-CI-PLAN.md)。先查GitAtlas实际执行能力,再建立锁定依赖、官方来源/契约、源码身份及构建/安装的可重复入口,独立干净安装验收;不能以缺环境跳过改绿或把本地结果当远端通过。新证据根`.qa/m2-ci-2026-11-07/`,原各批封存只读,不委派/正式操作/真实模型/Key或续旧工程。随后M3统一发行,历史unknown保持。 + M2 I09/I11阶段1–4完成:来源71f18055/核心9e1feeeb/界面ee97aaae,见[验收](docs/QA-M2-NATIVE-CACHE-STATE.md)。880输入/29编译/74runtime、两端各8组/10图、原metadata/cipher/snapshot/history exact,5126原件已封存;source-5为16/16,首127/129与两文件26/26按SHA分别保留。阶段5已封存/回顾并普通增量推送,1a897576远端逐SHA一致,见[回执](docs/gitatlas-m2-native-cache-state-push.json);完成接续最后另提交核对。下一I27/I28 CI,后续M3实际schema2迁移增量及新处理器结果后回退,不删除新账本或移除原保持守卫。正式/真实Key/模型/旧实验/历史unknown不动。 M2第五批I09/I11已从bdfeb29c干净基线开始,见[原生缓存与状态计划](docs/M2-NATIVE-CACHE-STATE-PLAN.md):保留Messages块/工具注解及原生历史,配置会话/Task/Run亲和,状态按实际协议/地址/型号/凭据/版本身份核对;旧历史不改写,亲和/同指纹不当作缓存命中。随后CI及M3真实迁移增量/结果后回退。无真实模型/Key/正式写入/委派,历史unknown保持。 diff --git a/tests/fixtures/ci-sources/SOURCE.json b/tests/fixtures/ci-sources/SOURCE.json new file mode 100644 index 00000000..963ab201 --- /dev/null +++ b/tests/fixtures/ci-sources/SOURCE.json @@ -0,0 +1,95 @@ +{ + "schemaVersion": 1, + "checkedAt": "2026-11-07", + "observedInstance": { + "version": "1.26.2", + "actionsEnabled": true, + "runnerAvailability": "unknown" + }, + "sources": [ + { + "id": "action-checkout", + "url": "https://gitea.com/actions/checkout/raw/commit/11bd71901bbe5b1630ceea73d27597364c9af683/action.yml", + "checkedAt": "2026-11-07", + "file": "sources/action-checkout.yml", + "sha256": "5349b6eea0a1797a9a993c48db9d95b33d27ee1b6227ceced0c9cbf8e655c939", + "bytes": 4593, + "representation": "original-action-metadata-from-gitea-actions-mirror", + "commit": "11bd71901bbe5b1630ceea73d27597364c9af683", + "repository": "https://github.com/actions/checkout", + "scope": "same immutable commit verified by public GitHub v4.2.2 ref; first raw-fetch/clone failures remain" + }, + { + "id": "action-setup-node", + "url": "https://raw.githubusercontent.com/actions/setup-node/49933ea5288caeca8642d1e84afbd3f7d6820020/action.yml", + "checkedAt": "2026-11-07", + "file": "sources/action-setup-node.yml", + "sha256": "8aee59063ebc272d850507febb30930de2684be1b1240cf5f3dff13179fcff0b", + "bytes": 2614, + "representation": "original-action-metadata", + "commit": "49933ea5288caeca8642d1e84afbd3f7d6820020", + "repository": "https://github.com/actions/setup-node", + "scope": "pinned action metadata; remote execution still unverified" + }, + { + "id": "action-setup-python", + "url": "https://raw.githubusercontent.com/actions/setup-python/a26af69be951a213d495a4c3e4e4022e16d87065/action.yml", + "checkedAt": "2026-11-07", + "file": "sources/action-setup-python.yml", + "sha256": "0acca40eee6f548ea8269ece66fd625fe9deb1f61f31f0b58562068fc083eb37", + "bytes": 2364, + "representation": "original-action-metadata", + "commit": "a26af69be951a213d495a4c3e4e4022e16d87065", + "repository": "https://github.com/actions/setup-python", + "scope": "pinned action metadata; remote execution still unverified" + }, + { + "id": "action-upload-artifact", + "url": "https://gitea.com/actions/upload-artifact/raw/commit/ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5/action.yml", + "checkedAt": "2026-11-07", + "file": "sources/action-upload-artifact.yml", + "sha256": "1516e0d1018602f83eba56c8394f60729e8163f5fde2f38efbb1019e8bdddfb3", + "bytes": 1150, + "representation": "original-action-metadata", + "commit": "ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5", + "repository": "https://gitea.com/actions/upload-artifact", + "scope": "pinned action metadata; remote execution still unverified" + }, + { + "id": "gitea-126-comparison", + "url": "https://docs.gitea.com/1.26/usage/actions/comparison/", + "checkedAt": "2026-11-07", + "file": "sources/gitea-126-comparison.body", + "sha256": "cffdd051921168d1ed8990bd948ac8abadbe205ded4fbf75a739c0dae50a6c50", + "bytes": 87919, + "representation": "original-received-html", + "versionSeries": "1.26", + "documentationPatch": "1.26.4", + "scope": "workflow and runner contract, not a remote run receipt" + }, + { + "id": "gitea-126-quickstart", + "url": "https://docs.gitea.com/1.26/usage/actions/quickstart/", + "checkedAt": "2026-11-07", + "file": "sources/gitea-126-quickstart.body", + "sha256": "0e43166b786de4eedf54839231a312f8d3933ed7ba350712d5a1f54c01a1fb59", + "bytes": 73731, + "representation": "original-received-html", + "versionSeries": "1.26", + "documentationPatch": "1.26.4", + "scope": "workflow and runner contract, not a remote run receipt" + }, + { + "id": "gitea-126-runner", + "url": "https://docs.gitea.com/1.26/usage/actions/act-runner/", + "checkedAt": "2026-11-07", + "file": "sources/gitea-126-runner.body", + "sha256": "9b1d81d3648a5572817c91e61c3a9c6c526cdb05b8150d21a9de4a6a6baa9c1d", + "bytes": 158980, + "representation": "original-received-html", + "versionSeries": "1.26", + "documentationPatch": "1.26.4", + "scope": "workflow and runner contract, not a remote run receipt" + } + ] +} diff --git a/tests/fixtures/ci-sources/sources/action-checkout.yml b/tests/fixtures/ci-sources/sources/action-checkout.yml new file mode 100644 index 00000000..6842eb84 --- /dev/null +++ b/tests/fixtures/ci-sources/sources/action-checkout.yml @@ -0,0 +1,109 @@ +name: 'Checkout' +description: 'Checkout a Git repository at a particular version' +inputs: + repository: + description: 'Repository name with owner. For example, actions/checkout' + default: ${{ github.repository }} + ref: + description: > + The branch, tag or SHA to checkout. When checking out the repository that + triggered a workflow, this defaults to the reference or SHA for that + event. Otherwise, uses the default branch. + token: + description: > + Personal access token (PAT) used to fetch the repository. The PAT is configured + with the local git config, which enables your scripts to run authenticated git + commands. The post-job step removes the PAT. + + + We recommend using a service account with the least permissions necessary. + Also when generating a new PAT, select the least scopes necessary. + + + [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) + default: ${{ github.token }} + ssh-key: + description: > + SSH key used to fetch the repository. The SSH key is configured with the local + git config, which enables your scripts to run authenticated git commands. + The post-job step removes the SSH key. + + + We recommend using a service account with the least permissions necessary. + + + [Learn more about creating and using + encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) + ssh-known-hosts: + description: > + Known hosts in addition to the user and global host key database. The public + SSH keys for a host may be obtained using the utility `ssh-keyscan`. For example, + `ssh-keyscan github.com`. The public key for github.com is always implicitly added. + ssh-strict: + description: > + Whether to perform strict host key checking. When true, adds the options `StrictHostKeyChecking=yes` + and `CheckHostIP=no` to the SSH command line. Use the input `ssh-known-hosts` to + configure additional hosts. + default: true + ssh-user: + description: > + The user to use when connecting to the remote SSH host. By default 'git' is used. + default: git + persist-credentials: + description: 'Whether to configure the token or SSH key with the local git config' + default: true + path: + description: 'Relative path under $GITHUB_WORKSPACE to place the repository' + clean: + description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching' + default: true + filter: + description: > + Partially clone against a given filter. + Overrides sparse-checkout if set. + default: null + sparse-checkout: + description: > + Do a sparse checkout on given patterns. + Each pattern should be separated with new lines. + default: null + sparse-checkout-cone-mode: + description: > + Specifies whether to use cone-mode when doing a sparse checkout. + default: true + fetch-depth: + description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.' + default: 1 + fetch-tags: + description: 'Whether to fetch tags, even if fetch-depth > 0.' + default: false + show-progress: + description: 'Whether to show progress status output when fetching.' + default: true + lfs: + description: 'Whether to download Git-LFS files' + default: false + submodules: + description: > + Whether to checkout submodules: `true` to checkout submodules or `recursive` to + recursively checkout submodules. + + + When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are + converted to HTTPS. + default: false + set-safe-directory: + description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory ` + default: true + github-server-url: + description: The base URL for the GitHub instance that you are trying to clone from, will use environment defaults to fetch from the same instance that the workflow is running from unless specified. Example URLs are https://github.com or https://my-ghes-server.example.com + required: false +outputs: + ref: + description: 'The branch, tag or SHA that was checked out' + commit: + description: 'The commit SHA that was checked out' +runs: + using: node20 + main: dist/index.js + post: dist/index.js diff --git a/tests/fixtures/ci-sources/sources/action-setup-node.yml b/tests/fixtures/ci-sources/sources/action-setup-node.yml new file mode 100644 index 00000000..ef58e699 --- /dev/null +++ b/tests/fixtures/ci-sources/sources/action-setup-node.yml @@ -0,0 +1,43 @@ +name: 'Setup Node.js environment' +description: 'Setup a Node.js environment by adding problem matchers and optionally downloading and adding it to the PATH.' +author: 'GitHub' +inputs: + always-auth: + description: 'Set always-auth in npmrc.' + default: 'false' + node-version: + description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.' + node-version-file: + description: 'File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.' + architecture: + description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.' + check-latest: + description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.' + default: false + registry-url: + description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.' + scope: + description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).' + token: + description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + default: ${{ github.server_url == 'https://github.com' && github.token || '' }} + cache: + description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.' + cache-dependency-path: + description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' + mirror: + description: 'Used to specify an alternative mirror to downlooad Node.js binaries from' + mirror-token: + description: 'The token used as Authorization header when fetching from the mirror' +# TODO: add input to control forcing to pull from cloud or dist. +# escape valve for someone having issues or needing the absolute latest which isn't cached yet +outputs: + cache-hit: + description: 'A boolean value to indicate if a cache was hit.' + node-version: + description: 'The installed node version.' +runs: + using: 'node20' + main: 'dist/setup/index.js' + post: 'dist/cache-save/index.js' + post-if: success() diff --git a/tests/fixtures/ci-sources/sources/action-setup-python.yml b/tests/fixtures/ci-sources/sources/action-setup-python.yml new file mode 100644 index 00000000..efa8de90 --- /dev/null +++ b/tests/fixtures/ci-sources/sources/action-setup-python.yml @@ -0,0 +1,46 @@ +--- +name: "Setup Python" +description: "Set up a specific version of Python and add the command-line tools to the PATH." +author: "GitHub" +inputs: + python-version: + description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset." + python-version-file: + description: "File containing the Python version to use. Example: .python-version" + cache: + description: "Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry." + required: false + architecture: + description: "The target architecture (x86, x64, arm64) of the Python or PyPy interpreter." + check-latest: + description: "Set this option if you want the action to check for the latest available version that satisfies the version spec." + default: false + token: + description: "The token used to authenticate when fetching Python distributions from https://github.com/actions/python-versions. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting." + default: ${{ github.server_url == 'https://github.com' && github.token || '' }} + cache-dependency-path: + description: "Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies." + update-environment: + description: "Set this option if you want the action to update environment variables." + default: true + allow-prereleases: + description: "When 'true', a version range passed to 'python-version' input will match prerelease versions if no GA versions are found. Only 'x.y' version range is supported for CPython." + default: false + freethreaded: + description: "When 'true', use the freethreaded version of Python." + default: false +outputs: + python-version: + description: "The installed Python or PyPy version. Useful when given a version range as input." + cache-hit: + description: "A boolean value to indicate a cache entry was found" + python-path: + description: "The absolute path to the Python or PyPy executable." +runs: + using: 'node20' + main: 'dist/setup/index.js' + post: 'dist/cache-save/index.js' + post-if: success() +branding: + icon: 'code' + color: 'yellow' diff --git a/tests/fixtures/ci-sources/sources/action-upload-artifact.yml b/tests/fixtures/ci-sources/sources/action-upload-artifact.yml new file mode 100644 index 00000000..2a4671cb --- /dev/null +++ b/tests/fixtures/ci-sources/sources/action-upload-artifact.yml @@ -0,0 +1,33 @@ +name: 'Upload a Build Artifact' +description: 'Upload a build artifact that can be used by subsequent workflow steps' +author: 'GitHub' +inputs: + name: + description: 'Artifact name' + default: 'artifact' + path: + description: 'A file, directory or wildcard pattern that describes what to upload' + required: true + if-no-files-found: + description: > + The desired behavior if no files are found using the provided path. + + Available Options: + warn: Output a warning but do not fail the action + error: Fail the action with an error message + ignore: Do not output any warnings or errors, the action does not fail + default: 'warn' + retention-days: + description: > + Duration after which artifact will expire in days. 0 means using default retention. + + Minimum 1 day. + Maximum 90 days unless changed from the repository settings page. + include-hidden-files: + description: > + If true, hidden files will be included in the uploaded artifact. + If false, hidden files will be excluded from the uploaded artifact. + default: 'false' +runs: + using: 'node16' + main: 'dist/index.js' diff --git a/tests/fixtures/ci-sources/sources/gitea-126-comparison.body b/tests/fixtures/ci-sources/sources/gitea-126-comparison.body new file mode 100644 index 00000000..1b64a32c --- /dev/null +++ b/tests/fixtures/ci-sources/sources/gitea-126-comparison.body @@ -0,0 +1,132 @@ +Compared to GitHub Actions | Gitea DocumentationSkip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of 1.26.4, which is no longer the latest release. See the latest release.

Compared to GitHub Actions

Even though Gitea Actions is designed to be compatible with GitHub Actions, there are some differences between them.

+ + +

Gitea Actions supports defining actions via absolute URL, which means that you can use actions from any git repository. +Like uses: https://github.com/actions/checkout@v4 or uses: http://your_gitea.com/owner/repo@branch.

+ +

Gitea Actions supports writing actions in Go. +See Creating Go Actions.

+

Support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly on schedule

Section titled “Support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly on schedule”
+

Github Actions doesn’t support that. https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule

+ + +

See Workflow syntax for GitHub Actions.

+

It’s ignored by Gitea Actions now.

+ +

See Workflow syntax for GitHub Actions.

+

It’s ignored by Gitea Actions now.

+ +

See Workflow syntax for GitHub Actions.

+

It’s ignored by Gitea Actions now.

+ +

See Workflow syntax for GitHub Actions.

+

Gitea Actions only supports runs-on: xyz or runs-on: [xyz] now.

+ + +

The GITEA_TOKEN for a job running within a repository should be able to publish to the associated package repository (i.e. to upload OCI images). See the “packages” scope for the “default access” in Automatic token authentication.

+

This is not implemented in Gitea Actions now. A workaround for Gitea Actions is to use a Personal Access Token (PAT). See this github issue and comment for tracking this feature.

+ +

Problem Matchers are a way to scan the output of actions for a specified regex pattern and surface that information prominently in the UI. +See Problem matchers.

+

It’s ignored by Gitea Actions now.

+ +

See Creating an annotation for an error

+

It’s ignored by Gitea Actions now.

+ +

For expressions, only always() is supported.

+ + +

Pre and Post steps don’t have their own section in the job log user interface.

+ +

Services steps don’t have their own section in the job log user interface.

+ + +

Gitea supports permissions and jobs.<job_id>.permissions to control the default GITEA_TOKEN permissions.

+

The effective permissions are clamped by the repository/owner settings and are further restricted for fork pull requests and cross-repository access. +GitHub-only scopes such as statuses, checks, deployments, id-token, security-events, and pages are not supported, while Gitea-specific scopes such as code, releases, wiki, and projects are available.

+

See Actions job token permissions.

+ +

Previously (Pre 1.21.0), [actions].DEFAULT_ACTIONS_URL defaulted to https://gitea.com. +We have since restricted this option to only allow two values (github and self). +When set to github, the new default, Gitea will download non-fully-qualified actions from https://github.com. +For example, if you use uses: actions/checkout@v4, it will download the checkout repository from https://github.com/actions/checkout.git.

+

If you want to download an action from another git hoster, you can use an absolute URL, e.g. uses: https://gitea.com/actions/checkout@v4.

+

If your Gitea instance is in an intranet or a restricted area, you can set the URL to self to only download actions from your own instance by default. +Of course, you can still use absolute URLs in workflows.

+

More details about the [actions].DEFAULT_ACTIONS_URL configuration can be found in the Configuration Cheat Sheet。

+ +

Context availability is not checked, so you can use the env context on more places. +See Context availability.

+
\ No newline at end of file diff --git a/tests/fixtures/ci-sources/sources/gitea-126-quickstart.body b/tests/fixtures/ci-sources/sources/gitea-126-quickstart.body new file mode 100644 index 00000000..4e0175f2 --- /dev/null +++ b/tests/fixtures/ci-sources/sources/gitea-126-quickstart.body @@ -0,0 +1,138 @@ +Quick Start | Gitea DocumentationSkip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of 1.26.4, which is no longer the latest release. See the latest release.

Quick Start

This page will guide you through the process of using Gitea Actions.

+ +

First of all, you need a Gitea instance. +You can follow the documentation to set up a new instance or upgrade your existing one. +It doesn’t matter how you install or run Gitea, as long as its version is 1.19.0 or higher.

+

Since 1.21.0, Actions are enabled by default. If you are using versions before 1.21.0, you need to add the following to the configuration file to enable it:

+
[actions]
ENABLED=true
+

If you want to learn more or encounter any problems while configuring it, please refer to the Configuration Cheat Sheet.

+ +

Gitea Actions requires act runner to run the jobs. +In order to avoid consuming too many resources and affecting the Gitea instance, it is recommended to start runners on separate machines from the Gitea instance.

+

You can use the pre-built binaries or the docker images to set up the runner.

+

Before proceeding any further, we suggest running it as a command line with pre-built binaries to ensure that it works with your environment, especially if you are running a runner on your localhost. +And it could be easier to debug if something goes wrong.

+

The runner can run the jobs in isolated Docker containers, so you need to make sure that the Docker has been installed and Docker daemon is running. +While it is not strictly necessary, because the runner can also run the jobs directly on the host, it depends on how you configure it. +However, it is recommended to use Docker to run the jobs, because it is more secure and easier to manage.

+

Before running a runner, you should first register it to your Gitea instance using the following command:

+
Terminal window
./act_runner register --no-interactive --instance <instance> --token <token>
+

There are two arguments required, instance and token.

+

instance refers to the address of your Gitea instance, like http://192.168.8.8:3000 or https://gitea.com. +The runner and job containers (which are started by the runner to execute jobs) will connect to this address. +This means that it could be different from the ROOT_URL of your Gitea instance, which is configured for web access. +It is always a bad idea to use a loopback address such as 127.0.0.1 or localhost. +If you are unsure which address to use, the LAN address is usually the right choice.

+

token is used for authentication and identification, such as P2U1U0oB4XaRCi8azcngmPCLbRpUGapalhmddh23. +Each token can be used to create multiple runners, until it is replaced with a new token using the reset link. +You can obtain different levels of ‘tokens’ from the following places to create the corresponding level of ‘runners’:

+
    +
  • Instance level: The admin settings page, like <your_gitea.com>/-/admin/actions/runners.
  • +
  • Organization level: The organization settings page, like <your_gitea.com>/<org>/settings/actions/runners.
  • +
  • Repository level: The repository settings page, like <your_gitea.com>/<owner>/<repo>/settings/actions/runners.
  • +
+

register runner

+

After registering, a new file named .runner will appear in the current directory. +This file stores the registration information. +Please do not edit it manually. +If this file is missing or corrupted, you can simply remove it and register again.

+

Finally, it’s time to start the runner:

+
Terminal window
./act_runner daemon
+

And you can see the new runner in the management page:

+

view runner

+

You can find more information by visiting Act runner.

+ +

Even if Actions is enabled for the Gitea instance, repositories still disable Actions by default.

+

To enable it, go to the settings page of your repository like your_gitea.com/<owner>/repo/settings and enable Enable Repository Actions.

+

enable actions

+

The next steps may be rather complicated. +You will need to study the workflow syntax for Actions and write the workflow files you want.

+

However, we can just start from a simple demo:

+
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
+
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
+ +

You can upload it as a file with the extension .yaml in the directory .gitea/workflows/ of the repository, for example .gitea/workflows/demo.yaml. +You might notice that this is fairly similar from the Quickstart for GitHub Actions. +That is because Gitea Actions is designed to be compatible with GitHub Actions wherever possible.

+

Be careful, the demo file contains some emojis. +Please make sure your database supports them, especially when using MySQL. +If the charset is not utf8mb4, errors will occur, such as Error 1366 (HY000): Incorrect string value: '\\xF0\\x9F\\x8E\\x89 T...' for column 'name' at row 1. +See Database Preparation for more information.

+

Alternatively, you can remove all emojis from the demo file and try again.

+

The line on: [push] indicates that the workflow will be triggered when you push commits to this repository. +However, when you upload the YAML file, it also pushes a commit, so you should see a new task in the Actions tab.

+

view job

+

Great job! You have successfully started working with Actions.

+
\ No newline at end of file diff --git a/tests/fixtures/ci-sources/sources/gitea-126-runner.body b/tests/fixtures/ci-sources/sources/gitea-126-runner.body new file mode 100644 index 00000000..5bea62af --- /dev/null +++ b/tests/fixtures/ci-sources/sources/gitea-126-runner.body @@ -0,0 +1,256 @@ +Act Runner | Gitea DocumentationSkip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of 1.26.4, which is no longer the latest release. See the latest release.

Act Runner

This page will introduce the act runner in detail, which is the runner for Gitea Actions.

+ +

Currently the runner supports three modes in which it can be run.

+
    +
  1. Host: act_runner will run as an application on the host. This provides no encapsulation.
  2. +
  3. Docker (recommended): Runs jobs in a Docker container. If you choose this mode, you need to install Docker first and make sure that the Docker daemon is running.
  4. +
  5. Docker-in-Docker (DinD): Puts the runner into rootless mode. It then runs in a Docker container with its own Docker daemon that has fewer privileges. It will spawn job containers from there. Best security but more complex setup.
  6. +
+

Other OCI container engines which are compatible with Docker’s API should also work, but are untested.

+

However, if you are sure that you want to run jobs directly on the host only, then Docker is not required.

+

There are multiple ways to install the act runner.

+ + +

You can download the binary from the release page. +However, if you want to use the latest nightly build, you can download it from the download page.

+

When you download the binary, please make sure that you have downloaded the correct one for your platform. +You can check it by running the following command if you are in a Unix-style OS.

+
Terminal window
chmod +x act_runner
./act_runner --version
+

If you see the version information, it means that you have downloaded the correct binary.

+ +

You can register a runner at different levels. It can be:

+
    +
  • Instance level: The runner will run jobs for all repositories in the instance.
  • +
  • Organization level: The runner will run jobs for all repositories in the organization.
  • +
  • Repository level: The runner will run jobs for the repository it belongs to.
  • +
+

Note that the repository may still use instance-level or organization-level runners even if it has its own repository-level runners. A future release may provide an option to allow more control over this.

+

Before registering the runner and running it, you need a registration token. The level of the runner determines where to obtain the registration token.

+
    +
  • Instance level: The admin settings page, like <your_gitea.com>/-/admin/actions/runners.
  • +
  • Organization level: The organization settings page, like <your_gitea.com>/<org>/settings/actions/runners.
  • +
  • Repository level: The repository settings page, like <your_gitea.com>/<owner>/<repo>/settings/actions/runners.
  • +
+

If you cannot see the settings page, please make sure that you have the right permissions and that Actions have been enabled.

+

The format of the registration token is a random string D0gvfu2iHfUjNqCYVljVyRV14fISpJxxxxxxxxxx.

+

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 variables 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 the environment is valid until you reset the token (re-create a new one) via the 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 is done via a configuration file. It is optional, and the default configuration will be used when no configuration file is specified. You can generate a configuration file by running the following command:

+
Terminal window
./act_runner generate-config
+

The default configuration is safe to use without any modification, so you can just use it directly.

+
Terminal window
./act_runner generate-config > config.yaml
./act_runner --config config.yaml [command]
+ +

Registration is required before running the act runner, because the runner needs to know where to get jobs from. It is also important for the Gitea instance to identify the runner.

+

If this has been installed using the binary package, the act runner can be registered by running the following command.

+
Terminal window
./act_runner register
+

Alternatively, you can use the --config option to specify the configuration file mentioned in the previous section.

+
Terminal window
./act_runner --config config.yaml register
+

You will be asked to input the registration information step by step. This includes:

+
    +
  • The Gitea instance URL, like https://gitea.com/ or http://192.168.8.8:3000/.
  • +
  • The registration token.
  • +
  • The runner name, which is optional. If you leave it blank, the hostname will be used.
  • +
  • The runner labels, which is optional. If you leave it blank, the default labels will be used.
  • +
+

You may be confused about the runner labels, which will be explained later.

+

If you want to register the runner in a non-interactive way, you can use arguments to do it.

+
Terminal window
./act_runner register --no-interactive --instance <instance_url> --token <registration_token> --name <runner_name> --labels <runner_labels>
+

When you have registered the runner, you can find a new file named .runner in the current directory. +This file stores the registration information. +Please do not edit it manually. +If this file is missing or corrupted, you can simply remove it and register again.

+

If you want to store the registration information in another place, you can specify it in the configuration file, +and don’t forget to specify the --config option.

+ +

Ephemeral runners provide a security hardening mechanism for enabling organization- or instance-wide runners without requiring full user trust. Once a job is assigned within a spot VM or container, the runner’s exposed credentials are automatically revoked—blocking it from polling further jobs before any untrusted code runs, while still allowing it to report progress until completion by either Gitea or the runner.

+

act_runner 0.2.12+ is required.

+

The updated commands for registering the runner as ephemeral are listed below. Refer to the previous section for detailed information on registering the act_runner.

+
Terminal window
./act_runner register --ephemeral
+
Terminal window
./act_runner --config config.yaml register --ephemeral
+
Terminal window
./act_runner register --no-interactive --ephemeral --instance <instance_url> --token <registration_token> --name <runner_name> --labels <runner_labels>
+

The runner must be registered each time it is intended to receive a job. After completing the single job it is designed to execute, the runner terminates.

+

To automate the registration and startup of new runners when a job is queued, use the workflow_job webhook.

+ +

After you have registered the runner, you can run it with the following command:

+
Terminal window
./act_runner daemon
+

or

+
Terminal window
./act_runner daemon --config config.yaml
+

The runner will fetch jobs from the Gitea instance and run them automatically.

+ +

It is also possible to run act-runner as a systemd service. Create an unprivileged act_runner user on your system, and create the following file in /etc/systemd/system/act_runner.service. The paths in ExecStart and WorkingDirectory may need to be adjusted depending on where you installed the act_runner binary, its configuration file, and the home directory of the act_runner user.

+
[Unit]
Description=Gitea Actions runner
Documentation=https://gitea.com/gitea/act_runner
After=docker.service
+
[Service]
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yaml
ExecReload=/bin/kill -s HUP $MAINPID
WorkingDirectory=/var/lib/act_runner
TimeoutSec=0
RestartSec=10
Restart=always
User=act_runner
+
[Install]
WantedBy=multi-user.target
+

Then:

+
Terminal window
# load the new systemd unit file
sudo systemctl daemon-reload
# start the service and enable it at boot
sudo systemctl enable act_runner --now
+

If using Docker, the act_runner user should also be added to the docker group before starting the service. Keep in mind that this effectively gives act_runner root access to the system [1].

+

Start the runner with LaunchDaemon (macOS)

Section titled “Start the runner with LaunchDaemon (macOS)”
+

Mac uses launchd in place of systemd for registering daemon processes. By default, daemons run as the root user, so if desired an unprivileged _act_runner user can be created via the dscl tool. The following file should then be created in the directory /Library/LaunchDaemon/com.gitea.act_runner.plist. The paths for WorkingDirectory, ProgramArguments, StandardOutPath, StandardErrPath, and the HOME environment variable may need to be updated to reflect your installation. Also note that any executables outside of the example PATH shown will need to be explicitly included and will not be inherited from existing configurations.

+
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.gitea.act_runner</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/act_runner</string>
<string>daemon</string>
<string>--config</string>
<string>/etc/act_runner/config.yaml</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>WorkingDirectory</key>
<string>/var/lib/act_runner</string>
<key>StandardOutPath</key>
<string>/var/lib/act_runner/act_runner.log</string>
<key>StandardErrorPath</key>
<string>/var/lib/act_runner/act_runner.err</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>HOME</key>
<string>/var/lib/act_runner</string>
</dict>
<key>UserName</key>
<string>_act_runner</string>
</dict>
</plist>
+

Then:

+
Terminal window
sudo launchctl load /Library/LaunchDaemon/com.gitea.act_runner.plist
+

You can also set up a Linux or Windows service to let the runner run automatically.

+ + +

You can use the docker image from Docker Hub. +Just like the binary, you can use the latest nightly build by using the nightly tag, while the latest tag is the latest stable release.

+
Terminal window
docker pull docker.io/gitea/act_runner:latest # for the latest stable release
+

If you want to use the newest or experimental features, you can also use the nightly image.

+
Terminal window
docker pull docker.io/gitea/act_runner:nightly # for the latest nightly build
+ +

Configuration is optional, but you can also generate a config file with docker:

+
Terminal window
docker run --entrypoint="" --rm -it docker.io/gitea/act_runner:latest act_runner generate-config > config.yaml
+

When you are using the docker image, you can specify the configuration file by using the CONFIG_FILE environment variable. Make sure that the file is mounted into the container as a volume:

+
Terminal window
docker run -v $PWD/config.yaml:/config.yaml -e CONFIG_FILE=/config.yaml ...
+

You may notice the commands above are incomplete because it is not time to run the act runner yet. +Before running the act runner, we need to register it to your Gitea instance first.

+ +

If you are using the docker image, behavior will be slightly different. Registration and running are combined into one step in this case, so you need to specify the registration information when running the act runner.

+

A quick start with docker run along with a minimal parameter set is shown below. You need to get the <registration_token> from the above step, and set a unique name for <gitea_runner_name> and for <container_name>.

+
Terminal window
docker run \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_NAME=<gitea_runner_name> \
--name <container_name> \
-v /var/run/docker.sock:/var/run/docker.sock \
-d docker.io/gitea/act_runner:latest
+

You can add more parameters to use a custom config, add a data directory for non-volatile file storage, etc.

+
Terminal window
docker run \
-v $PWD/config.yaml:/config.yaml \
-v $PWD/data:/data \
-v /var/run/docker.sock:/var/run/docker.sock \
-e CONFIG_FILE=/config.yaml \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_NAME=<gitea_runner_name> \
-e GITEA_RUNNER_LABELS=<runner_labels> \
--name <container_name> \
-d docker.io/gitea/act_runner:latest
+

You may notice that we have mounted /var/run/docker.sock into the container. +This is because with this setup, act runner will execute jobs in temporary Docker containers, so it needs to communicate with the Docker daemon. +As mentioned, you can remove it if you want to run jobs on the host directly. +To be clear, the “host” actually means the container that is running the act runner now, instead of the host machine.

+
+

To enable ephemeral runners, set the environment variable GITEA_RUNNER_EPHEMERAL=1 in the runner image. This setup doesn’t use a /data volume because the credentials are single-use and not intended to be reused. You can find more details about this mode under Ephemeral runners.

+
Terminal window
docker run \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_EPHEMERAL=1 \
-e GITEA_RUNNER_NAME=<runner_name> \
--name my_runner \
-d docker.io/gitea/act_runner:nightly
+
Terminal window
docker run \
-v $PWD/config.yaml:/config.yaml \
-v /var/run/docker.sock:/var/run/docker.sock \
-e CONFIG_FILE=/config.yaml \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_EPHEMERAL=1 \
-e GITEA_RUNNER_NAME=<runner_name> \
-e GITEA_RUNNER_LABELS=<runner_labels> \
--name my_runner \
-d docker.io/gitea/act_runner:nightly
+

Mounting the host’s Docker socket using /var/run/docker.sock:/var/run/docker.sock introduces a potential security vulnerability. If a job can access this socket, the reusable GITEA_RUNNER_REGISTRATION_TOKEN could be exposed through Docker inspect data.

+ +

You could also set up the runner using the following docker-compose.yml:

+
version: "3.8"
services:
runner:
image: docker.io/gitea/act_runner:nightly
environment:
CONFIG_FILE: /config.yaml
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
volumes:
- ./config.yaml:/config.yaml
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock
+

When using docker, there is no requirement to enter the container and manually run ./act_runner daemon command as shown below. Once the container has been started successfully, it will show up as an active runner in your Gitea instance.

+
+

To enable ephemeral runners, set the environment variable GITEA_RUNNER_EPHEMERAL=1 in the runner image. This setup doesn’t use a /data volume because the credentials are single-use and not intended to be reused. You can find more details about this mode under Ephemeral runners.

+
version: "3.8"
services:
runner:
image: docker.io/gitea/act_runner:nightly
environment:
CONFIG_FILE: /config.yaml
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
GITEA_RUNNER_EPHEMERAL: "1"
volumes:
- ./config.yaml:/config.yaml
- /var/run/docker.sock:/var/run/docker.sock
+

Mounting the host’s Docker socket using /var/run/docker.sock:/var/run/docker.sock introduces a potential security vulnerability. If a job can access this socket, the reusable GITEA_RUNNER_REGISTRATION_TOKEN could be exposed through Docker inspect data.

+ +

A couple more usage examples can be found in the act_runner repository.

+ +

Configuring cache when starting a runner using the docker image

Section titled “Configuring cache when starting a runner using the docker image”
+

If you do not intend to use actions/cache in your workflow, you can ignore this section.

+

If you use actions/cache without any additional configuration, it will return the following error:

+
+

Failed to restore: getCacheEntry failed: connect ETIMEDOUT IP:PORT

+
+

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. +
    +
  • +
  • +
      +
    1. Find an available port number on the host machine where the runner container is running.
    2. +
    +
  • +
  • +
      +
    1. Configure the following settings in the configuration file:
    2. +
    +
  • +
+
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
+
    +
  • +
      +
    1. When starting the container, map the cache port to the host machine:
    2. +
    +
  • +
+
Terminal window
docker run \
--name gitea-docker-runner \
-p 8088:8088 \
-d docker.io/gitea/act_runner:nightly
+ +

The labels of a runner are used to determine which jobs the runner can run, and how to run them.

+

The default labels are ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster. +It is a comma-separated list, and each item is a label.

+

Let’s take ubuntu-22.04:docker://node:16-bullseye as an example. +It means that the runner can run jobs with runs-on: ubuntu-22.04, and the job will be run in a docker container with the image node:16-bullseye.

+

If the default image is insufficient for your needs, and you have enough disk space to use a better and bigger one, you can change it to ubuntu-22.04:docker://<the image you like>. +You can find more useful images on act images.

+

If you want to run jobs on the host directly, you can change it to ubuntu-22.04:host or just ubuntu-22.04; :host is optional. +However, we suggest you use a special name like linux_amd64:host or windows:host to avoid misusing it.

+

Starting with Gitea 1.21, you can change labels by modifying runners.labels in the runner configuration file (if you don’t have a configuration file, please refer to configuration tutorials). +The runner will use these new labels as soon as you restart it, i.e., by calling ./act_runner daemon --config config.yaml.

+
\ No newline at end of file