Skip to content

Commit 436284d

Browse files
committed
Ignore partial GitHub env in pinned smoke auth fallback
1 parent cb188b3 commit 436284d

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/live_k8s_smoke.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,20 @@ def ensure_namespace(kubectl_bin: Path) -> None:
9292

9393

9494
def ghcr_credentials() -> tuple[str, str] | None:
95-
username = os.environ.get("MB3R_GHCR_USERNAME") or os.environ.get("GITHUB_ACTOR")
96-
token = os.environ.get("MB3R_GHCR_TOKEN") or os.environ.get("GITHUB_TOKEN")
97-
if bool(username) != bool(token):
95+
explicit_username = os.environ.get("MB3R_GHCR_USERNAME")
96+
explicit_token = os.environ.get("MB3R_GHCR_TOKEN")
97+
if bool(explicit_username) != bool(explicit_token):
9898
raise RuntimeError(
9999
"both registry credentials must be set together: "
100-
"MB3R_GHCR_USERNAME + MB3R_GHCR_TOKEN or GITHUB_ACTOR + GITHUB_TOKEN"
100+
"MB3R_GHCR_USERNAME + MB3R_GHCR_TOKEN"
101101
)
102-
if username and token:
103-
return username, token
102+
if explicit_username and explicit_token:
103+
return explicit_username, explicit_token
104+
105+
fallback_username = os.environ.get("GITHUB_ACTOR")
106+
fallback_token = os.environ.get("GITHUB_TOKEN")
107+
if fallback_username and fallback_token:
108+
return fallback_username, fallback_token
104109
return None
105110

106111

0 commit comments

Comments
 (0)