ADR-3545: Tools virtual environment and CI gate for Ubuntu dev images¶
- Status: Accepted
- Date: 2026-11-14
- Tags: docker, dev, ci
Context¶
The three Ubuntu compatibility images under docker/dev/ (ubuntu-26.04.Dockerfile, ubuntu-26.04-cuda.Dockerfile, and ubuntu-26.04-sycl.Dockerfile) copy build-config.env and scripts/setup/ubuntu.sh into /tmp/ and invoke bash /tmp/ubuntu.sh (issue 3455). Three defects kept those images broken and untested:
- Unstaged lock files and wrong root derivation.
ubuntu.shderivedREPO_ROOTfrom${BASH_SOURCE[0]}/../.., which resolved to/from/tmp/ubuntu.sh, and read$REPO_ROOT/requirements/locks/build.txtanddev-linters.txt, neither of which the Dockerfiles copied. - PEP 668 externally managed Python. On Ubuntu 26.04 (Python 3.14),
python3 -m pip install --userinside the container failed immediately witherror: externally-managed-environmentbeforepipeven opened the lock file. On hosted GitHub runnerspip install --userstill succeeded in.github/workflows/nightly.yml, hiding the container failure. - Silent boolean-flag mismatch and missing CI build lane.
ubuntu.shcomparedINSTALL_LINTERS,ENABLE_CUDA, andENABLE_SYCLagainst"true", while all three Dockerfiles andnightly.ymlpassed1. Linters silently never installed, and the CUDA/SYCL Dockerfiles accidentally relied onENABLE_CUDA=1andENABLE_SYCL=1being ignored because CUDA comes fromscripts/ci/install-cuda-toolkit.shand oneAPI comes from the SYCL base image. No CI workflow builtdocker/dev/ubuntu-26.04*.Dockerfile.
Decision¶
- Single tools virtual environment in
scripts/setup/ubuntu.sh.ubuntu.shhonoursREPO_ROOT="${VMAFX_REPO_ROOT:-<checkout derivation>}", validatesENABLE_CUDA,ENABLE_SYCL, andINSTALL_LINTERSagainst the exact allow-listtrue|false(exiting2on any other value before runningapt-getorsudo), and verifies that every required lock file exists and is readable before invokingpip(exiting1with guidance to run from a checkout or setVMAFX_REPO_ROOT). Python build and lint tools always install into one virtual environment atVMAFX_TOOLS_VENV(default${XDG_DATA_HOME:-$HOME/.local/share}/vmafx/tools-venv) with--require-hashes(refusing an existing non-empty directory that lackspyvenv.cfg). WhenGITHUB_PATHis set,ubuntu.shappends$VMAFX_TOOLS_VENV/binso subsequent workflow steps retainmesonandninjaonPATH..github/workflows/nightly.ymlsetsINSTALL_LINTERS: "false"explicitly on the TSan setup step to preserve its existing linter-free behavior. - Dockerfile lock staging and runtime tool path. Each
docker/dev/ubuntu-26.04*.DockerfiledeclaresARG VMAFX_REPO_ROOT=/tmpafterFROM(visible toRUNwithout persisting into the runtime image), copiesrequirements/locks/build.txtandrequirements/locks/dev-linters.txtinto/tmp/requirements/locks/, cleans/tmp/requirementsat the end ofRUN, setsINSTALL_LINTERS=trueandVMAFX_TOOLS_VENV=/opt/vmafx-tools, prepends/opt/vmafx-tools/bintoPATH(retaining/usr/local/cuda/binon the CUDA image), and removes the inertENABLE_CUDA=1/ENABLE_SYCL=1variables in favour of a comment naming each toolkit's source. The existingCOPY build-config.env scripts/setup/ubuntu.sh /tmp/and&& bash /tmp/ubuntu.sh \lines remain byte-identical forUbuntuAptSnapshotContract(ADR-3541). - Own-input CI lane in
.github/workflows/dev-container-build.yml. Reuse the existing dev-container workflow (HISS-19) by adding selectorubuntu_dev_images(own_paths_only: true) in.github/ci-impact.json, validated and exported by theimpactjob, and a 3-wayubuntu-dev-imagesmatrix job (cpu,cuda,sycl,timeout-minutes: 60pending ten measured runs) that builds each image on non-draft light and full tiers when inputs change and smoke-testsmeson,ninja,ruff,shellcheck, andshfmt(plusbash -lc 'command -v meson'onsycl). The requireddev-container-buildaggregator job (Dev Container Build) gatesubuntu-dev-imagesontrue:successorfalse:skipped, and.github/ci-tier.jsonlistsubuntu_dev_imagesalongsidedev_container_inputson that own-input lane.
Alternatives considered¶
| Axis | Chosen | Alternatives rejected | Why rejected |
|---|---|---|---|
| Python tool isolation | Dedicated python3 -m venv "$VMAFX_TOOLS_VENV" with --require-hashes | pip install --break-system-packages; pipx | --break-system-packages mutates the distro-managed Python environment PEP 668 protects and mixes apt and pip files under /usr/local; pipx adds an extra bootstrap dependency and does not natively install multi-package hash-locked requirement files into one shared bin directory. |
| CI workflow placement | Extend .github/workflows/dev-container-build.yml with ubuntu_dev_images (own_paths_only: true) | Separate .github/workflows/ubuntu-dev-images.yml workflow | A separate workflow duplicates tier/impact checkout plumbing (violating HISS-19) and spends extra check-suite / planner runs on unrelated pull requests. |
| Lock path layout in Dockerfiles | ARG VMAFX_REPO_ROOT=/tmp + COPY ... /tmp/requirements/locks/ | Mirror scripts/setup/ubuntu.sh at /tmp/repo/scripts/setup/ubuntu.sh | Moving ubuntu.sh out of /tmp/ breaks the shared COPY build-config.env scripts/setup/ubuntu.sh /tmp/ and && bash /tmp/ubuntu.sh \ contract shapes checked by UbuntuAptSnapshotContract (ADR-3541). |
Consequences¶
scripts/setup/ubuntu.shhas one deterministic Python installation path on workstations, GitHub hosted runners, and Ubuntu 24.04/26.04 containers, with no--userfallback or PEP 668 conflict.- Callers running
ubuntu.shinteractively add$VMAFX_TOOLS_VENV/bintoPATH(printed at completion and documented in the Ubuntu install guide); GitHub Actions steps receive it automatically throughGITHUB_PATH, and container consumers receive/opt/vmafx-tools/binthroughENV PATH. - Invalid boolean flag values (
1,0,yes) fail fast with exit code2instead of silently disabling or ignoring options. UbuntuDevImageLockContractinscripts/ci/test_fail_closed_ci.pyenforcesARG VMAFX_REPO_ROOT, lock staging completeness againstubuntu.sh,/opt/vmafx-tools/binonPATH, and fail-fast flag/lock checks offline; theubuntu-dev-imagesCI job verifies full image builds and tool execution when inputs change.