Repository navigation
Description
Problem or Motivation
The mcp-server stage is FROM runner (Dockerfile:121). So each push builds the runner stage in two jobs (build means 140.5 s and 146.1 s, measured).
Saving: 1 job and about 1.5 runner-min per push (estimated).
Found by the CI and test audit of 2026-11-11. The account runs at most 20 hosted jobs at one time (measured), so each job that does no work makes the queue of each pull request longer.
Proposed Solution & Architectural Design
- One job builds both images with
docker buildx bake(docker/bake-action). - Then the job runs the smoke test and the Trivy scan of each image.
- Change only
.github/workflows/ci.yml. perf(k8s): put the dependencies in their own image layers #4550 changes the layers of theDockerfilenow.
Risk: Low. Neither check is required.
Target Subsystem
SDLC, Git & PR Governance (.github/workflows/ci.yml).
Existing Tool Considered
docker buildx bake through the official docker/bake-action. No new tool to build. Cost: about 30,000 tokens and 2 hours.
Acceptance Criteria
- One job per push builds both images.
- The
runnerstage builds one time. - Both smoke tests and both scans run.
Dependencies
Depends on #4646.
Alternatives check of 2026-11-13: not-applicable.
Class: perf, no search.
Tool: none found.
Proposed design
Problem statement
The mcp-server stage is FROM runner (Dockerfile:161), so each push to a pull request builds the runner stage twice: once in the runner-image job and again in the mcp-server-image job. The change merges the two jobs into one job that builds both images with one docker/bake-action step, then runs both smoke tests and both Trivy scans. It removes one hosted job per push from an account that runs at most 20 at a time, so each pull request waits in a shorter queue.
Acceptance criteria
Requirement: One job builds both images
The workflow .github/workflows/ci.yml SHALL build the runner and mcp-server targets in one job.
Scenario: One image job for the two targets
- WHEN a test reads the jobs of
.github/workflows/ci.yml - THEN exactly one job builds the
runnerandmcp-servertargets, and no other job builds either target
Requirement: One bake step holds both targets
The merged job MUST pass both targets to one docker/bake-action step.
Scenario: One bake step holds both targets
- WHEN a test reads the steps of the merged job
- THEN one
docker/bake-actionstep lists therunnerandmcp-servertargets, and the job holds nodocker/build-push-actionstep
Requirement: Both images load under their current tags
The bake step SHALL load the images devops-cli-runner:local and devops-cli-mcp-server:local.
Scenario: Smoke tests read the loaded images
- WHEN the bake step ends
- THEN the smoke test of each image runs against its loaded tag
Requirement: Both smoke tests run
The merged job MUST run the smoke test of the runner image and the smoke test of the mcp-server image.
Scenario: Both smoke tests in one job
- WHEN an image input changed
- THEN the job runs the runner smoke test and the MCP Server smoke test, and a failing test fails the job
Requirement: Both scans run with their ignore files
The merged job MUST scan each image with Trivy at the severity HIGH,CRITICAL and with the ignore files of that image.
Scenario: MCP Server scan keeps its ignore file
- WHEN the job scans
devops-cli-mcp-server:local - THEN the scan step sets
trivyignores: .trivyignore,.trivyignore-mcp-server
Requirement: Each target rebuilds its own final stage
The bake definition MUST set no-cache-filter to runner on the runner target and to mcp-server on the mcp-server target.
Scenario: The apt-get upgrade layer is not reused
- WHEN an earlier run cached the
runnerormcp-serverstage - THEN each target rebuilds its own final stage and reuses no layer of its
apt-get upgrade
Requirement: The job skips when no image input changes
The merged job SHALL skip the bake, the smoke tests and the scans when no path of IMAGE_CONTENT_PATHS changes.
Scenario: Pull request with no image input change
- WHEN a pull request changes no path of
IMAGE_CONTENT_PATHS - THEN the job runs no bake, smoke-test or scan step and reports success
Requirement: The merged job sets a limit over its longest run
The merged job MUST set a timeout-minutes value of about two times its longest run, as the workflow comment asks.
Scenario: Job limit and step limits
- WHEN a test reads the merged job
- THEN the job sets
timeout-minutes: 18, the bake step sets 12, and each smoke-test and scan step sets a shorter limit
Requirement: The required checks keep their names
The change MUST NOT rename the jobs Static Analysis and Tests & Coverage.
Scenario: The ruleset reads the two names
- WHEN a test reads the job names of
.github/workflows/ci.yml - THEN the jobs
Static AnalysisandTests & Coveragekeep their names
Requirement: The bake action is pinned
The docker/bake-action step MUST pin the action to a full commit SHA with a version comment, as every other action of the workflow.
Scenario: The bake step pins its action
- WHEN a test reads the
usesof the bake step - THEN the value is
docker/bake-action@<40 hex characters>with a# v<version>comment
Requirement: The image invariants read the merged job
The tests that read the image jobs SHALL read the merged job.
Scenario: The image invariants run
- WHEN the suite runs
tests/invariantsandtests/commands/test_ci.py - THEN no test names
runner-imageormcp-server-image, and each asserts both targets, both smoke tests and both scans of the merged job
Existing Tool Considered
docker/bake-action, the official maintained Docker action for docker buildx bake, covers the need: one step builds both targets, loads both images, and keeps the cache options of the build. The alternatives check of 2026-11-13 gave not-applicable for a perf item, made no search and named no tool, so this answer rests on the issue's own choice of the action. The action is not yet used in this repository, so the change adds it pinned to a full commit SHA with a version comment, as docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 is pinned (.github/workflows/ci.yml:570). It lacks the smoke tests and the Trivy scans: those stay as steps of the same job. The change writes no tool of its own and no new code.
Key questions
- Which jobs build the two images today?: The job
runner-image(.github/workflows/ci.yml:513) builds the targetrunnerwithdocker/build-push-action(.github/workflows/ci.yml:568-582), and the jobmcp-server-image(.github/workflows/ci.yml:613) builds the targetmcp-serverwith the same action (.github/workflows/ci.yml:668-680). Each job runs on its own runner, so each builds the sharedrunnerstage. [sources: .github/workflows/ci.yml:513, .github/workflows/ci.yml:568, .github/workflows/ci.yml:613, .github/workflows/ci.yml:668] - Does the
mcp-serverstage build FROM therunnerstage?: Yes.Dockerfile:161isFROM runner AS mcp-server, andtests/invariants/test_mcp_server_image.py:36asserts that themcp-serverstage inheritsrunner. The body'sDockerfile:121is stale: line 121 installs the dev requirements, and therunnerstage starts atDockerfile:126. [sources: tests/invariants/test_mcp_server_image.py:36] - Does one bake build of both targets build the
runnerstage one time?: The merged job uses onedocker/bake-actionstep with both targets, which is the form that resolves both targets against oneDockerfileand one build graph, so the parent stage ofmcp-server(Dockerfile:161) is built by that one build. Twodocker/build-push-actionsteps in one job would each start their own build, and since perf(ci): stop the cache export of pull request image builds #4646 the pull request jobs write no cache, so the second step would build therunnerstage again. No measured run exists at this commit: the job-time check confirms the saving after the first run, and the offline test asserts the single bake step with both targets. (best practice) [sources: .github/workflows/ci.yml:568, .github/workflows/ci.yml:668, .github/workflows/ci.yml:474]- Chosen: One
docker/bake-actionstep with both targets. Both targets are resolved against oneDockerfileand one build graph, so the sharedrunnerstage is built by one build. - Rejected: Two
docker/build-push-actionsteps in one job. Each step is its own build, and the pull request jobs write no cache (.github/workflows/ci.yml:474-478), so the second step builds therunnerstage again. - Rejected: A matrix over the two images. Each matrix entry gets its own runner, which is exactly today's two jobs.
- Chosen: One
- How does the merged job define the two bake targets?: The job writes an inline HCL definition in the
filesinput of thedocker/bake-actionstep, so the change stays in.github/workflows/ci.ymlas the body scopes it. (best practice) [sources: .github/workflows/ci.yml:545]- Chosen: Inline HCL in the
filesinput ofdocker/bake-action. The action writes the definition to a file of its own, so the change stays in the workflow file that the body names. - Rejected: A new
docker-bake.hclat the repository root. It adds a file that the issue does not name, and the body keeps the change toci.yml. - Rejected:
docker buildx bakein arunstep. The step then writes and reads its own HCL file, and it loses the load and cache handling of the maintained action.
- Chosen: Inline HCL in the
- Which job id and name does the merged job take?: The merged job takes the id
image-buildand the nameContainer Images. Neither image check is required: ADR 0014 records thatmainrequiresStatic Analysis,Tests & CoverageandSemantic PR titleonly, so a new check name breaks no ruleset. (best practice) [sources: docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md:18, tests/invariants/test_workflow_contracts.py:1758, .github/workflows/ci.yml:40]- Chosen: Id
image-build, nameContainer Images. The job builds two images, and no rule ofmainreads the old check names, so the name can say what the job does. - Rejected: Keep the id
runner-imageand the nameRunner Image. The name would say that the job builds the runner image only, while it also builds and checks the MCP Server image. - Rejected: Two jobs that share a
needs. It keeps two hosted jobs per push, which is the cost this item removes.
- Chosen: Id
- Does the Service image job join the bake job?: No. The change merges the
runnerandmcp-servertargets only, as the issue scopes it. The Service image job builds another target with its own no-cache filter (.github/workflows/ci.yml:473) and shares no stage with the two image targets. (best practice) [sources: .github/workflows/ci.yml:407, .github/workflows/ci.yml:473]- Chosen: Merge the
runnerandmcp-servertargets only. The saving of this item comes from therunnerstage that the two targets share. - Rejected: Merge the Service image job too. It changes a job that the issue does not name, and its final stage runs
apt-get upgradewith its own no-cache filter.
- Chosen: Merge the
- What timeout does the merged job set?: The job sets
timeout-minutes: 18, the bake step sets 12, and each smoke-test and scan step sets a shorter limit. The two jobs ran 297 s and 331 s; the merged job drops onerunnerbuild of about 140 s, so its run is about 8 minutes, and 18 is about two times that, as the workflow comment asks. (best practice) [sources: .github/workflows/ci.yml:36, tests/invariants/test_workflow_contracts.py:55, tests/invariants/test_workflow_contracts.py:61]- Rejected: Keep
timeout-minutes: 12. The merged job does the work of both jobs one after another, so a run near the old limit would be cut. - Chosen: Set
timeout-minutes: 18. It is about two times the expected run of about 8 minutes, and the bake, smoke-test and scan steps stay under it. - Rejected: Set
timeout-minutes: 24. It holds a hosted runner too long when the build hangs.
- Rejected: Keep
- Does this item still need perf(ci): stop the cache export of pull request image builds #4646?: No. The image jobs of a pull request read the Actions cache with
cache-from: type=ghaand write none (.github/workflows/ci.yml:474-478,:582,:680), which is the change of perf(ci): stop the cache export of pull request image builds #4646, and that change folder is archived. [sources: openspec/changes/archive/2026-11-12-4646-stop-the-cache-export-of-pull/proposal.md, .github/workflows/ci.yml:474, .github/workflows/ci.yml:582] - Does the MCP Server scan use a different ignore file?: Yes. Its scan sets
trivyignores: .trivyignore,.trivyignore-mcp-server(.github/workflows/ci.yml:702), and the runner scan sets notrivyignores(.github/workflows/ci.yml:600-609). [sources: .github/workflows/ci.yml:702, .github/workflows/ci.yml:600] - Does the merged job keep the release-pull-request skip?: Yes. Both jobs carry the same condition (
.github/workflows/ci.yml:515-518,:615-618): they run for apull_requestor aworkflow_dispatchand skip arelease-please--branch of this repository. The merged job keeps it, so the release pull request still runs only the required checks (.github/workflows/ci.yml:40-43). [sources: .github/workflows/ci.yml:515, .github/workflows/ci.yml:615, .github/workflows/ci.yml:40] - Which invariant tests read the image jobs of
.github/workflows/ci.yml?:tests/invariants/test_workflow_contracts.py:55-72pins thetimeout-minutesof the jobsrunner-imageandmcp-server-image;:581-599lists the Trivy scan steps of both jobs.tests/invariants/test_runner_image.py:193-259reads therunner-imagejob ofci.yml(build, smoke test, size bound).tests/invariants/test_mcp_server_image.py:79-96and:149-164read themcp-server-imagejob (build, scan, smoke test).tests/invariants/test_architectural_invariants.py:671-699parametrizes the job idsservice-image,runner-imageandmcp-server-imageover theIMAGE_CONTENT_PATHSfilter.tests/commands/test_ci.py:970-1000requires the job idrunner-imageand noneedson it, and:2302-2321allowlists the run steps of both jobs. Each of these reads the merged job after the change. [sources: tests/invariants/test_workflow_contracts.py:55, tests/invariants/test_workflow_contracts.py:581, tests/invariants/test_runner_image.py:193, tests/invariants/test_mcp_server_image.py:79, tests/invariants/test_architectural_invariants.py:671, tests/commands/test_ci.py:970, tests/commands/test_ci.py:2302] - How is
docker/bake-actionpinned?: To a full commit SHA with a version comment, as every action of the workflow is pinned, for exampledocker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0. The project's actionlint guidance states the same rule, and Renovate updates the pinned digest. (best practice) [sources: .github/workflows/ci.yml:570, src/devops_cli/ai/knowledge_base/it_domains/tools/actionlint.md:61]- Chosen: Pin the action to a full commit SHA with a version comment. Every action of the workflow is pinned this way, and the project's actionlint guidance requires an immutable SHA rather than a tag.
- Rejected: Use a version tag such as
docker/bake-action@v6. A tag moves, and it breaks the pin rule that the workflow and the guidance hold. - Rejected: Run
docker buildx bakein arunstep. The issue names the official action, which keeps the build options and the image load in one place.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
perfprefix of the title gives the type.(ci)scope of the title gives the scope.It saves about 1.5 runner-min per push but does not block delivery or fix a failure.It shortens the PR queue for all contributors by removing one redundant build job.The body states the cost is about 30,000 tokens and 2 hours, with low risk.Both target CI image build cost in ci.yml, but #4646 stops cache exports while this candidate merges two jobs into one bake.devops-cli-service commentedon Nov 13, 2026
Alternatives check: not-applicable
Class: perf. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-13. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 14, 2026
Status set to Ready at 0410772 (see proposed design in issue body).
dan-petty commentedon Nov 19, 2026
Later measure. Owner decision of 2026-11-19: the MCP server image stays on
python:3.14-slim-trixie, so after #4361 it no longer builds FROM runner, and the MCP job no longer repeats the runner build. After #4361 merges, measure the builds again. If one bake call saves less than about 20 s of runner time and the cache space is not short, close this item as not planned with the numbers. Today the build medians are Service 96 s, Runner 107 s and MCP 118 s.dan-petty commentedon Nov 20, 2026
Measurement input from #6513 (#4361, the runner image FROM devtools). The runner image grows from 2.4 GB to 6.4 GB. Two cold CI runs of the Runner Image job took 4:15 and 6:27 (mean 5:21). Most of the time is in two steps whose time changes with the runner: the export of the image into Docker for
load: true(69 s and 112 s) and the Trivy scan of the loaded image (67 s and 96 s). The venv steps take about 30 s, so a cache from main saves little. The MCP server image no longer builds on the runner, so its job does not repeat the runner build. The step table is in #6513 (comment).30 remaining items
devops-cli-service commentedon Nov 24, 2026
Cleared the stop at job by the rule
continue: the runner Job devops-cli-implement-devops-cli-4649-6b3347 ended without a result. The classci_infraof the stop is one that a new attempt can fix. This is continuation 2 of 4 for this item. The item is Planned again. The Service takes it in the next round. The new Job takes the branch fromorigin, so it keeps the work that the run pushed there.devops-cli-service commentedon Nov 24, 2026
Stopped at pull request.
Failure class:
ci_infra.Action taken: none.
Action left:
retry: run the item again.Reason:
The check
Runner Imageof the draft pull request #7006 failed or was cancelled, and no fix-checks Job repairs it.The item is Blocked: the implement Job ended at the draft, and no fix-checks Job takes this case. Fix the cause. Then comment
implement: retry.devops-cli-service commentedon Nov 24, 2026
Cleared the stop at pull request by the rule
digest: the runner image changed since the stop, from sha256:7492c2a9d21e71a7eaec25710fcae6dec3ba3e53f71ad091733233b1a0c9c981 to sha256:f4ad8b448fc37a88732fe8a0a43d5e6c33584ae7fd7136ab556fe1dbbf3eea23, and the classci_infraof the stop is one that a new attempt can fix. The item is Planned again, and the Service takes it in the next round. The Service clears at most 2 for each class and 6 for each item by digest. A stop of another class, a new stop on this image, and a stop over a limit wait for a commentimplement: retry.perf(ci): build the Runner and MCP images in one bake job (#4649)
devops-cli-service commentedon Nov 24, 2026
Released in v0.211.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.211.0
devops-cli-service commentedon Nov 24, 2026
Live since 2026-11-24 20:09 UTC