@@ -8,20 +8,41 @@ set -ex
8
8
# DockerHub API endpoint for vllm/vllm-openai repository
9
9
REPO_API_URL=" https://hub.docker.com/v2/repositories/vllm/vllm-openai/tags"
10
10
11
- # Get DockerHub token from environment
11
+ # Get DockerHub credentials from environment
12
12
if [ -z " $DOCKERHUB_TOKEN " ]; then
13
13
echo " Error: DOCKERHUB_TOKEN environment variable is not set"
14
14
exit 1
15
15
fi
16
16
17
+ if [ -z " $DOCKERHUB_USERNAME " ]; then
18
+ echo " Error: DOCKERHUB_USERNAME environment variable is not set"
19
+ exit 1
20
+ fi
21
+
22
+ # Get DockerHub bearer token
23
+ echo " Getting DockerHub bearer token..."
24
+ set +x
25
+ BEARER_TOKEN=$( curl -s -X POST \
26
+ -H " Content-Type: application/json" \
27
+ -d " {\" username\" : \" $DOCKERHUB_USERNAME \" , \" password\" : \" $DOCKERHUB_TOKEN \" }" \
28
+ " https://hub.docker.com/v2/users/login" | jq -r ' .token' )
29
+ set -x
30
+
31
+ if [ -z " $BEARER_TOKEN " ] || [ " $BEARER_TOKEN " = " null" ]; then
32
+ echo " Error: Failed to get DockerHub bearer token"
33
+ exit 1
34
+ fi
35
+
17
36
# Function to get all tags from DockerHub
18
37
get_all_tags () {
19
38
local page=1
20
39
local all_tags=" "
21
40
22
41
while true ; do
23
- local response=$( curl -s -H " Authorization: Bearer $DOCKERHUB_TOKEN " \
42
+ set +x
43
+ local response=$( curl -s -H " Authorization: Bearer $BEARER_TOKEN " \
24
44
" $REPO_API_URL ?page=$page &page_size=100" )
45
+ set -x
25
46
26
47
# Get both last_updated timestamp and tag name, separated by |
27
48
local tags=$( echo " $response " | jq -r ' .results[] | select(.name | startswith("nightly-")) | "\(.last_updated)|\(.name)"' )
@@ -43,7 +64,9 @@ delete_tag() {
43
64
echo " Deleting tag: $tag_name "
44
65
45
66
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 " )
67
+ set +x
68
+ local response=$( curl -s -X DELETE -H " Authorization: Bearer $BEARER_TOKEN " " $delete_url " )
69
+ set -x
47
70
48
71
if echo " $response " | jq -e ' .detail' > /dev/null 2>&1 ; then
49
72
echo " Warning: Failed to delete tag $tag_name : $( echo " $response " | jq -r ' .detail' ) "
0 commit comments