Skip to content

Commit c91217c

Browse files
csahithisimon-mo
authored andcommitted
[CI] Add nightly multiarch manifests to dockerhub (vllm-project#24102)
Signed-off-by: Sahithi Chigurupati <[email protected]> Signed-off-by: Simon Mo <[email protected]> Signed-off-by: simon-mo <[email protected]> Co-authored-by: Simon Mo <[email protected]>
1 parent 33b312c commit c91217c

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

.buildkite/release-pipeline.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,25 @@ steps:
149149
- "docker push public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo:$(buildkite-agent meta-data get release-version)"
150150
env:
151151
DOCKER_BUILDKIT: "1"
152+
153+
- label: "Build and publish nightly multi-arch image to DockerHub"
154+
depends_on:
155+
- create-multi-arch-manifest
156+
if: build.env("NIGHTLY") == "1"
157+
agents:
158+
queue: cpu_queue_postmerge
159+
commands:
160+
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
161+
- "docker pull public.ecr.aws/q9t5s3a7/vllm-release-repo:$BUILDKITE_COMMIT"
162+
- "docker tag public.ecr.aws/q9t5s3a7/vllm-release-repo:$BUILDKITE_COMMIT vllm/vllm-openai:nightly"
163+
- "docker tag public.ecr.aws/q9t5s3a7/vllm-release-repo:$BUILDKITE_COMMIT vllm/vllm-openai:nightly-$BUILDKITE_COMMIT"
164+
- "docker push vllm/vllm-openai:nightly"
165+
- "docker push vllm/vllm-openai:nightly-$BUILDKITE_COMMIT"
166+
# Clean up old nightly builds (keep only last 14)
167+
- "bash .buildkite/scripts/cleanup-nightly-builds.sh"
168+
plugins:
169+
- docker-login#v3.0.0:
170+
username: vllmbot
171+
password-env: DOCKERHUB_TOKEN
172+
env:
173+
DOCKER_BUILDKIT: "1"
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Clean up old nightly builds from DockerHub, keeping only the last 14 builds
6+
# This script uses DockerHub API to list and delete old tags with "nightly-" prefix
7+
8+
# DockerHub API endpoint for vllm/vllm-openai repository
9+
REPO_API_URL="https://hub.docker.com/v2/repositories/vllm/vllm-openai/tags"
10+
11+
# Get DockerHub token from environment
12+
if [ -z "$DOCKERHUB_TOKEN" ]; then
13+
echo "Error: DOCKERHUB_TOKEN environment variable is not set"
14+
exit 1
15+
fi
16+
17+
# Function to get all tags from DockerHub
18+
get_all_tags() {
19+
local page=1
20+
local all_tags=""
21+
22+
while true; do
23+
local response=$(curl -s -H "Authorization: Bearer $DOCKERHUB_TOKEN" \
24+
"$REPO_API_URL?page=$page&page_size=100")
25+
26+
# Get both last_updated timestamp and tag name, separated by |
27+
local tags=$(echo "$response" | jq -r '.results[] | select(.name | startswith("nightly-")) | "\(.last_updated)|\(.name)"')
28+
29+
if [ -z "$tags" ]; then
30+
break
31+
fi
32+
33+
all_tags="$all_tags$tags"$'\n'
34+
page=$((page + 1))
35+
done
36+
37+
# Sort by timestamp (newest first) and extract just the tag names
38+
echo "$all_tags" | sort -r | cut -d'|' -f2
39+
}
40+
41+
delete_tag() {
42+
local tag_name="$1"
43+
echo "Deleting tag: $tag_name"
44+
45+
local delete_url="https://hub.docker.com/v2/repositories/vllm/vllm-openai/tags/$tag_name"
46+
local response=$(curl -s -X DELETE -H "Authorization: Bearer $DOCKERHUB_TOKEN" "$delete_url")
47+
48+
if echo "$response" | jq -e '.detail' > /dev/null 2>&1; then
49+
echo "Warning: Failed to delete tag $tag_name: $(echo "$response" | jq -r '.detail')"
50+
else
51+
echo "Successfully deleted tag: $tag_name"
52+
fi
53+
}
54+
55+
# Get all nightly- prefixed tags, sorted by last_updated timestamp (newest first)
56+
echo "Fetching all tags from DockerHub..."
57+
all_tags=$(get_all_tags)
58+
59+
if [ -z "$all_tags" ]; then
60+
echo "No tags found to clean up"
61+
exit 0
62+
fi
63+
64+
# Count total tags
65+
total_tags=$(echo "$all_tags" | wc -l)
66+
echo "Found $total_tags tags"
67+
68+
# Keep only the last 14 builds (including the current one)
69+
tags_to_keep=14
70+
tags_to_delete=$((total_tags - tags_to_keep))
71+
72+
if [ $tags_to_delete -le 0 ]; then
73+
echo "No tags need to be deleted (only $total_tags tags found, keeping $tags_to_keep)"
74+
exit 0
75+
fi
76+
77+
echo "Will delete $tags_to_delete old tags, keeping the newest $tags_to_keep"
78+
79+
# Get tags to delete (skip the first $tags_to_keep tags)
80+
tags_to_delete_list=$(echo "$all_tags" | tail -n +$((tags_to_keep + 1)))
81+
82+
if [ -z "$tags_to_delete_list" ]; then
83+
echo "No tags to delete"
84+
exit 0
85+
fi
86+
87+
# Delete old tags
88+
echo "Deleting old tags..."
89+
while IFS= read -r tag; do
90+
if [ -n "$tag" ]; then
91+
delete_tag "$tag"
92+
# Add a small delay to avoid rate limiting
93+
sleep 1
94+
fi
95+
done <<< "$tags_to_delete_list"
96+
97+
echo "Cleanup completed successfully"

0 commit comments

Comments
 (0)