Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/cross-repository-candidate.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Registry 候选和发行镜像跨源码版本复用基础构建缓存;候选可联调实际 Python Peer 的扩展安装和重启。
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
description: Base revision for release-contract validation
required: false
type: string
core_revision:
description: Exact InKCre/impl-py commit for Registry-to-Peer acceptance
required: false
type: string

permissions:
contents: read
Expand All @@ -18,6 +22,48 @@ concurrency:
cancel-in-progress: true

jobs:
cross-repository-peer:
name: Registry publication and Python Peer installation
if: github.event_name == 'workflow_dispatch' && inputs.core_revision != ''
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Require an exact Core commit
env:
CORE_REVISION: ${{ inputs.core_revision }}
run: test "${#CORE_REVISION}" -eq 40 && [[ "$CORE_REVISION" =~ ^[0-9a-f]+$ ]]

- name: Checkout Registry
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: registry
persist-credentials: false

- name: Checkout Core
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: InKCre/impl-py
ref: ${{ inputs.core_revision }}
path: core
persist-credentials: false

- name: Set up the Core interpreter
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version-file: core/.python-version

- name: Set up the Registry interpreter
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version-file: registry/.python-version

- name: Verify Registry publication and Peer restart
working-directory: registry
run: |
python -m pip install -r requirements-pdm.txt
pdm install --frozen-lockfile
pdm run registry:verify-peer ../core

dependency-review:
name: Dependency review
if: github.event_name == 'pull_request'
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ COPY runtimes/core-py/ runtimes/core-py/
RUN pdm install --prod --no-editable --frozen-lockfile

FROM python:3.13-slim
ARG SOURCE_REVISION=unknown
LABEL org.opencontainers.image.revision="${SOURCE_REVISION}"
ENV PATH="/app/.venv/bin:${PATH}" PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 \
REGISTRY_SOURCE_REVISION="${SOURCE_REVISION}"
ENV PATH="/app/.venv/bin:${PATH}" PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
RUN useradd --uid 10001 --create-home registry
ARG SOURCE_REVISION=unknown
LABEL org.opencontainers.image.revision="${SOURCE_REVISION}"
ENV REGISTRY_SOURCE_REVISION="${SOURCE_REVISION}"
USER registry
EXPOSE 8000
CMD ["python", "-m", "inkcre_extension_registry"]
25 changes: 25 additions & 0 deletions docs/40-deployment/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

Registry 使用 Python 3.13、PDM 和 Node 22 / pnpm。Node 只用于现有设计样式、契约及独立 Web Runtime 包的构建;服务进程只运行 Python。

## 从 Registry 工作树联调 Python Peer

在 Registry 工作树安装锁定的开发依赖后运行:

```sh
pdm run registry:verify-peer ../impl-py
```

选择的 Python 工作树需要提供 `pdm run core:candidate`。两个工作树的已跟踪修改会进入构建,新文件需先暂存。
命令用当前 Registry 服务和 Toolkit 发布该 Python 工作树的 `inkcre/capture` wheel,
把当前 Registry 工作树的 Python Runtime wheel 装进候选 Peer,再访问真实 Registry 进行选择和启用。
成功输出包含 Registry 和 Core 实际使用的镜像及源码版本、两个 wheel 的 SHA-256,
以及 Peer 的重执行、能力开放和冷重启结果。

所有服务使用同一 Docker daemon 上的临时网络和数据库。S3 使用同网络的 Moto,无需端口转发或上线凭据。
结束时清理运行资源,构建出的镜像保留在 Docker daemon 供检查。

仅迭代 Registry 时,可以传入 `--core-receipt /path/to/receipt.json` 复用同一 daemon 上的 Core 镜像。
在 Python 工作树运行 `pdm run core:candidate > receipt.json` 取得该文件。

`--extension local_files` 可复现本地文件扩展的启用问题。该 wheel 声明入口点名 `local_files`,
而扩展类身份是 `local-files`。Core 在启用时返回 HTTP 409,验收会保留该失败。

候选均已推送时,也可以在 Registry 分支手动运行 **Registry checks**,把 Python 候选的完整提交 SHA 填入 `core_revision`。

```bash
python -m pip install -r requirements-pdm.txt
pdm install --frozen-lockfile
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ members = ["toolkit", "runtimes/core-py"]

[tool.pdm.scripts]
"check:releases" = "python scripts/release.py check {args}"
"registry:verify-peer" = "python scripts/verify_registry_peer.py {args}"
"release:prepare" = "python scripts/release.py prepare {args}"

[tool.ruff]
Expand Down
Loading