Files
sgl-project--sglang/scripts/ci/utils/docker_build_metadata_args.py
wehub-resource-sync 94057c3d3e
PR Test (NPU) / check-changes (push) Has been cancelled
PR Test (NPU) / pr-gate (push) Has been cancelled
PR Test (NPU) / set-image-config (push) Has been cancelled
PR Test (NPU) / stage-b-test-1-npu-a2 (0) (push) Has been cancelled
PR Test (NPU) / stage-b-test-1-npu-a2 (1) (push) Has been cancelled
PR Test (NPU) / stage-b-test-2-npu-a2 (0) (push) Has been cancelled
PR Test (NPU) / stage-b-test-2-npu-a2 (1) (push) Has been cancelled
PR Test (NPU) / stage-b-test-4-npu-a3 (push) Has been cancelled
PR Test (NPU) / stage-b-test-16-npu-a3 (push) Has been cancelled
PR Test (NPU) / multimodal-gen-test-1-npu-a3 (push) Has been cancelled
PR Test (NPU) / multimodal-gen-test-2-npu-a3 (push) Has been cancelled
PR Test (Arm64) / pr-gate (push) Has been cancelled
PR Test (Arm64) / check-changes (push) Has been cancelled
PR Test (Arm64) / build-test (push) Has been cancelled
PR Test (sgl-router) / gate (push) Has been cancelled
PR Test (sgl-router) / tier-1 — lint (push) Has been cancelled
PR Test (sgl-router) / tier-2 — build + test (push) Has been cancelled
PR Test (sgl-router) / tier-3 — docker (placeholder) (push) Has been cancelled
PR Test (sgl-router) / tier-3 — k8s integration (push) Has been cancelled
PR Test (sgl-router) / tier-3 — e2e (push) Has been cancelled
PR Test (sgl-router) / finish (push) Has been cancelled
PR Test (NPU) / single-node-poc (map[name:qwen3_6_27b_w8a8_1p_in64k_out1k_50ms runner:linux-aarch64-a3-2 test_case:test/registered/ascend/performance/qwen3_6_27b/test_npu_qwen3_6_27b_w8a8_1p_in64k_out1k_50ms.py test_type:perf]) (push) Has been cancelled
PR Test (NPU) / pr-test-npu-finish (push) Has been cancelled
PR Test (Xeon) / pr-gate (push) Has been cancelled
PR Test (Xeon) / check-changes (push) Has been cancelled
PR Test (Xeon) / build-test (, xeon-gnr, base-b-test-cpu) (push) Has been cancelled
PR Test (XPU) / check-changes (push) Has been cancelled
PR Test (XPU) / pr-gate (push) Has been cancelled
PR Test (XPU) / stage-a-test-1-gpu-xpu (push) Has been cancelled
PR Test (XPU) / wait-for-stage-a (push) Has been cancelled
PR Test (XPU) / stage-b-test-1-gpu-xpu (push) Has been cancelled
PR Test (XPU) / finish (push) Has been cancelled
CI Model Inventory / build-inventory (push) Has been cancelled
Lint / lint (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark Compilation Check (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark - Manual Policy (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark - Request Processing (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark Summary (push) Has been cancelled
PR Test (SMG) / build-wheel (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on windows (x86_64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on macos (x86_64 - auto) (push) Has been cancelled
PR Test (SMG) / python-unit-tests (push) Has been cancelled
PR Test (SMG) / unit-tests (push) Has been cancelled
PR Test (SMG) / benchmarks (push) Has been cancelled
PR Test (SMG) / chat-completions (push) Has been cancelled
PR Test (SMG) / chat-completions-4gpu (push) Has been cancelled
PR Test (SMG) / e2e (push) Has been cancelled
PR Test (SMG) / docker-build-test (push) Has been cancelled
PR Test (SMG) / k8s-integration (push) Has been cancelled
PR Test (SMG) / finish (push) Has been cancelled
PR Test (SMG) / summarize-benchmarks (push) Has been cancelled
Release SGLang Model Gateway Docker Image / publish (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on macos (aarch64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (aarch64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (x86_64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (aarch64 - musllinux_1_1) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (x86_64 - musllinux_1_1) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / Build SDist (push) Has been cancelled
Release SGLang Model Gateway to PyPI / Upload to PyPI (push) Has been cancelled
Release SGLang Kernels / build-cu129-matrix (aarch64, 12.9, 3.10, arm-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / build-cu129-matrix (x86_64, 12.9, 3.10, x64-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / release-cu129 (push) Has been cancelled
Release SGLang Kernels / build-cu130-matrix (aarch64, 13.0, 3.10, arm-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / build-cu130-matrix (x86_64, 13.0, 3.10, x64-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / release-cu130 (push) Has been cancelled
Release SGLang Kernels / build-rocm-matrix (3.10, 700) (push) Has been cancelled
Release SGLang Kernels / build-rocm-matrix (3.10, 720) (push) Has been cancelled
Release SGLang Kernels / release-rocm700 (push) Has been cancelled
Release SGLang Kernels / release-rocm720 (push) Has been cancelled
Release SGLang Kernels / build-musa43 (43, 3.10) (push) Has been cancelled
Release SGLang Kernels / release-musa43 (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:16 +08:00

120 lines
3.3 KiB
Python

import argparse
import datetime
import json
import sys
MOVING_TAGS = {"dev", "dev-cu12", "dev-cu13", "latest"}
def render_tag_template(tag: str, version: str, date: str, short_sha: str) -> str:
return (
tag.replace("{version}", version)
.replace("{date}", date)
.replace("{short_sha}", short_sha)
)
def is_moving_tag(tag: str) -> bool:
return tag in MOVING_TAGS or tag.startswith("latest-")
def select_tag(
tag_config: str, cuda: str, version: str, date: str, short_sha: str
) -> str:
entries = json.loads(tag_config)
for entry in entries:
if entry.get("cuda") != cuda:
continue
tags = [
render_tag_template(tag, version, date, short_sha)
for tag in entry.get("tags", [])
]
if not tags:
raise ValueError(f"No tags configured for CUDA variant {cuda}")
for tag in tags:
if not is_moving_tag(tag):
return tag
return tags[0]
raise ValueError(f"CUDA variant {cuda} not found in tag_config")
def build_arg_tokens(
*,
cuda: str,
tag_config: str,
image_repo: str,
version: str,
build_commit: str,
build_url: str,
date: str,
short_sha: str,
) -> list[str]:
image_tag = select_tag(tag_config, cuda, version, date, short_sha)
build_args = {
"SGLANG_BUILD_COMMIT": build_commit,
"SGLANG_BUILD_URL": build_url,
"SGLANG_IMAGE_TAG": f"{image_repo}:{image_tag}",
}
tokens = []
for key, value in build_args.items():
tokens.extend(["--build-arg", f"{key}={value}"])
return tokens
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Emit docker build arguments for SGLang image metadata."
)
parser.add_argument("--cuda", required=True, help="CUDA variant from tag_config.")
parser.add_argument("--tag-config", required=True, help="Docker tag JSON config.")
parser.add_argument("--image-repo", required=True, help="Docker image repository.")
parser.add_argument("--sgl-version", default="", help="SGLang release version.")
parser.add_argument(
"--build-commit",
required=True,
help="Commit checked out for the Docker build.",
)
parser.add_argument("--build-url", default="", help="CI run URL.")
parser.add_argument(
"--date",
default=datetime.datetime.now(datetime.timezone.utc).strftime("%Y%m%d"),
help="Date used for {date} tag templates.",
)
parser.add_argument(
"--short-sha",
default="",
help="Short SHA used for {short_sha}; defaults to build commit prefix.",
)
return parser.parse_args()
def main() -> int:
args = parse_args()
short_sha = args.short_sha or args.build_commit[:8]
try:
tokens = build_arg_tokens(
cuda=args.cuda,
tag_config=args.tag_config,
image_repo=args.image_repo,
version=args.sgl_version,
build_commit=args.build_commit,
build_url=args.build_url,
date=args.date,
short_sha=short_sha,
)
except (json.JSONDecodeError, ValueError) as exc:
print(f"error: {exc}", file=sys.stderr)
return 1
print("\n".join(tokens))
return 0
if __name__ == "__main__":
sys.exit(main())