Skip to content

CI: ci-install-android-sdk.sh fails silently after the Android Studio page dropped version numbers from cmdline-tools links #3374

Todo

Description

@DenBond7

What happens

Since the evening of 2026-12-02, every pipeline fails in the "Build Project" job after about 40 seconds. The ./script/ci-install-android-sdk.sh step exits with code 1 and prints no error. The "Code Quality & Unit Tests" jobs fail at the same step, and the instrumentation tests are canceled.

Examples (branch issue_3211_fix_flaky_tests_part_5, PR #3373):

  • e7e7f327-5b57-4d09-8990-e03cd05fd25f (be72539), job "Build Project" f68bd3c3-d762-4664-825a-3ce901aa1590
  • 6386f000-2d8c-433e-98b1-88c7391307b4 (9e90bde)
  • 49e8f35f-677a-47c4-97e8-de5500f28e60 (a47b7e2)

The last master pipeline that got past this step started on 2026-12-02 at 15:21 UTC. The first failing one started at 19:59 UTC.

The log ends right after the check disables xtrace:

+ SDK_ARCHIVE=commandlinetools-linux-15859902_latest.zip
+ check_cmdline_tools_latest_or_fail
...
+ xtrace_was_on=1
+ set +x
Exporting SEMAPHORE_JOB_RESULT

Cause

check_cmdline_tools_latest_or_fail() in script/ci-install-android-sdk.sh downloads https://developer.android.com/studio#command-tools. It looks for commandlinetools-linux-<version>_latest.zip there and compares the version with the pinned SDK_ARCHIVE:

LATEST_VER="$(
  printf '%s' "$HTML" \
    | grep -oE 'commandlinetools-linux-[0-9]+_latest\.zip' \
    | sed -E 's/.*-([0-9]+)_latest\.zip/\1/' \
    | sort -n \
    | tail -n 1
)"

The page now links archives without a version number:

commandlinetools-linux_latest.zip
commandlinetools-mac_x86_64_latest.zip
commandlinetools-mac_arm64_latest.zip
commandlinetools-win_latest.zip

So grep matches nothing and returns 1. The script runs with set -euxo pipefail, so the whole command substitution fails, and set -e stops the script with no message. The function is meant to skip the check when it can't find the latest version ([[ -n "$LATEST_VER" ]] || return 0), but that line is never reached.

The install itself is not affected. The pinned archive https://dl.google.com/android/repository/commandlinetools-linux-15859902_latest.zip is still available (HTTP 200).

Proposed fix

  1. Make the parsing tolerate no matches, so the check is skipped as intended:

    LATEST_VER="$(
      printf '%s' "$HTML" \
        | { grep -oE 'commandlinetools-linux-[0-9]+_latest\.zip' || true; } \
        | sed -E 's/.*-([0-9]+)_latest\.zip/\1/' \
        | sort -n \
        | tail -n 1
    )"

    Print a warning when LATEST_VER is empty, so a skipped check is visible in the log.

  2. Decide what to do with the version check itself. The page no longer shows the version, so the check can't detect a newer cmdline-tools release. Options:

    • remove the check;
    • read the version from the SDK repository metadata (https://dl.google.com/android/repository/repository2-3.xml, package cmdline-tools;latest, which lists commandlinetools-linux-<version>_latest.zip per host OS);
    • pin commandlinetools-linux_latest.zip without a version, which makes the check unnecessary but also makes CI less reproducible.
  3. Bump the pinned version. According to repository2-3.xml (checked on 2026-12-04), the latest cmdline-tools;latest is 24.0, commandlinetools-linux-17093898_latest.zip. We pin 15859902. So the old check would have failed anyway, and the page change probably came with this release.

Impact

This blocks CI for all PRs and for master until it's fixed.

Activity

  1. self-assigned this
    on Dec 4, 2026
  2. added
    CI
    on Dec 4, 2026
  3. added this to the 1.6.7 milestone on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CI

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions