brizental pushed to branch main at The Tor Project / Applications / 
tor-browser-bundle-testsuite


Commits:
1bdaea90 by Beatriz Rizental at 2026-05-06T12:59:12-03:00
Bug 40101: Figure the android-sdk URL dinamically

- - - - -


2 changed files:

- .gitlab/_base.yml
- .gitlab/scripts/before_script.py


Changes:

=====================================
.gitlab/_base.yml
=====================================
@@ -78,8 +78,7 @@ variables:
     - when: never
 
   variables:
-    # TODO (tor-browser-bundle-testsuite#40101): Stop hardcoding the filename 
here.
-    ANDROID_SDK_REPACK_URL: 
"https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out/android-sdk/android-sdk-36.1.0-f31d7b.tar.zst";
+    SETUP_ANDROID_SDK: 1
     INSTALLER_URL: "$[[ inputs.android_x86_64_installer_url ]]"
     ARTIFACTS_URL: "$[[ inputs.android_x86_64_artifacts_url ]]"
     PACKAGE_NAME: "$[[ inputs.android_x86_64_package_name ]]"


=====================================
.gitlab/scripts/before_script.py
=====================================
@@ -6,6 +6,7 @@ import time
 import urllib.request
 import zipfile
 from pathlib import Path
+import re
 
 SPECULATIVE_DOWNLOAD_RETRY_ATTEMPTS = 3
 SPECULATIVE_DOWNLOAD_RETRY_DELAY = 300  # 5min
@@ -14,6 +15,10 @@ SPECULATIVE_DOWNLOAD_RETRY_DELAY = 300  # 5min
 # expects the emulator to have a this exact android version.
 EMULATOR_ANDROID_VERSION = 34
 
+TOR_BROWSER_BUILD_OUT = (
+    "https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out";
+)
+
 
 def download_file(url: str, dest: Path, sha256: str = "") -> None:
     print(f"Downloading {url} -> {dest}")
@@ -77,15 +82,27 @@ def download_minidump_stackwalk(
     print(f"Extracted minidump-stackwalk -> {dest_dir}")
 
 
-def setup_android_sdk(
-    moz_fetches_dir: str,
-    android_sdk_repack_url: str,
-) -> None:
+def get_android_sdk_repack_url():
+    url = f"{TOR_BROWSER_BUILD_OUT}/android-sdk?C=M;O=D"
+    req = urllib.request.Request(url, method="GET")
+    with urllib.request.urlopen(req) as response:
+        html = response.read().decode()
+        found = re.search(
+            r'<a href="(android-sdk-[^"]+\.tar\.zst)"',
+            html,
+        )
+        if not found:
+            raise RuntimeError(f"Could not find android-sdk tarball URL in 
{url}")
+
+        return f"{url}/{found.group(1)}"
+
+
+def setup_android_sdk(moz_fetches_dir: str) -> None:
     android_sdk_dir = Path(moz_fetches_dir) / "android-sdk-linux"
     android_sdk_dir.mkdir(parents=True, exist_ok=True)
 
     tar_zst_path = Path("android-sdk.tar.zst")
-    download_file(android_sdk_repack_url, tar_zst_path)
+    download_file(get_android_sdk_repack_url(), tar_zst_path)
     extract_tar(tar_zst_path, android_sdk_dir)
 
     # Remove fake emulator binary added by tor-browser-build
@@ -139,7 +156,7 @@ def before_script(
     minidump_stackwalk_sha256: str,
     moz_fetches_dir: str,
     sha256sums_url: str = "",
-    android_sdk_repack_url: str = "",
+    setup_android: bool = False,
 ) -> None:
     check_sha256sums_url(sha256sums_url)
     download_mozharness(mozharness_url)
@@ -147,11 +164,8 @@ def before_script(
         minidump_stackwalk_url, moz_fetches_dir, minidump_stackwalk_sha256
     )
 
-    if android_sdk_repack_url:
-        setup_android_sdk(
-            moz_fetches_dir,
-            android_sdk_repack_url,
-        )
+    if setup_android:
+        setup_android_sdk(moz_fetches_dir)
 
 
 if __name__ == "__main__":
@@ -161,6 +175,5 @@ if __name__ == "__main__":
         minidump_stackwalk_sha256=os.environ.get("MINIDUMP_STACKWALK_SHA256", 
""),
         moz_fetches_dir=os.environ["MOZ_FETCHES_DIR"],
         sha256sums_url=os.environ.get("SHA256SUMS_URL", ""),
-        # Android-only stuff.
-        android_sdk_repack_url=os.environ.get("ANDROID_SDK_REPACK_URL", ""),
+        setup_android="SETUP_ANDROID_SDK" in os.environ,
     )



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser-bundle-testsuite/-/commit/1bdaea9062d644185e1ad9f47692b0119c33ef22

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser-bundle-testsuite/-/commit/1bdaea9062d644185e1ad9f47692b0119c33ef22
You're receiving this email because of your account on gitlab.torproject.org. 
Manage all notifications: https://gitlab.torproject.org/-/profile/notifications 
| Help: https://gitlab.torproject.org/help


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to