Repository navigation
ci(docker): add TokenSpeed engine image release workflow #1927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: Release SMG+TokenSpeed Docker Image | ||
|
|
||
| run-name: >- | ||
| SMG+TokenSpeed | | ||
| ${{ github.event_name == 'push' && 'base=lightseekorg/tokenspeed:tml' || format('base={0}', inputs.base_image_ref || 'lightseekorg/tokenspeed:tml') }} | | ||
| engine=${{ inputs.tokenspeed_commit || 'latest' }} | | ||
| smg=${{ github.event_name == 'pull_request' && 'main' || inputs.smg_commit || 'v1.7.0' }} | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Build the triggering revision, not 🤖 Prompt for AI Agents |
||
| ${{ github.event_name == 'pull_request' && 'dry-run |' || '' }} | ||
| by @${{ github.actor }} | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - bindings/python/pyproject.toml | ||
|
Comment on lines
+12
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== workflow file ==\n'
wc -l .github/workflows/release-tokenspeed-docker.yml
cat -n .github/workflows/release-tokenspeed-docker.yml
printf '\n== search related references ==\n'
rg -n "release-tokenspeed-docker|pyproject.toml|docker|publish|dry run|pull_request|push:" .github/workflows bindings -SRepository: lightseekorg/smg Length of output: 26489 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,220p' .github/workflows/release-tokenspeed-docker.yml | cat -nRepository: lightseekorg/smg Length of output: 3288 Broaden the push trigger for TokenSpeed releases. 🤖 Prompt for AI Agents |
||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'docker/engine.Dockerfile' | ||
| - '.github/workflows/_build-engine-image.yml' | ||
| - '.github/workflows/release-*-docker.yml' | ||
| - 'scripts/installation/**' | ||
| workflow_dispatch: | ||
| inputs: | ||
| base_image_ref: | ||
| description: 'Base image (e.g. lightseekorg/tokenspeed:tml). Engine is baked in; leave engine repo empty.' | ||
| default: 'lightseekorg/tokenspeed:tml' | ||
| required: true | ||
| type: string | ||
| tokenspeed_repo: | ||
| description: 'TokenSpeed repo URL (empty = use engine from base image)' | ||
| required: false | ||
| type: string | ||
| tokenspeed_commit: | ||
| description: 'TokenSpeed commit/ref ("latest" for HEAD)' | ||
| required: false | ||
| default: 'latest' | ||
| type: string | ||
| smg_repo: | ||
| description: 'SMG repo URL' | ||
| required: false | ||
| default: 'https://github.com/lightseekorg/smg' | ||
| type: string | ||
| smg_commit: | ||
| description: 'SMG commit/ref ("latest" for HEAD)' | ||
| required: false | ||
| default: 'v1.7.0' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new workflow has the same Useful? React with 👍 / 👎. |
||
| type: string | ||
| tag: | ||
| description: 'Override image tag (e.g. v1.7.0-tokenspeed-tml)' | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
Comment on lines
+54
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
file=".github/workflows/release-tokenspeed-docker.yml"
echo "== file outline =="
ast-grep outline "$file" --view expanded || true
echo
echo "== numbered file excerpt =="
cat -n "$file"Repository: lightseekorg/smg Length of output: 3398 Scope 🧰 Tools🪛 zizmor (1.26.1)[error] 56-56: overly broad permissions (excessive-permissions): packages: write is overly broad at the workflow level (excessive-permissions) [warning] 56-56: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| base_image: ${{ github.event_name == 'push' && fromJSON('["lightseekorg/tokenspeed:tml"]') || fromJSON(format('["{0}"]', inputs.base_image_ref || 'lightseekorg/tokenspeed:tml')) }} | ||
| uses: ./.github/workflows/_build-engine-image.yml | ||
| with: | ||
| engine: tokenspeed | ||
| base_image_ref: ${{ matrix.base_image }} | ||
| engine_repo: ${{ inputs.tokenspeed_repo }} | ||
| engine_commit: ${{ inputs.tokenspeed_commit || 'latest' }} | ||
| smg_repo: ${{ inputs.smg_repo || 'https://github.com/lightseekorg/smg' }} | ||
| smg_commit: ${{ github.event_name == 'pull_request' && 'main' || inputs.smg_commit || 'v1.7.0' }} | ||
| tag: ${{ inputs.tag }} | ||
| dry_run: ${{ github.event_name == 'pull_request' }} | ||
| secrets: inherit | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win Avoid inheriting all caller secrets. Pass only the named secret(s) required by the reusable workflow, such as 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| # | ||
| # Build args: | ||
| # BASE_IMAGE_REF - full image:tag to start FROM | ||
| # ENGINE - engine name: vllm | sglang | trtllm | tgl | ||
| # ENGINE - engine name: vllm | sglang | trtllm | tgl | tokenspeed | ||
| # BACKEND - SMG_DEFAULT_BACKEND value (defaults to ENGINE; tgl overrides to sglang) | ||
| # ENGINE_REPO - if set, engine source is cloned and install-<ENGINE>.sh runs | ||
| # ENGINE_COMMIT - commit/ref for ENGINE_REPO ("latest" = HEAD) | ||
|
|
@@ -44,7 +44,7 @@ | |
| COPY scripts/installation/ /tmp/scripts/ | ||
|
|
||
| # ── final stage: install SMG + conditionally install engine ────────────────── | ||
| FROM ${BASE_IMAGE_REF} | ||
|
Check warning on line 47 in docker/engine.Dockerfile
|
||
|
|
||
| ARG ENGINE=sglang | ||
| ARG BACKEND | ||
|
|
@@ -66,10 +66,28 @@ | |
| pip install --no-cache-dir --ignore-installed pyyaml; \ | ||
| fi | ||
|
|
||
| # TokenSpeed prep. The base is a debian-system-Python image, so it needs the | ||
| # same debian-shadow treatment as the NGC trtllm base plus a gRPC cleanup: | ||
| # 1. pip/pyyaml are debian-owned with no pip RECORD file, so install-smg.sh's | ||
| # `pip install --upgrade pip` (and the smg wheel's pyyaml dep) fail with | ||
| # "Cannot uninstall … RECORD file not found". Shadow them with pip-managed | ||
| # copies (--ignore-installed leaves the distro files alone) so the smg | ||
| # install can upgrade them normally. | ||
| # 2. The base bakes in `tokenspeed-smg-grpc-proto` / `tokenspeed-smg-grpc-servicer`, | ||
| # which claim the same `smg_grpc_proto` / `smg_grpc_servicer` import paths | ||
| # that install-smg.sh reinstalls from source. Left in place they can shadow | ||
| # the source installs and serve stale proto descriptors ("Method not | ||
| # found!"). Drop them first so SMG's own gRPC modules win. | ||
| # Scoped to tokenspeed so the other engine bases keep their exact pip behavior. | ||
| RUN if [ "${ENGINE}" = "tokenspeed" ]; then \ | ||
| pip install --no-cache-dir --ignore-installed pip pyyaml; \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Pin the TokenSpeed bootstrap dependencies. Line 83 resolves 🤖 Prompt for AI AgentsSource: Linters/SAST tools There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When building on the Debian system-Python TokenSpeed base described here, this first Useful? React with 👍 / 👎. |
||
| pip uninstall -y tokenspeed-smg-grpc-proto tokenspeed-smg-grpc-servicer || true; \ | ||
| fi | ||
|
|
||
| RUN bash /tmp/scripts/install-smg.sh /opt/smg-src | ||
|
|
||
| RUN case "${ENGINE}" in \ | ||
| vllm|sglang|trtllm|tgl) ;; \ | ||
| vllm|sglang|trtllm|tgl|tokenspeed) ;; \ | ||
| *) echo "ERROR: Unknown ENGINE '${ENGINE}'" >&2; exit 1 ;; \ | ||
| esac \ | ||
| && if [ -n "${ENGINE_REPO}" ]; then \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||
| #!/bin/sh | ||||||
| set -e | ||||||
|
|
||||||
| # Install tokenspeed from source. | ||||||
| # Usage: install-tokenspeed.sh [path-to-tokenspeed-src] | ||||||
| # Default path: /tmp/tokenspeed-src | ||||||
| # | ||||||
| # Only used when the engine image is built with ENGINE_REPO set (build the | ||||||
| # engine from source into a runner base). The published lightseekorg/tokenspeed | ||||||
| # images already bake the engine in, so the default release path does not run | ||||||
| # this script. | ||||||
|
|
||||||
| TS_SRC="${1:-/tmp/tokenspeed-src}" | ||||||
| cd "${TS_SRC}/python" | ||||||
| pip install --no-deps --force-reinstall --editable . | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a caller supplies Useful? React with 👍 / 👎. |
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepting
tokenspeedhere lets the new release/nightly callers build images withENGINE=tokenspeed; with nobackendoverride,docker/engine.Dockerfile:53exportsSMG_DEFAULT_BACKEND=tokenspeed, butsmg servestill builds its choices only fromBACKEND_ARG_ADDERS(sglang,vllm,trtllm) inbindings/python/src/smg/serve.py:438-459. As a result the produced TokenSpeed all-in-one image fails argument parsing before it can start a worker, and there is no valid--backend tokenspeedpath; please add a TokenSpeed launcher/parser entry or avoid setting an unsupported default for these images.Useful? React with 👍 / 👎.