Skip to content

Commit 3b9d93b

Browse files
authored
ci: propagate HF_TOKEN to e2e tests to avoid HF Hub rate limits (#1572)
GitHub Actions runners share public IPs that frequently hit the HF Hub anonymous API quota, causing 429 errors during vllm-render model downloads. This accounts for a large fraction of e2e flakes. Propagate HF_TOKEN from a repo secret into the e2e builder container so the vllm-render sidecar and the model-existence check authenticate against HF Hub. Authenticated requests have a substantially higher rate limit than anonymous ones. Changes: - Add HF_TOKEN to the Makefile E2E_ENV_VARS forwarding list - Read HF_TOKEN from the environment in setup_test.go instead of hardcoding an empty string - Attach a Bearer token header to the isModelReal HF API call in utils_test.go - Pass secrets.HF_TOKEN in both e2e-gaie and e2e-router CI steps The secret must be created as a GitHub repo secret. If the secret is not set, behavior is unchanged (empty token, anonymous requests). Closes #1527 Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
1 parent f61ab91 commit 3b9d93b

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/ci-pr-checks.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ jobs:
363363
E2E_LABEL_FILTER: ${{ matrix.suite.label-filter }}
364364
PULL_SIDECAR_IMAGE: "false"
365365
PULL_VLLM_RENDER_IMAGE: "false"
366+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
366367
run: make test-e2e-gaie-run
367368

368369
e2e-router:
@@ -450,4 +451,5 @@ jobs:
450451
E2E_LABEL_FILTER: ${{ matrix.suite.label-filter }}
451452
LOAD_VLLM_RENDER_IMAGE: ${{ matrix.suite.needs-renderer }}
452453
PULL_VLLM_RENDER_IMAGE: "false"
454+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
453455
run: make test-e2e-router-run

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ endif
122122
# Should we pass ALL env vars here?
123123
E2E_ENV_VARS = EPP_IMAGE VLLM_IMAGE SIDECAR_IMAGE VLLM_RENDER_IMAGE \
124124
E2E_KEEP_CLUSTER_ON_FAILURE E2E_PORT E2E_METRICS_PORT K8S_CONTEXT READY_TIMEOUT \
125-
E2E_LABEL_FILTER LOAD_VLLM_RENDER_IMAGE
125+
E2E_LABEL_FILTER LOAD_VLLM_RENDER_IMAGE HF_TOKEN
126126
BUILDER_E2E_ENV_FLAGS = $(foreach v,$(E2E_ENV_VARS),$(if $($(v)),-e '$(v)=$($(v))'))
127127
ifneq ($(filter command line environment,$(origin NAMESPACE)),)
128128
BUILDER_E2E_ENV_FLAGS += -e NAMESPACE=$(NAMESPACE)

test/e2e/setup_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"io"
66
"net/http"
7+
"os"
78
"strconv"
89
"time"
910

@@ -31,7 +32,7 @@ func createModelServersFromKustomize(kustomizeDir string, extra map[string]strin
3132
"${DECODE_ROLE}": "",
3233
"${EPP_NAME}": "e2e-epp",
3334
"${NAMESPACE}": nsName,
34-
"${HF_TOKEN}": "",
35+
"${HF_TOKEN}": os.Getenv("HF_TOKEN"),
3536
"${VLLM_EXTRA_ARGS_E}": "",
3637
"${VLLM_EXTRA_ARGS_P}": "",
3738
"${VLLM_EXTRA_ARGS_D}": "",

test/e2e/utils_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"io"
88
"net/http"
9+
"os"
910
"os/exec"
1011
"strconv"
1112
"strings"
@@ -193,9 +194,15 @@ func removeEmptyLabels(inputs []string) []string {
193194
}
194195

195196
func isModelReal(modelName string) bool {
196-
url := "https://huggingface.co/api/models/" + modelName
197+
req, err := http.NewRequest("GET", "https://huggingface.co/api/models/"+modelName, nil)
198+
if err != nil {
199+
return false
200+
}
201+
if token := os.Getenv("HF_TOKEN"); token != "" {
202+
req.Header.Set("Authorization", "Bearer "+token)
203+
}
197204

198-
resp, err := http.Get(url)
205+
resp, err := http.DefaultClient.Do(req)
199206
if err != nil {
200207
return false
201208
}

0 commit comments

Comments
 (0)