From e10bbf0dae2f5c6033f99ccfb3edc0476ddf0dd4 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Fri, 11 Sep 2026 16:42:19 +0000 Subject: [PATCH] Bug 2062847 - Let the android-gradle-build python tests use non-shippable artifact builds r=firefox-build-system-reviewers,sergesanspaille The android-gradle-build python tests run artifact builds, but `mach artifact install` only searches the `.shippable` index for opt builds. For each of the 50 candidate pushheads it looks up `gecko.v2.autoland.shippable.revision..mobile.android--opt`. Shippable Android builds aren't scheduled by default on autoland, so when none of the last 50 autoland pushes ran a shippable build, the search comes up empty, fails with "no built artifacts found", and every artifact-build test in the suite fails at once. It passes only when one of those 50 pushes happens to have a shippable Android build, which is why it shows up as an intermittent. Add a MOZ_ARTIFACT_ALLOW_NON_SHIPPABLE environment variable that makes the index lookup fall back to the regular per-push opt build when no shippable build is found, and set it for the android-gradle-build task. The shippable index is still tried first, so branches that only publish shippable builds (central, beta, release, esr) keep resolving to those. Differential Revision: https://phabricator.services.mozilla.com/D324866 --- python/mozbuild/mozbuild/artifacts.py | 46 ++++++++++++------- .../kinds/source-test/python-android.yml | 7 +++ 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/python/mozbuild/mozbuild/artifacts.py b/python/mozbuild/mozbuild/artifacts.py index ba390d03a9ea..6cb0d1cf214c 100644 --- a/python/mozbuild/mozbuild/artifacts.py +++ b/python/mozbuild/mozbuild/artifacts.py @@ -1210,27 +1210,39 @@ class TaskCache(CacheManager): # 'autoland' tree = tree.split("/")[1] if "/" in tree else tree + # Optimized builds are normally only published to the `.shippable` + # index. Some consumers (e.g. the Android Gradle python tests) run on + # autoland, where shippable Android builds aren't scheduled by default; + # with MOZ_ARTIFACT_ALLOW_NON_SHIPPABLE they fall back to the regular + # per-push opt builds. The shippable index is still tried first, so + # branches that only publish shippable builds (central, beta, release, + # esr) are unaffected. See bug 1768186 for lifting this more generally. if job.endswith("-opt"): - tree += ".shippable" - - namespace = f"{job_configuration.trust_domain}.v2.{tree}.revision.{rev}.{job_configuration.product}.{job}" - self.log( - logging.DEBUG, - "artifact", - {"namespace": namespace}, - "Searching Taskcluster index with namespace: {namespace}", - ) + if os.environ.get("MOZ_ARTIFACT_ALLOW_NON_SHIPPABLE"): + trees = [f"{tree}.shippable", tree] + else: + trees = [f"{tree}.shippable"] + else: + trees = [tree] from taskcluster.exceptions import TaskclusterRestFailure - try: - index = get_taskcluster_client("index") - task = index.findTask(namespace) - taskId = task["taskId"] - except (KeyError, TaskclusterRestFailure) as e: - if isinstance(e, TaskclusterRestFailure) and e.status_code != 404: - raise - + index = get_taskcluster_client("index") + for candidate_tree in trees: + namespace = f"{job_configuration.trust_domain}.v2.{candidate_tree}.revision.{rev}.{job_configuration.product}.{job}" + self.log( + logging.DEBUG, + "artifact", + {"namespace": namespace}, + "Searching Taskcluster index with namespace: {namespace}", + ) + try: + taskId = index.findTask(namespace)["taskId"] + break + except (KeyError, TaskclusterRestFailure) as e: + if isinstance(e, TaskclusterRestFailure) and e.status_code != 404: + raise + else: # Not all revisions correspond to pushes that produce the job we # care about; and even those that do may not have completed yet. raise ValueError(f"Task for {namespace} does not exist (yet)!") diff --git a/taskcluster/kinds/source-test/python-android.yml b/taskcluster/kinds/source-test/python-android.yml index 4be29e8d1fcf..fa17121e7164 100644 --- a/taskcluster/kinds/source-test/python-android.yml +++ b/taskcluster/kinds/source-test/python-android.yml @@ -22,6 +22,13 @@ android-gradle-build: MOZ_OBJDIR: obj-firefox PERFHERDER_EXTRA_OPTIONS: android-gradle-build TINDERBOX_OUTPUT: '1' + # The tests run artifact builds. Let `mach artifact install` accept + # the regular (non-shippable) Android opt builds, which run on every + # integration push, instead of only the shippable index. Shippable + # Android builds are release-only, so on autoland the shippable + # index is almost always empty and the pushhead search fails with + # "no built artifacts found" (bug 2062847). + MOZ_ARTIFACT_ALLOW_NON_SHIPPABLE: '1' max-run-time: 7200 run-on-repo-type: [hg] run: