Skip to content

ci: run the tool jobs in the devtools image #6416

Closed

Description

@dan-petty

Problem

CI jobs install tools with uv run devops install-tools before they run: the gate jobs (ci.yml:79-91, 189, 868, 901), copilot-setup-steps.yml:58-62, pr-title.yml:161 (openspec), rule-pack.yml:53 (semgrep), image-pins.yml:62, service-image-test.yml:158-159 and release.yml:402, 544, 680. Each install downloads from GitHub release URLs and costs job time. Tests compare copied SHAs and the order of steps (test_workflow_contracts.py:617, 670; test_ci.py:2095).

Change

Owner decision of 2026-11-19: the tools come from the devtools image.

  • Jobs that need tools and no Docker daemon run with container: ghcr.io/dan-petty/devtools:<tag>@sha256:<digest>: the jobs above.
  • Remove every uv run devops install-tools step.
  • Jobs that build images keep the host runner. Their scan uses the image-scan action of ci(security): scan each image with one Trivy action and SARIF #6405.
  • Change the tools_lock path filter of service-image-test.yml:18 (if test(ci): run the Service image suite in a service-test stage #6408 has not), and point the paths filter of rule-pack.yml at the files that pin the devtools image.
  • Fix the comment at .pre-commit-config.yaml:88.
  • Tests: test_workflow_contracts.py:620 (copilot run lines) changes. :617 and :670 assert the action name only, not the copied SHAs (zizmor unpinned-uses and pinDigests keep the pinning). Delete test_ci.py:2095 (install-tools trivy step order).

Renovate. The github-actions manager extracts the container: image, and the devtools group rule of #6414 puts it in the same PR as the Dockerfiles. #6405 handles the trivy group (packageRule 12).

Risk. Medium. A container job with a non-root image can fail actions/checkout on file permissions, so set the job user where needed. If the devtools package is private, CI needs read access to pull it.

Proof

  • The CI run of the PR is green, and every changed job logs the devtools image digest.
  • git grep -n 'install-tools' origin/main -- .github .pre-commit-config.yaml returns nothing.
  • A Renovate devtools digest PR updates the Dockerfiles and the workflows in one branch.

Depends on: dan-petty/devtools#1, #4361, #6405

Proposed design

Problem statement

CI jobs download the devops tools with uv run devops install-tools before they run, so each job spends time fetching release artifacts that an image can hold. The change runs the tool-only jobs in the pinned devtools container image, takes the tools of the Docker-daemon jobs from that image, removes the install-tools steps, keeps the image build jobs on the host runner, and updates the path filters, the OpenSpec gate comment and the tests that hold these workflows.

Acceptance criteria

Requirement: Tool jobs run in the devtools image

Every CI job that needs devops tools and runs no Docker daemon SHALL run in the devtools container image.

Scenario: Pull request CI run

  • WHEN The live check of the pull request CI run starts each changed tool job.
  • THEN The log of each changed tool job shows the devtools image digest and runs no install-tools step.

Requirement: Host jobs take tools from the devtools image

A CI job that needs the Docker daemon and devops tools SHALL keep the host runner and SHALL take its tool binaries from the pinned devtools image.

Scenario: Service image test CI run

  • WHEN The live check of the pull request CI run starts the service-image-test job.
  • THEN The job log shows the devtools image digest and the suite finds promtool and kubectl in the tools dir.

Requirement: Container image is pinned by digest

Every container.image and every docker reference of the devtools image in the changed workflows MUST name ghcr.io/dan-petty/devtools by tag and @sha256: digest.

Scenario: Digest pin live check

  • WHEN git grep -n 'ghcr.io/dan-petty/devtools:' origin/main -- .github/workflows runs.
  • THEN Every line it shows ends with @sha256:<digest>.

Requirement: Install-tools steps are removed

The workflows and the pre-commit configuration MUST contain no uv run devops install-tools step.

Scenario: Repository search

  • WHEN git grep -n 'uv run devops install-tools' origin/main -- .github/workflows .pre-commit-config.yaml runs.
  • THEN The command returns no line.

Requirement: Image build jobs keep the host runner

A CI job that builds a container image SHALL keep the host runner and SHALL use the image-scan action of #6405 for its scan.

Scenario: Image build CI run

Requirement: Path filters name the devtools image pins

The tools_lock path filter of service-image-test.yml and the paths filter of rule-pack.yml SHALL name the files that pin the devtools image.

Scenario: Path filter live check

  • WHEN A pull request changes only src/devops_cli/tools_lock/semgrep.txt.
  • THEN The service-image-test and rule-pack jobs start.

Requirement: Workflow contract test suite passes

The workflow contract test suite SHALL pass after the copilot run lines change.

Scenario: Workflow contract test suite

  • WHEN uv run pytest tests/invariants/test_workflow_contracts.py -q runs.
  • THEN The suite passes.

Requirement: Obsolete install-tools order test is removed

The test suite MUST NOT contain a test of the install-tools trivy step order.

Scenario: Test collection

  • WHEN uv run pytest tests/commands/test_ci.py -q --collect-only runs.
  • THEN The output names no test_ci_security_scan_installs_the_pinned_trivy_for_its_iac_scan.

Requirement: OpenSpec gate comment names the devtools image

The OpenSpec gate comment of .pre-commit-config.yaml SHALL name the devtools image as the holder of Node and the pinned openspec for CI.

Scenario: Configuration search

  • WHEN git grep -n 'devtools image' origin/main -- .pre-commit-config.yaml runs.
  • THEN The command shows the OpenSpec gate comment line.

Existing Tool Considered

No alternatives check has run. ghcr.io/dan-petty/devops-cli/devcontainer is the open, maintained image in this repository that covers the need: .devcontainer/Dockerfile bakes the devops tools from src/devops_cli/tools_lock/ (semgrep, openspec, style-dictionary, promtool and the rest) and the image is published to GHCR and pinned by tag and digest (docs/DEVCONTAINER_USAGE.md:16-18). What it lacks is a tool-only variant: it also carries the Dev Container features (docker-in-docker, Node, the Copilot CLI and the vscode user, .devcontainer/image/devcontainer.json:7-32), so a CI tool job pulls more than it needs. The issue's planned ghcr.io/dan-petty/devtools image of dan-petty/devtools#1 has no source in this repository and is the external block. The change adds no new tool code.

Key questions

  • Which CI jobs run in the devtools container?: The tool-only jobs run in the devtools container: the static, test-shard, design-tokens, copilot-setup-steps, pr-title, rule-pack and image-pins jobs. The jobs that need the Docker daemon keep the host runner: the image build jobs of ci.yml (service, runner, mcp-server), release.yml (service, runner, mcp-server) and the devcontainer image, plus service-image-test, which loads and runs the service image. The image build jobs use the ci(security): scan each image with one Trivy action and SARIF #6405 image-scan action; service-image-test takes promtool and kubectl from the pinned devtools image. (best practice) [sources: .github/workflows/ci.yml:56-115, .github/workflows/ci.yml:160-205, .github/workflows/ci.yml:851-915, .github/workflows/copilot-setup-steps.yml:30-68, .github/workflows/rule-pack.yml:28-55, .github/workflows/image-pins.yml:40-65, .github/workflows/service-image-test.yml:100-170, .github/workflows/ci.yml:480-530, .github/workflows/release.yml:393-410]
    • Chosen: Container only the tool jobs. The image build jobs and service-image-test need the Docker daemon, which a container job does not have.
    • Rejected: Container every job. A container job cannot use the Docker daemon that docker build, docker load and docker run need.
    • Rejected: Host every job. It keeps the release downloads that the change removes.
  • Does service-image-test run in the devtools container?: No. The job downloads the service image artifact and runs docker load and docker run on it, so it needs the Docker daemon and keeps the host runner. Its two install-tools steps put promtool and kubectl in the tools dir that the suite mounts into the service image; the change replaces them with a copy of the two binaries from the pinned devtools image (the same /usr/local/bin layout that the devcontainer image uses). (best practice) [sources: .github/workflows/service-image-test.yml:129-160]
    • Chosen: Host runner, copy the tools from the devtools image. It keeps the Docker daemon and removes the release downloads.
    • Rejected: Host runner, keep the install-tools steps. It keeps the downloads that the change removes.
    • Rejected: Container job. The job cannot run docker load and docker run without the daemon.
  • How is the devtools image pinned?: Pin it in container.image as ghcr.io/dan-petty/devtools:<tag>@sha256:<digest>, and in the service-image-test copy step as the same reference. The repository pins every container image by tag and digest (Dockerfile:3, k8s manifests), and Renovate's github-actions and dockerfile managers set pinDigests: true, so a digest update reaches the workflows and the Dockerfiles. (best practice) [sources: .github/renovate/base.json:137-140, docs/DEVCONTAINER_USAGE.md:17-18, https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container]
    • Chosen: Tag and digest. A digest fixes the image content, and the tag lets Renovate update it.
    • Rejected: Tag only. A tag can move and does not fix the image content.
    • Rejected: Digest only. Renovate has no tag to follow, so the image never updates.
  • What user does a container job use?: Use the user of the image's USER instruction. A Dev Container remoteUser does not apply to a container: job ( .devcontainer/image/devcontainer.json:64 sets vscode for devcontainers only). Add container.options: --user root only to a job that runs actions/checkout and cannot write the workspace; do not run every job as root. (best practice) [sources: https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container, .devcontainer/image/devcontainer.json:64]
    • Chosen: Image user, root only when check out fails. It keeps the least privilege that the job needs.
    • Rejected: Root on every container job. It runs more privilege than the job needs.
    • Rejected: Non-root user on every job. actions/checkout can fail to write the workspace.
  • How does CI pull the devtools image if the package is private?: Set permissions: packages: read and container.credentials with username: ${{ github.actor }} and password: ${{ secrets.GITHUB_TOKEN }} on each container job that pulls the image. The workflow token reads a private package of the repository owner and is harmless for a public one; this repository already reads GHCR packages with packages: read in the CodeQL and devcontainer image jobs. (best practice) [sources: https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container, .github/workflows/codeql.yml:45, .github/workflows/devcontainer-image.yml:55-57]
    • Chosen: Workflow token credentials. The token is available to the job and needs only packages: read.
    • Rejected: Public package only. It fails if the package is private.
    • Rejected: Personal access token secret. It adds a long-lived secret that the workflow token replaces.
  • Which tests change?: tests/invariants/test_workflow_contracts.py:620 changes: its tuple holds the copilot job's permissions map (line 646), the setup-node step (lines 647-648) and the run lines (lines 649-657), so it loses the install-tools lines and gains packages: read if the job pulls with the workflow token. The pinned refs at lines 617 and 670 stay; Renovate's pinDigests holds them. Delete tests/commands/test_ci.py:2099 (test_ci_security_scan_installs_the_pinned_trivy_for_its_iac_scan); the issue's 2095 is inside the preceding SARIF test. No other test asserts an install-tools step. [sources: tests/invariants/test_workflow_contracts.py:617, tests/invariants/test_workflow_contracts.py:620, tests/invariants/test_workflow_contracts.py:646, tests/commands/test_ci.py:2099, .github/renovate/base.json:137-140]
  • What comment changes in .pre-commit-config.yaml?: Rewrite the OpenSpec gate comment at .pre-commit-config.yaml:87-91 so it says the devtools image holds Node and the pinned openspec for CI, in place of the uv run devops install-tools --tool openspec command. [sources: .pre-commit-config.yaml:87-91]
  • Which path filters change?: service-image-test.yml already names src/devops_cli/tools_lock/** (line 18) and its own workflow (line 19); keep that path, or keep test(ci): run the Service image suite in a service-test stage #6408's path if that change lands first. rule-pack.yml names only src/devops_cli/review/rules/** and its own workflow (lines 12-13); add src/devops_cli/tools_lock/** so a change to the semgrep lock that the image bakes starts the job. (best practice) [sources: .github/workflows/service-image-test.yml:13-19, .github/workflows/rule-pack.yml:11-13, src/devops_cli/tools_lock/semgrep.txt]
  • What does the install-tools search cover?: It covers the uv run devops install-tools steps of the listed workflows and the pre-commit comment, not every install-tools text. The docker run ... install-tools --check smoke tests of the built images (.github/workflows/ci.yml:732-733, .github/workflows/release.yml:666-667), the devcontainer composite actions (.github/actions/devcontainer-image/action.yml:49, .github/actions/devcontainer-smoke/action.yml:27) and the Renovate PR body text (.github/renovate.json:294,303) stay. Use git grep -n 'uv run devops install-tools' origin/main -- .github/workflows .pre-commit-config.yaml. [sources: .github/workflows/ci.yml:732-733, .github/workflows/release.yml:666-667, .github/actions/devcontainer-image/action.yml:49, .github/actions/devcontainer-smoke/action.yml:27, .github/renovate.json:294, .pre-commit-config.yaml:88]

Fit

Fits in one pull request.

Suspected block

The ghcr.io/dan-petty/devtools image of dan-petty/devtools#1 must be published and pullable by CI.

Dependencies

#4361, #6405

Alternatives check of 2026-11-19: not-applicable.
Class: ci, no search.
Tool: none found.

Activity

  1. added
    type/infra
    source/agent
    status/new
    value/medium
    effort/medium
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  5. added
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 20, 2026
  6. removed
    status/in-progress
    owner/agent
    on Nov 20, 2026
  7. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor
  8. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-20 22:40 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions