From d56fd10cb6eb36bb3b5f9206628746cf64e1f544 Mon Sep 17 00:00:00 2001 From: Bingxu Chen Date: Mon, 5 Jan 2026 19:22:39 +0800 Subject: [PATCH] [AMD CI] fix sglang version detection in daily docker image release and init container (#16367) https://github.com/sgl-project/sglang/actions/runs/20711245259/job/59453869006?pr=16367 to be fixed in https://github.com/sgl-project/sglang/pull/15663 --- .../workflows/release-docker-amd-nightly.yml | 36 +++++++++++++++++-- scripts/ci/amd_ci_start_container.sh | 27 ++++++-------- 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-docker-amd-nightly.yml b/.github/workflows/release-docker-amd-nightly.yml index 47508ac2e..affbacf0e 100644 --- a/.github/workflows/release-docker-amd-nightly.yml +++ b/.github/workflows/release-docker-amd-nightly.yml @@ -25,11 +25,27 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for git describe to find tags - name: "Set Date" run: | echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV + - name: Get version from latest tag + id: version + run: | + # Get the latest version tag sorted by version number (e.g., v0.5.7 -> 0.5.7) + VERSION=$(git tag -l 'v[0-9]*' --sort=-v:refname | head -1 | sed 's/^v//') + + if [ -z "$VERSION" ]; then + echo "::error::Could not determine version from git tags" + exit 1 + fi + + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "Detected version: ${VERSION}" + - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -38,7 +54,7 @@ jobs: - name: Build and Push run: | - version=$(cat python/sglang/version.py | cut -d'"' -f2) + version=${{ steps.version.outputs.version }} echo "Version: ${version}" if [ "${{ matrix.gpu_arch }}" = "gfx942" ]; then @@ -70,11 +86,27 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for git describe to find tags - name: "Set Date" run: | echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV + - name: Get version from latest tag + id: version + run: | + # Get the latest version tag sorted by version number (e.g., v0.5.7 -> 0.5.7) + VERSION=$(git tag -l 'v[0-9]*' --sort=-v:refname | head -1 | sed 's/^v//') + + if [ -z "$VERSION" ]; then + echo "::error::Could not determine version from git tags" + exit 1 + fi + + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "Detected version: ${VERSION}" + - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -85,7 +117,7 @@ jobs: run: | set -euxo pipefail - version=$(cat python/sglang/version.py | cut -d'"' -f2) + version=${{ steps.version.outputs.version }} echo "Version: ${version}" if [ "${{ matrix.gpu_arch }}" = "gfx942" ]; then diff --git a/scripts/ci/amd_ci_start_container.sh b/scripts/ci/amd_ci_start_container.sh index 698707e07..e0db63773 100755 --- a/scripts/ci/amd_ci_start_container.sh +++ b/scripts/ci/amd_ci_start_container.sh @@ -1,27 +1,22 @@ #!/bin/bash set -euo pipefail -# Get version from SGLang version.py file -SGLANG_VERSION_FILE="$(dirname "$0")/../../python/sglang/version.py" -SGLANG_VERSION="v0.5.5" # Default version, will be overridden if version.py is found +# Get version from git tags +SGLANG_VERSION="v0.5.5" # Default version, will be overridden if git tags are found -TMP_VERSION_FILE=$(mktemp) -if git fetch --depth=1 origin main; then - if git show origin/main:python/sglang/version.py >"$TMP_VERSION_FILE" 2>/dev/null; then - VERSION_FROM_FILE="v$(cat "$SGLANG_VERSION_FILE" | cut -d'"' -f2)" - if [ -n "$VERSION_FROM_FILE" ]; then - SGLANG_VERSION="$VERSION_FROM_FILE" - echo "Using SGLang version from origin/main: $SGLANG_VERSION" - else - echo "Warning: Could not parse version from origin/main; using default $SGLANG_VERSION" >&2 - fi +# Fetch tags from origin to ensure we have the latest +if git fetch --tags origin; then + # Get the latest version tag sorted by version number (e.g., v0.5.7) + VERSION_FROM_TAG=$(git tag -l 'v[0-9]*' --sort=-v:refname | head -1) + if [ -n "$VERSION_FROM_TAG" ]; then + SGLANG_VERSION="$VERSION_FROM_TAG" + echo "Using SGLang version from git tags: $SGLANG_VERSION" else - echo "Warning: version.py not found on origin/main; using default $SGLANG_VERSION" >&2 + echo "Warning: No version tags found; using default $SGLANG_VERSION" >&2 fi else - echo "Warning: failed to fetch origin/main; using default $SGLANG_VERSION" >&2 + echo "Warning: Failed to fetch tags from origin; using default $SGLANG_VERSION" >&2 fi -rm -f "$TMP_VERSION_FILE" # Default base tags (can be overridden by command line arguments)