[CI] Add nightly builds to dockerhub (#9804)
Signed-off-by: Sahithi Chigurupati <chigurupati.sahithi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0a304870e8
commit
9fcf73069f
29
.github/workflows/release-docker-dev.yml
vendored
29
.github/workflows/release-docker-dev.yml
vendored
@@ -72,5 +72,34 @@ jobs:
|
||||
- run: |
|
||||
docker buildx imagetools create \
|
||||
-t lmsysorg/sglang:${{ matrix.variant.tag }} \
|
||||
-t lmsysorg/sglang:nightly-${{ matrix.variant.tag }}-${{ github.sha }} \
|
||||
lmsysorg/sglang:${{ matrix.variant.x86_tag }} \
|
||||
lmsysorg/sglang:${{ matrix.variant.arm64_tag }}
|
||||
- name: Cleanup Old Nightly Builds
|
||||
run: |
|
||||
# Get JWT token for Docker Hub API
|
||||
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "${{ secrets.DOCKERHUB_USERNAME }}", "password": "${{ secrets.DOCKERHUB_TOKEN }}"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
|
||||
|
||||
# Get all tags for the repository
|
||||
TAGS_RESPONSE=$(curl -s -H "Authorization: JWT $TOKEN" "https://hub.docker.com/v2/repositories/lmsysorg/sglang/tags/?page_size=100")
|
||||
|
||||
# Extract tags that match our pattern and sort by last_updated timestamp (most recent first)
|
||||
TAGS=$(echo "$TAGS_RESPONSE" | jq -r '.results[] | select(.name | startswith("nightly-${{ matrix.variant.tag }}-")) | "\(.last_updated)|\(.name)"' | sort -r | cut -d'|' -f2)
|
||||
|
||||
# Count total tags and keep only the 14 most recent
|
||||
TAG_COUNT=$(echo "$TAGS" | wc -l)
|
||||
if [ "$TAG_COUNT" -gt 14 ]; then
|
||||
echo "Found $TAG_COUNT nightly builds, keeping only the 14 most recent"
|
||||
TAGS_TO_DELETE=$(echo "$TAGS" | tail -n +15)
|
||||
echo "Tags to delete: $TAGS_TO_DELETE"
|
||||
|
||||
# Delete old tags
|
||||
for tag in $TAGS_TO_DELETE; do
|
||||
echo "Deleting tag: $tag"
|
||||
curl -X DELETE \
|
||||
-H "Authorization: JWT $TOKEN" \
|
||||
"https://hub.docker.com/v2/repositories/lmsysorg/sglang/tags/$tag/"
|
||||
done
|
||||
else
|
||||
echo "Only $TAG_COUNT nightly builds found, no cleanup needed"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user