From 820707e6e217039c4c5e1ac4d2154e80e369463f Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Tue, 10 Nov 2026 02:45:54 +0000 Subject: [PATCH 1/2] fix(ci): the release publishes the mcp-server image Deployment mcp-server names ghcr.io/dan-petty/devops-cli/mcp-server, and no workflow pushed it, so the pod stayed in ImagePullBackOff. The release now builds, scans, pushes, attests and tags the image like the runner image, and a test fails when a manifest under k8s/ names an image that no release job publishes. --- .github/workflows/release.yml | 124 ++++++++++++++++++ RELEASE_CYCLE.md | 3 +- k8s/README.md | 2 +- .../.openspec.yaml | 2 + .../design.md | 12 ++ .../proposal.md | 34 +++++ .../specs/mcp-server-image/spec.md | 25 ++++ .../tasks.md | 13 ++ tests/invariants/test_k8s_manifests.py | 54 ++++++++ tests/invariants/test_mcp_server_image.py | 68 ++++++++++ tests/invariants/test_workflow_contracts.py | 14 +- 11 files changed, 347 insertions(+), 4 deletions(-) create mode 100644 openspec/changes/4324-the-release-publishes-the-mcp-server/.openspec.yaml create mode 100644 openspec/changes/4324-the-release-publishes-the-mcp-server/design.md create mode 100644 openspec/changes/4324-the-release-publishes-the-mcp-server/proposal.md create mode 100644 openspec/changes/4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md create mode 100644 openspec/changes/4324-the-release-publishes-the-mcp-server/tasks.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0f1f5cbbf..c2c623d9b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -566,3 +566,127 @@ jobs: if [ -n "$TAG" ]; then TAG_ARGS+=(--tag "$TAG"); fi done <<< "$TAGS" docker buildx imagetools create "${TAG_ARGS[@]}" "${RUNNER_IMAGE}@${DIGEST}" + + mcp-server-image: + name: Build & Publish MCP Server Image + needs: release-please + # It builds, smoke-tests, scans, pushes by digest and attests the mcp-server image of the + # release, then tags it with the release tag and latest; Image Updater rolls Deployment + # mcp-server onto the new digest (#4324). The package is new: a person sets it public once, so + # the pod pulls it with no credential (see the pull request of #4324). + if: needs.release-please.outputs.release_created == 'true' + runs-on: ubuntu-26.04 + timeout-minutes: 30 + permissions: + contents: read + packages: write + id-token: write + attestations: write + env: + MCP_SERVER_IMAGE: ghcr.io/${{ github.repository }}/mcp-server + + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + # The commit that the release tags: a later push can start the run that creates it. + ref: ${{ needs.release-please.outputs.sha }} + persist-credentials: false + + - name: Log in to GitHub Container Registry (GHCR) + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v3 + + - name: Extract Metadata for MCP Server Image + id: meta + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 + with: + images: ${{ env.MCP_SERVER_IMAGE }} + tags: | + type=raw,value=${{ needs.release-please.outputs.tag_name }} + type=raw,value=latest + labels: | + org.opencontainers.image.title=devops-cli-mcp-server + org.opencontainers.image.description=DevOps CLI MCP server that serves role-scoped tool sets to cluster jobs + org.opencontainers.image.licenses=MIT + org.opencontainers.image.documentation=https://github.com/dan-petty/devops-cli/blob/main/README.md + org.opencontainers.image.source=https://github.com/dan-petty/devops-cli + org.opencontainers.image.version=${{ needs.release-please.outputs.tag_name }} + + - name: Build and Load MCP Server Image + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v6 + with: + context: . + file: ./Dockerfile + target: mcp-server + load: true + push: false + tags: devops-cli-mcp-server:local + no-cache-filters: mcp-server + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Run MCP Server Image Smoke Test + env: + IMAGE: devops-cli-mcp-server:local + run: | + docker run --rm --entrypoint id "$IMAGE" -u + docker run --rm "$IMAGE" --version + docker run --rm -e DEVOPS_CLI_USER_DATA_ROOT=/opt/devops-tools --entrypoint devops "$IMAGE" install-tools --check --tool kubectl --target-dir /opt/devops-tools/bin + docker run --rm -e DEVOPS_CLI_USER_DATA_ROOT=/opt/devops-tools --entrypoint devops "$IMAGE" install-tools --check --tool helm --target-dir /opt/devops-tools/bin + size=$(docker image inspect "$IMAGE" --format '{{.Size}}') + if [ "$size" -gt 3000000000 ]; then echo "The mcp-server image is $size bytes, over the bound of 3000000000."; exit 1; fi + + - name: Scan MCP Server Image for Vulnerabilities + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 + with: + image-ref: devops-cli-mcp-server:local + scanners: vuln + severity: HIGH,CRITICAL + ignore-unfixed: true + trivyignores: .trivyignore,.trivyignore-mcp-server + exit-code: "1" + version: v0.75.0 + + # Pushed by digest only: the tags move to the digest once its provenance is attested, so + # a tag never names an unattested image and a failed attestation is retried by a re-run. + - name: Build and Push MCP Server Image + id: push + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v6 + with: + context: . + file: ./Dockerfile + target: mcp-server + platforms: linux/amd64 + outputs: type=image,name=${{ env.MCP_SERVER_IMAGE }},push-by-digest=true,name-canonical=true,push=true + labels: ${{ steps.meta.outputs.labels }} + sbom: true + no-cache-filters: mcp-server + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Attest Build Provenance + uses: actions/attest-build-provenance@9d57eef8c06cd9d6b433effeeb7a6a77b3ff94ad # v2 + with: + subject-name: ghcr.io/${{ github.repository }}/mcp-server + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true + + - name: Tag the Attested MCP Server Image + id: tag + shell: bash + env: + DIGEST: ${{ steps.push.outputs.digest }} + TAGS: ${{ steps.meta.outputs.tags }} + run: | + TAG_ARGS=() + while read -r TAG; do + if [ -n "$TAG" ]; then TAG_ARGS+=(--tag "$TAG"); fi + done <<< "$TAGS" + docker buildx imagetools create "${TAG_ARGS[@]}" "${MCP_SERVER_IMAGE}@${DIGEST}" diff --git a/RELEASE_CYCLE.md b/RELEASE_CYCLE.md index 70c5276f2c..49e7f0e822 100644 --- a/RELEASE_CYCLE.md +++ b/RELEASE_CYCLE.md @@ -63,8 +63,9 @@ The `Release` run of the merge creates the GitHub release and its tag. Then thes | `Build DevContainer Image`, `Smoke-Test DevContainer Image`, `Attest & Tag DevContainer Image` | `ghcr.io/dan-petty/devops-cli/devcontainer`, tagged with the release tag and `latest` | | `Build & Publish Service Image` | `ghcr.io/dan-petty/devops-cli/service`, tagged with the release tag and `latest` | | `Build & Publish Runner Image` | `ghcr.io/dan-petty/devops-cli/runner`, the image of the implement Job, tagged with the release tag and `latest` | +| `Build & Publish MCP Server Image` | `ghcr.io/dan-petty/devops-cli/mcp-server`, the image of Deployment `mcp-server`, tagged with the release tag and `latest` | -Argo CD Image Updater then moves the Service and the CronJob template of the runner onto the new image digests ([`k8s/README.md`](k8s/README.md), Service Image Updates). +Argo CD Image Updater then moves the Service, the CronJob template of the runner and Deployment `mcp-server` onto the new image digests ([`k8s/README.md`](k8s/README.md), Service Image Updates). ## When a Publish Job Fails diff --git a/k8s/README.md b/k8s/README.md index 077573e4f4..abbde58e2d 100644 --- a/k8s/README.md +++ b/k8s/README.md @@ -1153,7 +1153,7 @@ devops k8s deploy-stack --stack devops ### Service Image Updates -Application `argocd-image-updater` runs [Argo CD Image Updater](https://argocd-image-updater.readthedocs.io/en/stable/) in namespace `argocd`, from the argo-helm chart pinned to a version like the other chart Applications. Its one ImageUpdater, `devops` in `k8s/argocd/image-updater-values.yaml`, keeps the `devops` Application on the digests that `ghcr.io/dan-petty/devops-cli/service:latest` and `ghcr.io/dan-petty/devops-cli/runner:latest` point at. The text below describes the Service image; the runner image of CronJob `devops-cli-runner` is handled in the same way: +Application `argocd-image-updater` runs [Argo CD Image Updater](https://argocd-image-updater.readthedocs.io/en/stable/) in namespace `argocd`, from the argo-helm chart pinned to a version like the other chart Applications. Its one ImageUpdater, `devops` in `k8s/argocd/image-updater-values.yaml`, keeps the `devops` Application on the digests that `ghcr.io/dan-petty/devops-cli/service:latest`, `ghcr.io/dan-petty/devops-cli/runner:latest` and `ghcr.io/dan-petty/devops-cli/mcp-server:latest` point at. The text below describes the Service image; the runner image of CronJob `devops-cli-runner` and the image of Deployment `mcp-server` are handled in the same way. The release publishes each of the three, and a test fails when a manifest names an image of this repository that no job of `release.yml` pushes (#4324). After the first release that publishes the MCP server image, a person makes the GHCR package `mcp-server` public, as the package `service` is, or the pod stays in `ImagePullBackOff`: - Every two minutes it reads that digest. When the Application runs another one, it writes `ghcr.io/dan-petty/devops-cli/service:latest@sha256:` into the Application's `spec.source.kustomize.images`, and Argo CD rolls roadmap-service and CronJob `devops-cli` onto it. Git names the image untagged, and that entry sets its tag and digest. - It updates the image also when no pod runs it, because the image sets `forceUpdate: true`. Without it, Image Updater updates only the images that a pod in the Application's tree runs, and no such pod runs this image: CronJob `devops-cli` is a suspended template, `roadmap-service` can be at 0 replicas, and the Jobs that `devops k8s run-job` starts are outside the tree. ImageUpdater `devops` then stays Ready with `imagesManaged: 0` and updates nothing. When the Application already names the digest, it writes nothing. diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/.openspec.yaml b/openspec/changes/4324-the-release-publishes-the-mcp-server/.openspec.yaml new file mode 100644 index 0000000000..2b638f8381 --- /dev/null +++ b/openspec/changes/4324-the-release-publishes-the-mcp-server/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-10 diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/design.md b/openspec/changes/4324-the-release-publishes-the-mcp-server/design.md new file mode 100644 index 0000000000..6b26c78538 --- /dev/null +++ b/openspec/changes/4324-the-release-publishes-the-mcp-server/design.md @@ -0,0 +1,12 @@ +# Design + +## Decisions +- **Copy the `runner-image` job.** It builds, scans, pushes by digest, attests, then tags. A tag never names an unattested image, and a failed attestation is retried by a re-run. The job needs `release-please` and runs only when `release_created` is `true`, like the other publish jobs. +- **One gate for CI and release.** The smoke test of the release equals the smoke test of `ci.yml`, and the release scan equals the CI scan, including `.trivyignore-mcp-server`. A test compares them. The image that is pushed passed what the pull request checked. +- **Tie the manifests to the publish jobs with a test.** The test reads each YAML file under `k8s/`, collects every value of the keys `image` and `imageName` that starts with `ghcr.io/dan-petty/devops-cli/`, and requires that a job of `release.yml` attests that name. It reads files only, so it needs no network and runs in the devcontainer and on the GitHub runner. +- **Keep the manifest.** The manifest follows the pin convention of the repository: no tag, and Image Updater writes the digest from `latest`. No digest in git can exist before a first publish. + +## Rejected alternatives +- **Delete or disable Deployment `mcp-server`.** The roadmap Service and the runner Jobs need the server (#3221, #4191), and Argo CD would prune a deleted manifest. The image is the missing part. +- **Publish the image from `ci.yml` on `main`.** The other images publish at a release only, and a push on each merge would give the cluster an image that is not a release. +- **A reusable workflow for the three image jobs.** It is a larger change of pinned jobs and outside this issue. diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/proposal.md b/openspec/changes/4324-the-release-publishes-the-mcp-server/proposal.md new file mode 100644 index 0000000000..7a8014ac7e --- /dev/null +++ b/openspec/changes/4324-the-release-publishes-the-mcp-server/proposal.md @@ -0,0 +1,34 @@ +# Proposal: The Release Publishes the MCP Server Image (#4324) + +## Why +Deployment `mcp-server` in namespace `devops` has been in `ImagePullBackOff` since it was created (2026-11-09T21:16Z). It names `ghcr.io/dan-petty/devops-cli/mcp-server`, and no workflow pushes that image. `release.yml` pushes `devcontainer`, `service` and `runner`. `ci.yml` job `mcp-server-image` (#3220) builds the target with `push: false`. Image Updater cannot find the package, so it writes no digest for it. Closes #4324. + +## What Changes +- Add job `mcp-server-image` to `release.yml`. It follows job `runner-image`: build and load the `mcp-server` target, run the smoke test, scan, push by digest, attest, and tag with the release tag and `latest`. +- Run in the release the same smoke test and the same Trivy scan (with `.trivyignore-mcp-server`) as `ci.yml` job `mcp-server-image`. A test fails when the two differ. +- Add a test that fails when a manifest or an ImageUpdater under `k8s/` names `ghcr.io/dan-petty/devops-cli/` and no job of `release.yml` attests ``. +- Update `RELEASE_CYCLE.md` and `k8s/README.md` to list the new job and the person step. + +The manifest `k8s/devops/mcp-server/deployment.yaml` does not change: it names the image with no tag, as the `service` and `runner` manifests do, and the entry `mcp-server` of the ImageUpdater already keeps the digest. + +## Capabilities + +### Modified Capabilities +- `mcp-server-image`: the release publishes the image, and a test ties each image of this repository in `k8s/` to a publish job. + +## Impact +- `.github/workflows/release.yml` gains one job that runs only in the run that creates a release. No pull request check changes. +- A person makes the new GHCR package public once, after its first publish. Until then the pod cannot pull the image. +- The pod becomes Ready only after the first release that holds this job. + +## Feasibility +Checked against the real system on 2026-11-10: +- `kubectl -n devops describe pod -l app.kubernetes.io/name=mcp-server`: `Back-off pulling image "ghcr.io/dan-petty/devops-cli/mcp-server"` (1296 times in 4h58m). Application `devops` is `Synced` and `Degraded`. +- `devops gh api /user/packages/container/devops-cli%2Fmcp-server/versions` returns 404, `Package not found`. +- The log of the Image Updater controller, every two minutes: `Could not get tags from registry: Get "https://ghcr.io/v2/dan-petty/devops-cli/mcp-server/tags/list": denied`. `spec.source.kustomize.images` of Application `devops` holds `service` and `runner` only. +- `release.yml` has no job that names `mcp-server`. `rg mcp-server .github/workflows` finds `ci.yml` only. +- `Dockerfile` stage `mcp-server` exists and `ci.yml` builds, smoke-tests and scans it on each pull request, so the release can reuse that gate. +- The deployment is wanted: #3220 added the image, #4182 deferred the manifests until the image existed, and #4275 added the manifests with the ImageUpdater entry. Nothing in them publishes the image. So the fix is the publish job, not a removal of the Deployment. + +## Existing Tool Considered +The job uses the actions that the `service` and `runner` jobs already use (`docker/build-push-action`, `docker/metadata-action`, `aquasecurity/trivy-action`, `actions/attest-build-provenance`, `docker buildx imagetools`). A reusable workflow would remove the duplicate of the three image jobs, but it changes the pinned `service` and `runner` jobs, which is outside this issue. The cost of this job is one copy of 124 lines, about 15k tokens, which the test of the identical smoke test and scan keeps in step with `ci.yml`. diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md b/openspec/changes/4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md new file mode 100644 index 0000000000..a6fa8e3d02 --- /dev/null +++ b/openspec/changes/4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md @@ -0,0 +1,25 @@ +## Purpose +The container image target for the MCP server that serves role-scoped tool sets to cluster jobs. + +## ADDED Requirements + +### Requirement: The release publishes the MCP server image +The `release.yml` workflow SHALL build, smoke-test, scan, push by digest, attest and tag the `mcp-server` image, in that order, only in the run that creates a release. It SHALL tag the image with the release tag and `latest`. + +#### Scenario: Publish job order +- **WHEN** A test reads job `mcp-server-image` of `release.yml`. +- **THEN** The job needs `release-please`, runs only when `release_created` is `true`, builds target `mcp-server`, pushes with `push-by-digest=true`, attests `ghcr.io/${{ github.repository }}/mcp-server`, and its steps keep the order of the `runner-image` job. + +### Requirement: The release gate equals the pull request gate +The smoke test and the vulnerability scan of the release job SHALL equal those of job `mcp-server-image` in `ci.yml`. + +#### Scenario: Same smoke test and scan +- **WHEN** A test compares the two jobs. +- **THEN** The smoke test scripts are equal and the inputs of the Trivy steps are equal. + +### Requirement: Each image of this repository in k8s has a publish job +Each value of the keys `image` and `imageName` under `k8s/` that starts with `ghcr.io/dan-petty/devops-cli/` SHALL name an image that a job of `release.yml` attests. + +#### Scenario: Manifest names an unpublished image +- **WHEN** A manifest under `k8s/` names `ghcr.io/dan-petty/devops-cli/` and no job of `release.yml` attests ``. +- **THEN** The test fails and names the image and the file. diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/tasks.md b/openspec/changes/4324-the-release-publishes-the-mcp-server/tasks.md new file mode 100644 index 0000000000..07553637d4 --- /dev/null +++ b/openspec/changes/4324-the-release-publishes-the-mcp-server/tasks.md @@ -0,0 +1,13 @@ +# Tasks + +## 1. Behavior + +- [x] 1.1 Write the failing tests: the release job, the same smoke test and scan, and the check that each image in `k8s/` has a publish job + - Verification: `$ uv run devops ci fail-to-pass --base origin/main` shows the tests fail before the change and pass after it +- [x] 1.2 Add job `mcp-server-image` to `release.yml` + - Verification: `$ uv run devops ci test tests/invariants/test_mcp_server_image.py tests/invariants/test_workflow_contracts.py tests/invariants/test_k8s_manifests.py` + +## 2. Documents + +- [x] 2.1 List the job in `RELEASE_CYCLE.md` and the person step in `k8s/README.md` + - Verification: `$ uv run devops ci docs` diff --git a/tests/invariants/test_k8s_manifests.py b/tests/invariants/test_k8s_manifests.py index bb268efd38..5bc77381f1 100644 --- a/tests/invariants/test_k8s_manifests.py +++ b/tests/invariants/test_k8s_manifests.py @@ -1052,3 +1052,57 @@ def test_the_tunnel_section_of_the_k8s_readme_names_only_hosts_that_a_manifest_s name for name in names if not any(fnmatch.fnmatchcase(host, name) for host in served) ) assert unmatched == [] + + +OWN_IMAGE_PREFIX = "ghcr.io/dan-petty/devops-cli/" +OWN_IMAGE_KEYS = frozenset({"image", "imageName"}) +RELEASE_IMAGE_PREFIX = "ghcr.io/${{ github.repository }}/" + + +def _own_image_names(node: Any) -> Iterator[str]: + """The names of the images of this repository that a YAML node references, at any depth. + + A name is the part after the prefix, without the tag or the digest. + """ + if isinstance(node, dict): + for key, value in node.items(): + if ( + key in OWN_IMAGE_KEYS + and isinstance(value, str) + and value.startswith(OWN_IMAGE_PREFIX) + ): + yield re.split(r"[:@]", value.removeprefix(OWN_IMAGE_PREFIX))[0] + else: + yield from _own_image_names(value) + elif isinstance(node, list): + for item in node: + yield from _own_image_names(item) + + +def _released_image_names() -> frozenset[str]: + """The images that a job of release.yml attests, which a job does after it pushes the image.""" + workflow = yaml.safe_load((REPO_ROOT / ".github/workflows/release.yml").read_text("utf-8")) + return frozenset( + step["with"]["subject-name"].removeprefix(RELEASE_IMAGE_PREFIX) + for job in workflow["jobs"].values() + for step in job.get("steps", []) + if str(step.get("uses", "")).startswith("actions/attest-build-provenance") + ) + + +def test_every_image_of_this_repository_that_k8s_names_is_published_by_the_release() -> None: + """A manifest or an ImageUpdater under k8s/ that names ghcr.io/dan-petty/devops-cli/ needs a + job in release.yml that pushes and attests , or the pod waits in ImagePullBackOff (#4324).""" + named = { + name: path.relative_to(REPO_ROOT).as_posix() + for path, document in yaml_documents(K8S_DIR) + for name in _own_image_names(document) + } + + assert named, "No image of this repository found under k8s/" + unpublished = { + f"{OWN_IMAGE_PREFIX}{name}": path + for name, path in named.items() + if name not in _released_image_names() + } + assert unpublished == {} diff --git a/tests/invariants/test_mcp_server_image.py b/tests/invariants/test_mcp_server_image.py index cfe796a06e..d8722c3348 100644 --- a/tests/invariants/test_mcp_server_image.py +++ b/tests/invariants/test_mcp_server_image.py @@ -96,6 +96,74 @@ def test_the_pull_request_check_builds_and_scans_mcp_server_image() -> None: assert int(bound) <= 3000000000 +MCP_SERVER_STEPS = ( + "Build and Load MCP Server Image", + "Run MCP Server Image Smoke Test", + "Scan MCP Server Image for Vulnerabilities", + "Build and Push MCP Server Image", + "Attest Build Provenance", + "Tag the Attested MCP Server Image", +) + + +def _release_job() -> dict[str, Any]: + job: dict[str, Any] = _workflow("release.yml")["jobs"]["mcp-server-image"] + return job + + +def test_the_release_publishes_the_mcp_server_image_next_to_the_service_image() -> None: + """The release SHALL build, smoke-test, scan, push by digest, attest and tag the mcp-server image, + in that order, and only in the run that creates a release (#4324).""" + job = _release_job() + names = [step.get("name", "") for step in job["steps"]] + indices = [names.index(name) for name in MCP_SERVER_STEPS] + meta = next(step for step in job["steps"] if step.get("id") == "meta") + push = _step(job, "Build and Push MCP Server Image")["with"] + attest = _step(job, "Attest Build Provenance")["with"] + + assert ( + job["if"], + job["needs"], + job["env"]["MCP_SERVER_IMAGE"], + indices == sorted(indices), + _step(job, "Build and Load MCP Server Image")["with"]["target"], + push["target"], + "push-by-digest=true" in push["outputs"], + push["no-cache-filters"], + attest["subject-name"], + [line.strip() for line in meta["with"]["tags"].splitlines() if line.strip()], + ) == ( + "needs.release-please.outputs.release_created == 'true'", + "release-please", + "ghcr.io/${{ github.repository }}/mcp-server", + True, + "mcp-server", + "mcp-server", + True, + "mcp-server", + "ghcr.io/${{ github.repository }}/mcp-server", + ["type=raw,value=${{ needs.release-please.outputs.tag_name }}", "type=raw,value=latest"], + ) + + +def test_the_release_scans_the_mcp_server_image_like_the_pull_request_check() -> None: + """The release scan SHALL equal the scan of the pull request check, with the same ignore files.""" + release = _step(_release_job(), "Scan MCP Server Image for Vulnerabilities")["with"] + ci = _step( + _workflow("ci.yml")["jobs"]["mcp-server-image"], "Scan MCP Server Image for Vulnerabilities" + )["with"] + + assert release == ci + + +def test_the_smoke_test_of_the_mcp_server_image_is_the_same_in_ci_and_in_the_release() -> None: + """Both workflows SHALL run one smoke test, so the image that is pushed passed what CI checked.""" + ci = _step(_workflow("ci.yml")["jobs"]["mcp-server-image"], MCP_SERVER_STEPS[1])["run"] + release = _step(_release_job(), MCP_SERVER_STEPS[1])["run"] + + assert ci.strip() == release.strip() + + def test_every_mcp_server_trivyignore_entry_has_a_reason_and_an_exp_date_that_is_not_past() -> None: """Verify that each entry in `.trivyignore-mcp-server` has a reason and a future exp date.""" text = (REPO_ROOT / ".trivyignore-mcp-server").read_text(encoding="utf-8") diff --git a/tests/invariants/test_workflow_contracts.py b/tests/invariants/test_workflow_contracts.py index 95802642bc..31051bf7c2 100644 --- a/tests/invariants/test_workflow_contracts.py +++ b/tests/invariants/test_workflow_contracts.py @@ -138,7 +138,8 @@ def test_release_please_makes_every_release_on_a_push_to_main() -> None: "sha": "${{ steps.release.outputs.sha }}", }, dict.fromkeys( - ("assets", "devcontainer-image", "service-image", "runner-image"), _RELEASE_CREATED + ("assets", "devcontainer-image", "service-image", "runner-image", "mcp-server-image"), + _RELEASE_CREATED, ), ) assert [name for name in jobs if name != "release-please" and not _gated(jobs, name)] == [] @@ -289,7 +290,14 @@ def test_every_publish_job_checks_out_the_commit_release_please_tagged() -> None if any(s.get("name") == "Check out repository" for s in job.get("steps", [])) } assert checkouts == dict.fromkeys( - ("assets", "devcontainer-image", "devcontainer-smoke", "service-image", "runner-image"), + ( + "assets", + "devcontainer-image", + "devcontainer-smoke", + "service-image", + "runner-image", + "mcp-server-image", + ), (True, {"ref": "${{ needs.release-please.outputs.sha }}", "persist-credentials": False}), ) @@ -443,6 +451,7 @@ def test_release_workflow_attest_build_provenance_contract() -> None: ("devcontainer", "ghcr.io/${{ github.repository }}/devcontainer"), ("service-image", "ghcr.io/${{ github.repository }}/service"), ("runner-image", "ghcr.io/${{ github.repository }}/runner"), + ("mcp-server-image", "ghcr.io/${{ github.repository }}/mcp-server"), ] @@ -476,6 +485,7 @@ def test_every_trivy_scan_runs_the_trivy_tools_lock_pins() -> None: ("ci.yml", "third-party-image-scan", pinned), ("release.yml", "service-image", pinned), ("release.yml", "runner-image", pinned), + ("release.yml", "mcp-server-image", pinned), ] From 29f1c75de704b73d9b520511e7e38c255099ff03 Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Tue, 10 Nov 2026 02:53:31 +0000 Subject: [PATCH 2/2] docs(openspec): archive the change of #4324 --- .../.openspec.yaml | 0 .../design.md | 0 .../proposal.md | 0 .../specs/mcp-server-image/spec.md | 0 .../tasks.md | 0 openspec/specs/mcp-server-image/spec.md | 21 +++++++++++++++++++ 6 files changed, 21 insertions(+) rename openspec/changes/{4324-the-release-publishes-the-mcp-server => archive/2026-11-10-4324-the-release-publishes-the-mcp-server}/.openspec.yaml (100%) rename openspec/changes/{4324-the-release-publishes-the-mcp-server => archive/2026-11-10-4324-the-release-publishes-the-mcp-server}/design.md (100%) rename openspec/changes/{4324-the-release-publishes-the-mcp-server => archive/2026-11-10-4324-the-release-publishes-the-mcp-server}/proposal.md (100%) rename openspec/changes/{4324-the-release-publishes-the-mcp-server => archive/2026-11-10-4324-the-release-publishes-the-mcp-server}/specs/mcp-server-image/spec.md (100%) rename openspec/changes/{4324-the-release-publishes-the-mcp-server => archive/2026-11-10-4324-the-release-publishes-the-mcp-server}/tasks.md (100%) diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/.openspec.yaml b/openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/.openspec.yaml similarity index 100% rename from openspec/changes/4324-the-release-publishes-the-mcp-server/.openspec.yaml rename to openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/.openspec.yaml diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/design.md b/openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/design.md similarity index 100% rename from openspec/changes/4324-the-release-publishes-the-mcp-server/design.md rename to openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/design.md diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/proposal.md b/openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/proposal.md similarity index 100% rename from openspec/changes/4324-the-release-publishes-the-mcp-server/proposal.md rename to openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/proposal.md diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md b/openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md similarity index 100% rename from openspec/changes/4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md rename to openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/specs/mcp-server-image/spec.md diff --git a/openspec/changes/4324-the-release-publishes-the-mcp-server/tasks.md b/openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/tasks.md similarity index 100% rename from openspec/changes/4324-the-release-publishes-the-mcp-server/tasks.md rename to openspec/changes/archive/2026-11-10-4324-the-release-publishes-the-mcp-server/tasks.md diff --git a/openspec/specs/mcp-server-image/spec.md b/openspec/specs/mcp-server-image/spec.md index bba66a5938..a5fd250eb2 100644 --- a/openspec/specs/mcp-server-image/spec.md +++ b/openspec/specs/mcp-server-image/spec.md @@ -39,3 +39,24 @@ The `service` stage SHALL stay the last stage of the `Dockerfile`. #### Scenario: Service stage is last - **WHEN** A test lists the stages of the `Dockerfile`. - **THEN** The last stage is `service` and `mcp-server` comes before it. + +### Requirement: The release publishes the MCP server image +The `release.yml` workflow SHALL build, smoke-test, scan, push by digest, attest and tag the `mcp-server` image, in that order, only in the run that creates a release. It SHALL tag the image with the release tag and `latest`. + +#### Scenario: Publish job order +- **WHEN** A test reads job `mcp-server-image` of `release.yml`. +- **THEN** The job needs `release-please`, runs only when `release_created` is `true`, builds target `mcp-server`, pushes with `push-by-digest=true`, attests `ghcr.io/${{ github.repository }}/mcp-server`, and its steps keep the order of the `runner-image` job. + +### Requirement: The release gate equals the pull request gate +The smoke test and the vulnerability scan of the release job SHALL equal those of job `mcp-server-image` in `ci.yml`. + +#### Scenario: Same smoke test and scan +- **WHEN** A test compares the two jobs. +- **THEN** The smoke test scripts are equal and the inputs of the Trivy steps are equal. + +### Requirement: Each image of this repository in k8s has a publish job +Each value of the keys `image` and `imageName` under `k8s/` that starts with `ghcr.io/dan-petty/devops-cli/` SHALL name an image that a job of `release.yml` attests. + +#### Scenario: Manifest names an unpublished image +- **WHEN** A manifest under `k8s/` names `ghcr.io/dan-petty/devops-cli/` and no job of `release.yml` attests ``. +- **THEN** The test fails and names the image and the file.