Skip to content

Commit 4839750

Browse files
committed
Bump automatic certificate update on Windows during builds
1 parent 42f7c2d commit 4839750

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

PCbuild/get_external.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
import functools
45
import os
56
import pathlib
67
import platform
8+
import subprocess
79
import sys
810
import tarfile
911
import time
@@ -12,6 +14,28 @@
1214
import zipfile
1315

1416

17+
@functools.cache
18+
def trigger_automatic_root_certificate_update(url: str, timeout: int = 30) -> None:
19+
escaped_url = url.replace("'", "''")
20+
try:
21+
subprocess.run(
22+
[
23+
"powershell",
24+
"-NoProfile",
25+
"-Command",
26+
f"Invoke-WebRequest -Uri '{escaped_url}'"
27+
f" -UseBasicParsing -Method HEAD -MaximumRedirection 0"
28+
f" -TimeoutSec {timeout} -ErrorAction SilentlyContinue"
29+
f" | Out-Null",
30+
],
31+
check=True,
32+
capture_output=True,
33+
timeout=timeout + 5,
34+
)
35+
except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
36+
pass
37+
38+
1539
def retrieve_with_retries(download_location, output_path, reporthook,
1640
max_retries=7):
1741
"""Download a file with exponential backoff retry and save to disk."""

0 commit comments

Comments
 (0)