Skip to content

ci: publish multi-platform tools image - #118

Merged
yingdi-shan merged 1 commit into
kvcache-ai:mainfrom
zlzGithub-0801:feat/tools-image-publish
Aug 5, 2026
Merged

ci: publish multi-platform tools image#118
yingdi-shan merged 1 commit into
kvcache-ai:mainfrom
zlzGithub-0801:feat/tools-image-publish

Conversation

@zlzGithub-0801

Copy link
Copy Markdown
Collaborator

What

Add a publication workflow for the AgentENV tools image.

Why

Previously, tools image publication was a manual, local process.
This workflow builds each platform on a native GitHub-hosted runner and publishes a multi-platform image to:
ghcr.io/<repository-owner>/agentenv-tools:<version>

Related issue

Closes #

Scope and non-goals

Included:

  • A new workflow for building and publishing multi-architecture tools images.

not included:

  • Changes to the AgentENV runtime workflow.

Design and behavior changes

The Publish Tools Image workflow is triggered manually with two inputs:

  • tools_version: immutable SemVer version for the complete tools drive.
  • envd_ref: tag, branch, or commit from e2b-dev/infra.

The workflow performs three stages:

  1. Validate publication
    • Validates tools_version using the existing Makefile SemVer check.
    • Checks that the final GHCR tag does not already exist.
  2. Build and push architecture images
  3. Publish the multi-platform manifest

Compatibility and operations

  • Public API or generated protocol: N/A — no API or generated protocol changes.
  • Configuration or defaults: The tools producer default remains 0.1.0; the default envd ref changes to 2026.17, and the default Go builder changes to 1.25.9.
  • Snapshot manifest, artifact layout, or storage format: N/A — no structural changes.
  • Upgrade and rollback: Published version tags are treated as immutable. Rollback is performed by configuring AgentENV to use an earlier tools version.
  • Host requirements, permissions, ports, or dependencies: Publication requires GitHub Actions package write access to the repository owner's agentenv-tools GHCR package.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:


Skipped checks and reasons:

  • make -C services test: skipped because services/ was not changed.
  • Benchmarks: skipped because this change does not affect a runtime hot path or performance-sensitive behavior.

Risks and reviewer notes

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 4 issue(s) in this PR.

  • ✅ Successfully posted inline: 4 comment(s)

Comment on lines +30 to +33
- uses: docker/setup-buildx-action@v4

- name: Log in to GHCR
uses: docker/login-action@v4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[security · high]
These Docker actions (and docker/build-push-action@v7 below) are third-party actions referenced by mutable tags. In the publishing jobs they execute with packages: write, so a moved or compromised tag could publish altered artifacts or abuse the job token. Pin every docker/* action occurrence in this workflow to a reviewed full commit SHA (optionally retaining the release tag in a comment).

Comment on lines +44 to +48
image="ghcr.io/$OWNER/agentenv-tools:$TOOLS_VERSION"
if docker buildx imagetools inspect "$image" >/dev/null 2>&1; then
echo "Refusing to overwrite published tools drive $image." >&2
exit 1
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bug · high]
This preflight does not enforce immutability atomically. Two dispatches for the same version can both pass before either publishes, then overwrite the -$arch tags and assemble a manifest from whichever tag values win. Add workflow-level concurrency keyed by tools_version with cancel-in-progress: false, and preferably capture each pushed image digest and build the manifest from those digests rather than mutable architecture tags. Also distinguish a confirmed registry “not found” response from authentication/network failures instead of treating every inspect error as absence.

Comment on lines +50 to +53
publish-images:
name: Publish ${{ matrix.platform }} image
needs: validate
runs-on: ${{ matrix.os }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[other · medium]
None of the three jobs defines timeout-minutes. A stalled registry operation or Docker build can therefore occupy a hosted runner until GitHub's platform limit. Add explicit, job-appropriate timeouts to validate, publish-images, and publish-manifest (with the image build allowed a longer limit than the registry-only jobs).

Comment on lines +88 to +91
build-args: |
TOOLS_VERSION=${{ inputs.tools_version }}
ENVD_REF=${{ inputs.envd_ref }}
ENVD_UPSTREAM_REPO=https://github.com/e2b-dev/infra.git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bug · medium]
envd_ref is neither validated nor resolved once. Because each matrix leg independently fetches this ref, a branch or moved tag can resolve to different commits for amd64 and arm64, producing an internally inconsistent supposedly immutable release. Require an immutable full commit SHA (and validate its format), or resolve the input to one commit in validate and pass that exact SHA to both builds.

Comment thread tools-image/Dockerfile
# ---------------------------------------------------------------------------
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${DEBIAN_VERSION} AS envd-builder

ARG ENVD_REF=2026.16

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we change the ENVD REF?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the previous 2026.16 corresponds to envd version 0.5.13, and 2026.17 corresponds to envd version 0.5.15, which is the version pinned in the toml file.

@yingdi-shan
yingdi-shan self-requested a review August 5, 2026 10:14
@yingdi-shan
yingdi-shan merged commit 990eb0d into kvcache-ai:main Aug 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants