Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ rustflags = ["-C", "target-cpu=neoverse-n1", "-C", "force-frame-pointers=yes", "
[env]
PCRE2_SYS_STATIC = "1"

[registries.buf]
index = "sparse+https://buf.build/gen/cargo/"
credential-provider = "cargo:token"
17 changes: 17 additions & 0 deletions .github/actions/compliance-extract/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ inputs:
description: 'SCCACHE region (= aws_default_region the build passed). See sccache_bucket.'
required: false
default: ''
buf_token:
description: 'Buf Schema Registry token for cache-missed Cargo rebuilds.'
required: true
diff_base_sha:
description: |
Commit SHA of the baseline build to diff this build's OSRB CSV against
Expand Down Expand Up @@ -126,6 +129,7 @@ runs:
env:
SCCACHE_BUCKET: ${{ inputs.sccache_bucket }}
SCCACHE_REGION: ${{ inputs.sccache_region }}
BUF_TOKEN: ${{ inputs.buf_token }}
GIT_SHA: ${{ inputs.git_sha }}
EPP_IMAGE: ${{ inputs.epp_image }}
run: |
Expand All @@ -149,6 +153,12 @@ runs:
# Only forward the credentials when S3 sccache is actually configured
# (bucket set) — a bucket-less caller's build has no use for them.
SECRET_ARGS=""
if [ -n "${BUF_TOKEN:-}" ]; then
SECRET_ARGS+=" --secret id=buf_token,env=BUF_TOKEN"
else
echo "::error::BUF_TOKEN is required for Cargo access to the Buf registry"
exit 1
fi
if [ -n "${SCCACHE_BUCKET:-}" ]; then
TOKEN_FILE="${AWS_WEB_IDENTITY_TOKEN_FILE:-}"
if [ -n "$TOKEN_FILE" ] && [ -f "$TOKEN_FILE" ] && [ -n "${AWS_ROLE_ARN:-}" ]; then
Expand Down Expand Up @@ -344,6 +354,7 @@ runs:
env:
SCCACHE_BUCKET: ${{ inputs.sccache_bucket }}
SCCACHE_REGION: ${{ inputs.sccache_region }}
BUF_TOKEN: ${{ inputs.buf_token }}
GIT_SHA: ${{ inputs.git_sha }}
EPP_IMAGE: ${{ inputs.epp_image }}
run: |
Expand All @@ -353,6 +364,12 @@ runs:
# as the compliance_artifact extract above). Same IRSA secrets too, so a
# cache-missed stage rebuild can still authenticate sccache (see above).
SECRET_ARGS=""
if [ -n "${BUF_TOKEN:-}" ]; then
SECRET_ARGS+=" --secret id=buf_token,env=BUF_TOKEN"
else
echo "::error::BUF_TOKEN is required for Cargo access to the Buf registry"
exit 1
fi
if [ -n "${SCCACHE_BUCKET:-}" ]; then
TOKEN_FILE="${AWS_WEB_IDENTITY_TOKEN_FILE:-}"
if [ -n "$TOKEN_FILE" ] && [ -f "$TOKEN_FILE" ] && [ -n "${AWS_ROLE_ARN:-}" ]; then
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/docker-remote-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
sccache_s3_bucket:
description: 'SCCache S3 Bucket'
required: false
buf_token:
description: 'Buf Schema Registry token'
required: true
no_cache:
description: 'Disable Docker build cache'
required: false
Expand Down Expand Up @@ -66,6 +69,7 @@ runs:
env:
AWS_DEFAULT_REGION: ${{ inputs.aws_default_region }}
SCCACHE_S3_BUCKET: ${{ inputs.sccache_s3_bucket }}
BUF_TOKEN: ${{ inputs.buf_token }}
PLATFORM: ${{ inputs.platform }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_JOB: ${{ github.job }}
Expand Down Expand Up @@ -137,6 +141,12 @@ runs:
# AWS_ROLE_ARN. We pass the token file and role ARN to BuildKit so sccache
# can authenticate via STS AssumeRoleWithWebIdentity -- no static keys needed.
SECRET_ARGS=""
if [ -n "${BUF_TOKEN:-}" ]; then
SECRET_ARGS+=" --secret id=buf_token,env=BUF_TOKEN"
else
echo "::error::BUF_TOKEN is required for Cargo access to the Buf registry"
exit 1
fi
if [ "${{ inputs.use_sccache }}" == "true" ]; then
TOKEN_FILE="${AWS_WEB_IDENTITY_TOKEN_FILE:-}"
if [ -n "$TOKEN_FILE" ] && [ -f "$TOKEN_FILE" ] && [ -n "${AWS_ROLE_ARN:-}" ]; then
Expand Down
3 changes: 0 additions & 3 deletions .github/filters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,6 @@ rust:
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'deny.toml'
# Sidecar protobuf contracts are compiled by crate build scripts and need the
# same workspace checks as sidecar Rust sources.
- 'lib/sidecar/**/*.proto'

benchmarks:
- 'benchmarks/**'
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/test-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ const testCases = [
desc: 'vllm component triggers only vllm'
},

// Sidecar Rust and proto files should trigger Rust checks without unrelated E2E
// Sidecar Rust files should trigger Rust checks without unrelated E2E
{
file: 'lib/sidecar/common/src/lib.rs',
expect: { sidecar: true, rust: true, core: false, frontend: false, vllm: false, sglang: false, trtllm: false },
desc: 'common sidecar source avoids unrelated build and E2E filters'
},
{
file: 'lib/sidecar/vllm/proto/vllm_grpc.proto',
file: 'lib/sidecar/vllm/build.rs',
expect: { sidecar: true, rust: true, core: false, frontend: false, vllm: false, sglang: false, trtllm: false },
desc: 'vllm sidecar proto triggers Rust checks without backend E2E'
desc: 'vllm sidecar build script triggers Rust checks without backend E2E'
},
{
file: 'lib/sidecar/sglang/src/lib.rs',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copyright-check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ $global:copyright_results = @{

$ignored_files = @('.clang-format', '.gitattributes', '.gitignore', '.gitkeep', '.patch', 'Cargo.lock', 'LICENSE', 'uv.lock', 'rust-toolchain.toml', 'codespell.txt', 'exclusions.txt')
write-debug "<copyright-check> ignored_files = ['$($ignored_files -join "','")']."
$ignored_paths = @('.github', '.mypy_cache', '.pytest_cache', 'lib/llm/tests/data/sample-models', 'lib/llm/tests/data/deepseek-v3.2', 'lib/llm/tests/data/deepseek-v4', 'container/compliance/spdx_licenses', 'lib/sidecar/vllm/proto/control.proto', 'lib/sidecar/vllm/proto/inference.proto')
$ignored_paths = @('.github', '.mypy_cache', '.pytest_cache', 'lib/llm/tests/data/sample-models', 'lib/llm/tests/data/deepseek-v3.2', 'lib/llm/tests/data/deepseek-v4', 'container/compliance/spdx_licenses')
write-debug "<copyright-check> ignored_paths = ['$($ignored_paths -join "','")']."
$ignored_types = @('.bat', '.gif', '.ico', '.ipynb', '.jpg', '.jpeg', '.patch', '.png', '.pyc', '.pyi', '.rst', '.zip', '.md', '.json')
write-debug "<copyright-check> ignored_types = ['$($ignored_types -join "', '")']."
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dynamo-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ on:
required: false
HF_TOKEN:
required: false
BUF_TOKEN:
required: true


jobs:
Expand Down Expand Up @@ -113,6 +115,7 @@ jobs:
# "Permission denied (os error 13)" while downloading crates. Redirect
# CARGO_HOME to the runner-writable workspace so cargo owns its cache.
CARGO_HOME: /__w/dynamo/dynamo/.cargo
CARGO_REGISTRIES_BUF_TOKEN: "Bearer ${{ secrets.BUF_TOKEN }}"
CONTAINER_ID: test_${{ github.run_id }}_${{ github.run_attempt }}_rust_dynamo
timeout-minutes: 30
steps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,8 @@ jobs:
dir: ['.', 'lib/bindings/python', 'lib/bindings/kvbm']
permissions:
contents: read
env:
CARGO_REGISTRIES_BUF_TOKEN: "Bearer ${{ secrets.BUF_TOKEN }}"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ jobs:
matrix: { dir: ['.', 'lib/bindings/python', 'lib/runtime/examples', 'lib/bindings/kvbm'] }
permissions:
contents: read
env:
CARGO_REGISTRIES_BUF_TOKEN: "Bearer ${{ secrets.BUF_TOKEN }}"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down Expand Up @@ -341,6 +343,8 @@ jobs:
matrix: { dir: ['.', 'lib/bindings/python', 'lib/runtime/examples', 'lib/bindings/kvbm'] }
permissions:
contents: read
env:
CARGO_REGISTRIES_BUF_TOKEN: "Bearer ${{ secrets.BUF_TOKEN }}"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/shared-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ on:
required: false
HF_TOKEN:
required: false
BUF_TOKEN:
required: true
outputs:
target_tag_plain:
description: 'Plain runtime image tag prefix'
Expand Down Expand Up @@ -370,6 +372,7 @@ jobs:
IMAGE_REPOSITORY: ${{ vars.ECR_REPOSITORY }}
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
SCCACHE_S3_BUCKET: ${{ secrets.SCCACHE_S3_BUCKET }}
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
timeout-minutes: 60
run: |
set -x
Expand Down Expand Up @@ -500,6 +503,7 @@ jobs:
cuda_version: ${{ matrix.cuda_version }}
aws_default_region: ${{ vars.AWS_DEFAULT_REGION }}
sccache_s3_bucket: ${{ secrets.SCCACHE_S3_BUCKET }}
buf_token: ${{ secrets.BUF_TOKEN }}
no_cache: ${{ inputs.no_cache }}
extra_tags: ${{ steps.extra-tags.outputs.tags }}
push_image: ${{ inputs.push_image }}
Expand Down Expand Up @@ -606,6 +610,7 @@ jobs:
# wheel_builder/pre_runtime cache instead of a cold rebuild.
sccache_bucket: ${{ secrets.SCCACHE_S3_BUCKET }}
sccache_region: ${{ vars.AWS_DEFAULT_REGION }}
buf_token: ${{ secrets.BUF_TOKEN }}
# Must match the build's render: EFA images attribute libfabric /
# aws-ofi-nccl via --make-efa, and a mismatch would cold-miss the cache.
make_efa: ${{ inputs.make_efa }}
Expand Down
54 changes: 45 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ sudo apt install -y build-essential libhwloc-dev libudev-dev pkg-config libclang
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && source $HOME/.cargo/env

# Authenticate Cargo to the Buf Schema Registry
export BUF_TOKEN="your-buf-token"
cargo login --registry buf "Bearer ${BUF_TOKEN}"

# Create venv and build
uv venv dynamo && source dynamo/bin/activate
uv pip install pip 'maturin[patchelf]'
Expand Down
12 changes: 9 additions & 3 deletions container/templates/wheel_builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,13 @@ ARG USE_SCCACHE
{% if framework != "sglang" %}
ARG ENABLE_MEDIA_FFMPEG
{% endif %}
RUN --mount=type=secret,id=aws-web-identity-token,target=/run/secrets/aws-token \
RUN --mount=type=secret,id=buf_token,required=true \
--mount=type=secret,id=aws-web-identity-token,target=/run/secrets/aws-token \
--mount=type=secret,id=aws-role-arn,env=AWS_ROLE_ARN \
--mount=type=cache,target=/root/.cargo/registry,sharing=shared \
--mount=type=cache,target=/root/.cargo/git,sharing=shared \
--mount=type=cache,id=uv-root-{{ context.dynamo.uv_version }},target=/root/.cache/uv,sharing=shared \
export CARGO_REGISTRIES_BUF_TOKEN="Bearer $(cat /run/secrets/buf_token)" && \
export AWS_WEB_IDENTITY_TOKEN_FILE=/run/secrets/aws-token && \
export UV_CACHE_DIR=/root/.cache/uv && \
export SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX:-${TARGETARCH}} && \
Expand Down Expand Up @@ -655,8 +657,10 @@ ARG ENABLE_SOURCE_ARCHIVAL=false
# Mount cargo registry + git caches so re-runs don't re-download the
# ~750 crates from crates.io every build. `sharing=shared` lets parallel
# builds (e.g. multiple frameworks in CI) read the same cache concurrently.
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=shared \
RUN --mount=type=secret,id=buf_token,required=true \
--mount=type=cache,target=/root/.cargo/registry,sharing=shared \
--mount=type=cache,target=/root/.cargo/git,sharing=shared \
export CARGO_REGISTRIES_BUF_TOKEN="Bearer $(cat /run/secrets/buf_token)" && \
if [ "$ENABLE_SOURCE_ARCHIVAL" = "true" ]; then \
mkdir -p /tmp/dynamo-vendor-full && \
cd /opt/dynamo && \
Expand Down Expand Up @@ -796,11 +800,13 @@ COPY components/ /opt/dynamo/components/

# Build kvbm wheel (with nixl linkage via auditwheel repair)
ARG ENABLE_KVBM
RUN --mount=type=secret,id=aws-web-identity-token,target=/run/secrets/aws-token \
RUN --mount=type=secret,id=buf_token,required=true \
--mount=type=secret,id=aws-web-identity-token,target=/run/secrets/aws-token \
--mount=type=secret,id=aws-role-arn,env=AWS_ROLE_ARN \
--mount=type=cache,target=/root/.cargo/registry,sharing=shared \
--mount=type=cache,target=/root/.cargo/git,sharing=shared \
--mount=type=cache,id=uv-root-{{ context.dynamo.uv_version }},target=/root/.cache/uv,sharing=shared \
export CARGO_REGISTRIES_BUF_TOKEN="Bearer $(cat /run/secrets/buf_token)" && \
export AWS_WEB_IDENTITY_TOKEN_FILE=/run/secrets/aws-token && \
export UV_CACHE_DIR=/root/.cache/uv && \
export SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX:-${TARGETARCH}} && \
Expand Down
4 changes: 3 additions & 1 deletion deploy/inference-gateway/epp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ COPY --from=dynamo deploy/inference-gateway/ext-proc/ deploy/inference-gateway/e
# git caches are content-addressed (safe to persist); no target/ mount --
# sccache caches compilations in S3 where stale artifacts can't be linked
# against newer source.
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry-${TARGETARCH},sharing=shared \
RUN --mount=type=secret,id=buf_token,required=true \
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry-${TARGETARCH},sharing=shared \
--mount=type=cache,target=/usr/local/cargo/git,id=cargo-git-${TARGETARCH},sharing=shared \
--mount=type=secret,id=aws-web-identity-token,target=/run/secrets/aws-token \
--mount=type=secret,id=aws-role-arn,env=AWS_ROLE_ARN \
export CARGO_REGISTRIES_BUF_TOKEN="Bearer $(cat /run/secrets/buf_token)" && \
export AWS_WEB_IDENTITY_TOKEN_FILE=/run/secrets/aws-token && \
export SCCACHE_S3_KEY_PREFIX="${SCCACHE_S3_KEY_PREFIX:-epp-${TARGETARCH}}" && \
if [ "$USE_SCCACHE" = "true" ]; then \
Expand Down
Loading
Loading