Repository navigation
Description
Problem or Motivation
Parent: #2661. The implement job (#2665) runs tests, ruff, mypy and OpenSpec. The Service image holds none of them: it is the builder's venv with --no-dev, git and gh. The Service pod runs with 1 CPU, a read-only root and automountServiceAccountToken: false, and it cannot create a Job.
Proposed Solution & Architectural Design
- A
runnerstage inDockerfile, from the builder:uv sync --lockedwith the dev dependencies, a Node runtime with the pinned OpenSpec (src/devops_cli/tools_lock/openspec), the tools oftools.lockthatdevops ci test,ruffandmypyneed, git and gh; user 1000 andENTRYPOINT ["devops"].release.ymlpublishes it asghcr.io/dan-petty/devops-cli/runnernext to the service image, and Image Updater pins it as it pins the service image. - A CronJob template
devops-cli-runnerink8s/devops/, suspended, likedevops-cli: the runner image, 2 CPU and 4 Gi,activeDeadlineSeconds7200, anemptyDirhome of 4 Gi for the clone and the venv, the samesecurityContext, Secretdevops-cliand the ConfigMap.devops k8s run-job --template runner -- roadmap implement --item Ncreates a Job from it. - The Service submits one implement Job per repository at a time: a row
implementon the model lane whose runner creates the Job through the in-cluster API, recordsimplement.joband returns. The next round reads the Job's state, and the tail of its log goes into the item's comment when it ended. The Service's ServiceAccount gets a Role withcreate,getandlistonjobsandgetonpods/login namespacedevops, and the Service pod mounts a projected token with a one-hour expiry. The Job pods keep no token. - The Service's network policy admits egress to the API server on 6443 through an
ipBlockthat excludes the cloud metadata address, ask8s/argo-workflows/does. The policy of the runner Job is the Service's: DNS, the gateway on 4000, the OTLP collector and public HTTPS. - The installation token that the Job mints names only this repository (
repositoriesin the token request, the pattern of feat(security): the App's installation tokens carry only the permissions the roadmap jobs use #2473), so that a step cannot push to another repository. k8s/README.md("Roadmap service" and "devops-cli in the cluster") anddocs/ROUTINE_TASKS.mddescribe the runner and the Job.
Target Subsystem
Dockerfile, .github/workflows/release.yml, k8s/devops/, src/devops_cli/roadmap/run.py, src/devops_cli/k8s/.
Existing Tool Considered
The cluster Job template and devops k8s run-job (the engine in place today), Argo CD and Image Updater for the rollout, and the Kubernetes API for the submission. Argo Workflows (ADR 0008) is the engine after a measured go, which #1535 did not record. The Job moves with the other jobs when it is. The published devcontainer image as the runner is rejected: it is built from debian:sid and fills its venv at post-create, so a Job would sync at every start. GitHub-hosted runners are rejected on the parent.
Key questions
- Why does the Service create Jobs and not run the step in its pod? The step runs tests and tools that the Service image does not hold, needs CPU that the Service's limit does not give, and must not hold the model lane for an hour.
- Why a projected token in the Service pod? It is the one write the Service needs on the cluster. The Role admits Jobs in its namespace and nothing else.
Acceptance criteria
- The
runnerstage of the Dockerfile is checked offline: dev dependencies, OpenSpec from the lockfile, the tools, user 1000 and the entrypoint.release.ymlpublishes it. kubectl kustomize k8s/devopsrenders the runner template, the Role, the RoleBinding, the token mount and the policy rules, and the manifest tests assert them.- With the Kubernetes API faked, a Service round with a Staged low-effort P1 bug creates one Job with the item's arguments and creates no second Job while it runs. A later round records the state of the ended Job on the item.
uv run devops cipasses.
Depends on: #2665.
Source: #2661
Proposed design
Problem statement
The implement job runs tests, ruff, mypy, and OpenSpec. The Service image holds none of these tools. The Service pod has 1 CPU, a read-only root, and no API token. This change adds a runner image with the dev dependencies and tools. It adds a cluster Job template and the Service's ability to submit and track implement Jobs.
Acceptance criteria
Requirement: Runner image stage
The Dockerfile SHALL contain a runner stage that installs the dev dependencies, the pinned OpenSpec from the lockfile, the tools from tools.lock, git, and gh, runs as user 1000, and sets the entrypoint to devops.
Scenario: Offline check of the runner stage
- WHEN A test reads the Dockerfile and inspects the runner stage
- THEN The stage contains uv sync --locked with dev dependencies, the OpenSpec pin from src/devops_cli/tools_lock/openspec, the tools.lock entries, git, gh, USER 1000, and ENTRYPOINT ["devops"]
Requirement: Release publishes runner image
The release workflow SHALL build, smoke-test, scan, push, attest, and tag the runner image as ghcr.io/dan-petty/devops-cli/runner.
Scenario: Release workflow contains the runner image job
- WHEN A test reads .github/workflows/release.yml
- THEN A job builds the runner stage, runs a smoke test, scans with Trivy, pushes by digest, attests provenance, and tags with the release tag and latest
Requirement: K8s manifests render correctly
The k8s/devops kustomization SHALL render the runner CronJob template, the Role, the RoleBinding, the projected token mount, and the network policy rules.
Scenario: kubectl kustomize renders the devops stack
- WHEN A test runs kubectl kustomize k8s/devops and inspects the output
- THEN The output contains a suspended CronJob devops-cli-runner with the runner image, 2 CPU, 4 Gi memory, activeDeadlineSeconds 7200, an emptyDir home of 4 Gi, the securityContext, Secret devops-cli, and the ConfigMap; a Role with create, get, list on jobs and get on pods/log; a RoleBinding; a projected token with 1-hour expiry; and the network policy rules
Requirement: Service submits one Job per item
The Service SHALL create exactly one implement Job per Staged item and SHALL NOT create a second Job while the first runs.
Scenario: Service round with a Staged P1 bug
- WHEN A test fakes the Kubernetes API and runs a Service round with one Staged low-effort P1 bug
- THEN The API receives one Job create call with the item's arguments, and no second create call while the Job runs
Requirement: Service records ended Job state
A later Service round SHALL record the state of the ended Job on the item and SHALL write the tail of the Job log into the item's comment.
Scenario: Service round after Job ends
- WHEN A test fakes the Kubernetes API with an ended Job and runs a later Service round
- THEN The item's record holds the Job's final state, and the item's comment contains the tail of the Job log
Requirement: CI passes
The full CI suite SHALL pass after the change.
Scenario: uv run devops ci
- WHEN A test runs uv run devops ci
- THEN All checks report pass
Existing Tool Considered
The Kubernetes Job API, the existing devops k8s run-job command, Argo CD, and Image Updater cover Job creation, state tracking, rollout, and image pinning. The project builds the runner Docker image stage, the runner CronJob template, the RBAC (Role, RoleBinding, projected token), the network policies, and the Service's Job submission and state-tracking code. The written cost is about 900 lines of code and configuration (Dockerfile ~80 lines, release.yml ~60 lines, k8s manifests ~150 lines, Service code ~300 lines, tests ~300 lines), roughly 9,000 tokens to write, and about 15,000 tokens and 3 hours of elapsed time with debugging and fixing.
Key questions
- Why does the Service create Jobs and not run the step in its pod?: The Service image lacks the dev dependencies and tools. The Service pod has 1 CPU and a read-only root. Running the step in the pod would hold the model lane for an hour. (best practice) [sources: k8s/devops/serviceaccount.yaml, k8s/devops/roadmap-service/deployment.yaml]
- Rejected: Run the step in the Service pod. Rejected: the image lacks the dev dependencies and tools, the pod has 1 CPU and a read-only root, and the step would hold the model lane for an hour.
- Chosen: Submit a separate cluster Job on a runner image. Chosen: the runner image holds the dev dependencies and tools, the Job gets 2 CPU and 4 Gi, and the model lane is free while the Job runs.
- Why a projected token in the Service pod?: It is the one write the Service needs on the cluster. The Role admits create, get, and list on jobs and get on pods/log in namespace devops, and nothing else. The token expires in one hour. (best practice) [sources: k8s/README.md]
- Rejected: automountServiceAccountToken with a long-lived token. Rejected: the token has no expiry and the pod holds it for its whole life.
- Chosen: Projected token with a 1-hour expiry. Chosen: the token is scoped to the Role, expires in one hour, and the Job pods keep no token.
- Kubernetes Jobs or Argo Workflows as the engine?: Kubernetes Jobs now. Argo Workflows is the engine after a measured go, which feat(k8s): the argo workflows controller runs in its own namespace under argo cd and deploy-stack, and a --version workflow measures start-up and api-server load for the go/no-go on moving the roadmap jobs onto it #1535 did not record. No roadmap job runs on Argo Workflows yet. The Job moves with the other jobs when the measurement is done. (best practice) [sources: k8s/README.md]
- Chosen: Kubernetes Jobs (CronJob template + devops k8s run-job). Chosen: the engine is in place today, the pattern is proven by the existing devops-cli CronJob, and no measurement is needed.
- Rejected: Argo Workflows. Rejected: ADR 0008 requires a measured go, which feat(k8s): the argo workflows controller runs in its own namespace under argo cd and deploy-stack, and a --version workflow measures start-up and api-server load for the go/no-go on moving the roadmap jobs onto it #1535 did not record. No roadmap job runs on it yet.
- What existing tool or library covers the need?: The Kubernetes Job API covers Job creation, state tracking, and log reading. The existing devops k8s run-job command and the CronJob template pattern cover the submission. Argo CD covers the rollout. Image Updater covers the image pinning. The project builds the runner image, the runner CronJob template, the RBAC, the network policies, and the Service's Job submission code. [sources: k8s/devops/cronjob.yaml, k8s/README.md]
- How does the runner image install the dev dependencies?: The runner stage runs uv sync --locked with the dev dependencies, following the project's existing pattern. It also installs a Node runtime with the pinned OpenSpec from src/devops_cli/tools_lock/openspec, the tools from tools.lock, git, and gh. (best practice) [sources: .github/workflows/release.yml, k8s/README.md]
- Rejected: pip install with the dev extras. Rejected: the project uses uv throughout, and pip does not read uv.lock.
- Chosen: uv sync --locked with the dev dependencies. Chosen: the project uses uv, the lockfile pins the versions, and --locked prevents drift.
- How is the installation token scoped?: The token names only this repository in the repositories field of the token request, following the pattern of feat(security): the App's installation tokens carry only the permissions the roadmap jobs use #2473. A step cannot push to another repository. (proposed)
- Rejected: Token with all repositories. Rejected: a step could push to another repository.
- Chosen: Token scoped to one repository. Chosen: the token names only this repository, so a step cannot push to another repository.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
It adds a new Docker stage, a CronJob template, RBAC, network policies, and the Service's ability to submit implement Jobs.Without this item the implement job cannot execute in the cluster, blocking the roadmap's core delivery path.It is the execution path for the implement job, which runs tests, linting, type checks, and OpenSpec for every roadmap item.It spans the Dockerfile, release pipeline, k8s manifests, Service code, RBAC, network policies, and documentation.Both items are jobs the Service manages on the model lane, but 2659 delivers the stage job in the Service pod while this candidate delivers the implement job as a separate cluster Job on a runner image.devops-cli-service commentedon Oct 29, 2026
Status set to Ready at 19a2e08 (see proposed design in issue body).
feat(roadmap): add the implement job to roadmap implement (#2692)
fix(roadmap): delete npm, pip and the uv cache of root from the runne…
docs(openspec): record that the runner stage deletes npm, pip and the…
chore(main): release 0.20.0 (#2701)
fix(roadmap): the status label follows the pull request (#2723)
feat(roadmap): Add a loopback gateway broker to a step (#6157)
fix(roadmap): harden the fix-checks Job process as implement does (#6540