Fetch private dredd-core from the Haski Gitea, not GitHub
arbiter-kontrakt / contract (push) Successful in 2m48s
arbiter / backend (16) (push) Successful in 6m52s
arbiter / backend (17) (push) Successful in 6m30s
arbiter / managed-db (push) Successful in 5m36s
arbiter / compose-smoke (push) Successful in 1m43s

The Dockerfiles still rewrote credentials for github.com only, so the build
token never reached Gitea and installs worked only while dredd-core was
public. Rewrite http://77.216.148.202:3000/ instead, give every workflow
that pip-installs the same rewrite (org secret DREDD_CORE_TOKEN, the
read-only haski-reader token), and drop the GitHub PAT leftovers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
admin
2026-11-30 22:18:12 +01:00
co-authored by Claude Opus 5.5
parent a5eaa7ce04
commit af941c1225
7 changed files with 104 additions and 86 deletions
+87 -78
View File
@@ -1,78 +1,87 @@
name: arbiter-kontrakt
# The engine contract: does the real compass_analysis still honour what Arbiter's
# app/services/engine.py believes (the command line, exit codes 0/2/3, a report carrying
# schema_version and the counsel disclaimer, the clause file)? arbiter.yml cannot ask: its paths
# filter is apps/arbiter/**, and `paths` filters a whole workflow, never one job, so a change in
# packages/* that breaks Arbiter would start nothing. Hence a workflow of its own, filtered on the
# engine's side too. (Compass's until its engine left with the contracts, split plan M5, 0030.)
on:
push:
branches: [main]
paths:
# compass-analysis's closure is every package but evals (`uv sync --package
# compass-analysis`, 24.09); a hand-picked list would go stale with its next dependency.
- "packages/**"
- "pyproject.toml"
- "uv.lock"
- "apps/arbiter/backend/app/services/engine*.py"
- "apps/arbiter/backend/app/services/clauses*.py"
# The contract test imports AnalysisMode and SourceFormat from here.
- "apps/arbiter/backend/app/enums.py"
- "apps/arbiter/backend/tests/test_engine_contract.py"
- ".github/workflows/arbiter-kontrakt.yml"
pull_request:
paths:
- "packages/**"
- "pyproject.toml"
- "uv.lock"
- "apps/arbiter/backend/app/services/engine*.py"
- "apps/arbiter/backend/app/services/clauses*.py"
- "apps/arbiter/backend/app/enums.py"
- "apps/arbiter/backend/tests/test_engine_contract.py"
- ".github/workflows/arbiter-kontrakt.yml"
permissions:
contents: read
jobs:
contract:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
UV_PYTHON: "3.12"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
# A full tag: since v8 setup-uv publishes immutable releases only, with no moving @v10.
- uses: astral-sh/setup-uv@v10.2.0
with:
version: "0.11.16" # the pin in apps/arbiter/backend/Dockerfile
- name: Install the engine the way the image does
# --package: compass-analysis and its closure only, as apps/arbiter/backend/Dockerfile
# installs it, so the contract is checked against what Arbiter really runs. `uv lock
# --check` first, because --frozen never compares the lock with pyproject.toml. The dev
# group (pytest, pytest-asyncio) belongs to the workspace root and --package leaves it
# out, so it goes in on top; --inexact keeps the engine.
run: |
uv lock --check
uv sync --package compass-analysis --frozen
uv sync --only-group dev --inexact --frozen
- name: Engine tests (analysis, ingestion)
# Four tests in test_locate.py skip here: the gold set is not versioned.
run: uv run --no-sync pytest packages/analysis packages/ingestion
- name: Install Arbiter deps
working-directory: apps/arbiter/backend
run: pip install -r requirements-dev.txt
- name: The engine contract, against the engine installed above
working-directory: apps/arbiter/backend
env:
COMPASS_ENGINE_PYTHON: ${{ github.workspace }}/.venv/bin/python
# Without that variable the tier skips and this step would pass on nothing, so a skip
# fails it.
run: |
set -o pipefail
pytest -rs tests/test_engine_contract.py | tee contract.log
if grep -qiE "^SKIPPED|[0-9]+ skipped" contract.log; then
echo "::error::the engine contract was skipped"; exit 1
fi
name: arbiter-kontrakt
# The engine contract: does the real compass_analysis still honour what Arbiter's
# app/services/engine.py believes (the command line, exit codes 0/2/3, a report carrying
# schema_version and the counsel disclaimer, the clause file)? arbiter.yml cannot ask: its paths
# filter is apps/arbiter/**, and `paths` filters a whole workflow, never one job, so a change in
# packages/* that breaks Arbiter would start nothing. Hence a workflow of its own, filtered on the
# engine's side too. (Compass's until its engine left with the contracts, split plan M5, 0030.)
on:
push:
branches: [main]
paths:
# compass-analysis's closure is every package but evals (`uv sync --package
# compass-analysis`, 24.09); a hand-picked list would go stale with its next dependency.
- "packages/**"
- "pyproject.toml"
- "uv.lock"
- "apps/arbiter/backend/app/services/engine*.py"
- "apps/arbiter/backend/app/services/clauses*.py"
# The contract test imports AnalysisMode and SourceFormat from here.
- "apps/arbiter/backend/app/enums.py"
- "apps/arbiter/backend/tests/test_engine_contract.py"
- ".github/workflows/arbiter-kontrakt.yml"
pull_request:
paths:
- "packages/**"
- "pyproject.toml"
- "uv.lock"
- "apps/arbiter/backend/app/services/engine*.py"
- "apps/arbiter/backend/app/services/clauses*.py"
- "apps/arbiter/backend/app/enums.py"
- "apps/arbiter/backend/tests/test_engine_contract.py"
- ".github/workflows/arbiter-kontrakt.yml"
permissions:
contents: read
# dredd-core is private on the Haski Gitea, and so is every repository this workflow may fetch.
# All git traffic to the Gitea host (pip installing dredd-core from requirements, above all) goes
# through the read-only bot haski-reader: its token is the Haski org secret DREDD_CORE_TOKEN,
# which Gitea masks in logs. Docker builds get the same token as a BuildKit secret instead.
env:
GIT_CONFIG_COUNT: "1"
GIT_CONFIG_KEY_0: url.http://x-access-token:${{ secrets.DREDD_CORE_TOKEN }}@77.216.148.202:3000/.insteadOf
GIT_CONFIG_VALUE_0: http://77.216.148.202:3000/
jobs:
contract:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
UV_PYTHON: "3.12"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
# A full tag: since v8 setup-uv publishes immutable releases only, with no moving @v10.
- uses: astral-sh/setup-uv@v10.2.0
with:
version: "0.11.16" # the pin in apps/arbiter/backend/Dockerfile
- name: Install the engine the way the image does
# --package: compass-analysis and its closure only, as apps/arbiter/backend/Dockerfile
# installs it, so the contract is checked against what Arbiter really runs. `uv lock
# --check` first, because --frozen never compares the lock with pyproject.toml. The dev
# group (pytest, pytest-asyncio) belongs to the workspace root and --package leaves it
# out, so it goes in on top; --inexact keeps the engine.
run: |
uv lock --check
uv sync --package compass-analysis --frozen
uv sync --only-group dev --inexact --frozen
- name: Engine tests (analysis, ingestion)
# Four tests in test_locate.py skip here: the gold set is not versioned.
run: uv run --no-sync pytest packages/analysis packages/ingestion
- name: Install Arbiter deps
working-directory: apps/arbiter/backend
run: pip install -r requirements-dev.txt
- name: The engine contract, against the engine installed above
working-directory: apps/arbiter/backend
env:
COMPASS_ENGINE_PYTHON: ${{ github.workspace }}/.venv/bin/python
# Without that variable the tier skips and this step would pass on nothing, so a skip
# fails it.
run: |
set -o pipefail
pytest -rs tests/test_engine_contract.py | tee contract.log
if grep -qiE "^SKIPPED|[0-9]+ skipped" contract.log; then
echo "::error::the engine contract was skipped"; exit 1
fi
+9
View File
@@ -13,6 +13,15 @@ defaults:
run:
working-directory: apps/arbiter
# dredd-core is private on the Haski Gitea, and so is every repository this workflow may fetch.
# All git traffic to the Gitea host (pip installing dredd-core from requirements, above all) goes
# through the read-only bot haski-reader: its token is the Haski org secret DREDD_CORE_TOKEN,
# which Gitea masks in logs. Docker builds get the same token as a BuildKit secret instead.
env:
GIT_CONFIG_COUNT: "1"
GIT_CONFIG_KEY_0: url.http://x-access-token:${{ secrets.DREDD_CORE_TOKEN }}@77.216.148.202:3000/.insteadOf
GIT_CONFIG_VALUE_0: http://77.216.148.202:3000/
jobs:
backend:
runs-on: ubuntu-latest
+3 -3
View File
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
# ── build stage: resolve dependencies, including the private one ─────────────
# `dredd-core` is a private GitHub repository pinned by tag in requirements.txt, so installing it
# `dredd-core` is a private repository on the Haski Gitea pinned by tag in requirements.txt, so installing it
# needs two things the runtime image should never have: `git`, and a credential.
#
# The credential arrives as a BuildKit SECRET, not a build argument. A build arg is baked into the
@@ -27,8 +27,8 @@ RUN --mount=type=secret,id=dredd_core_token,required=true \
test -s /run/secrets/dredd_core_token \
|| { echo "build secret dredd_core_token is empty - export DREDD_CORE_TOKEN" >&2; exit 1; }; \
GIT_CONFIG_COUNT=1 \
GIT_CONFIG_KEY_0="url.https://x-access-token:$(tr -d '\r\n' < /run/secrets/dredd_core_token)@github.com/.insteadOf" \
GIT_CONFIG_VALUE_0="https://github.com/" \
GIT_CONFIG_KEY_0="url.http://x-access-token:$(tr -d '\r\n' < /run/secrets/dredd_core_token)@77.216.148.202:3000/.insteadOf" \
GIT_CONFIG_VALUE_0="http://77.216.148.202:3000/" \
pip install --no-cache-dir --prefix=/install -r requirements.txt
# ── runtime stage: no git, no credential, no compiler ────────────────────────
+2 -2
View File
@@ -23,8 +23,8 @@
# nothing else.
#
# The repo is PRIVATE, so pip needs credentials to fetch it:
# local — a GitHub PAT in your git credential helper (or an SSH `insteadOf` rewrite)
# CI — the DREDD_CORE_TOKEN repo secret; see the auth step in .github/workflows/ci.yml
# local — a read-only Gitea access token in your git credential helper (or an SSH `insteadOf` rewrite)
# CI — the Haski org secret DREDD_CORE_TOKEN; see the workflow-level `env:` in .github/workflows/
dredd-core @ git+http://77.216.148.202:3000/Haski/dredd-core.git@v0.25.0
# Web framework
+1 -1
View File
@@ -117,7 +117,7 @@ check("USER app" in dockerfile, "container runs as root",
# ── the image can install the private core ────────────────────────────────────
requirements = read("backend/requirements.txt")
if "dredd-core @ git+" in requirements:
# Not `"git" in dockerfile` — the secret-mount RUN names github.com, so that could never fail.
# Not `"git" in dockerfile` — the secret-mount RUN names git in its URL rewrite, so that could never fail.
# Look for git as a package of an apt/apk install (comments dropped, `\` continuations joined as
# BuildKit joins them: whitespace may follow the backslash, and blank lines inside are skipped).
run_text = re.sub(r"\\[ \t]*\n(?:[ \t]*\n)*", " ", re.sub(r"(?m)^\s*#.*\n", "", dockerfile))
+1 -1
View File
@@ -1,7 +1,7 @@
# Arbiter on a managed PostgreSQL database (the family's shared one, or any Postgres 16/17 reached
# over a network): an override for docker-compose.yml.
#
# DREDD_CORE_TOKEN=github_pat_... \
# DREDD_CORE_TOKEN=<read-only Gitea token> \
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml up -d --build
#
# The database lives elsewhere — the family shares ONE managed database, and Arbiter has schema
+1 -1
View File
@@ -57,6 +57,6 @@ secrets:
# Used only by the build stage's one `pip install`; no running container gets it. Compose resolves
# the variable from the shell OR the project .env (shell wins) — keep it in the shell, because every
# service here also loads .env at runtime and would receive the token:
# DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build
# DREDD_CORE_TOKEN=<read-only Gitea token> docker compose up -d --build
dredd_core_token:
environment: DREDD_CORE_TOKEN