Closed Bug 1820129 Opened 2 years ago Closed 2 years ago

firefox-android: Make `external-gradle-dependencies` task more robust

Categories

(Release Engineering :: General, enhancement)

enhancement

Tracking

(firefox113 fixed)

RESOLVED FIXED
Tracking Status
firefox113 --- fixed

People

(Reporter: jlorenzo, Assigned: jlorenzo)

References

Details

Attachments

(4 files)

How we'd always worked around the problem...

Ever since the introduction of the toolchain-android-gradle-dependencies task in bug 1625126 (then renamed external-gradle-dependencies in bug 1807237), we've intermittently experienced busted caches.

Oftentimes, it's just a network error that prevents a gradle dependencies from being fetch which leads to errors like this one[1]:

[task 2023-03-02T10:45:15.414Z] FAILURE: Build failed with an exception.
[task 2023-03-02T10:45:15.414Z] 
[task 2023-03-02T10:45:15.414Z] * What went wrong:
[task 2023-03-02T10:45:15.414Z] Execution failed for task ':support-rusthttp:generateDebugUnitTestStubRFile'.
[task 2023-03-02T10:45:15.414Z] > Could not resolve all files for configuration ':support-rusthttp:debugUnitTestRuntimeClasspath'.
[task 2023-03-02T10:45:15.414Z]    > Failed to transform monitor-1.4.0.aar (androidx.test:monitor:1.4.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
[task 2023-03-02T10:45:15.414Z]       > Could not find monitor-1.4.0.aar (androidx.test:monitor:1.4.0).
[task 2023-03-02T10:45:15.415Z]         Searched in the following locations:
[task 2023-03-02T10:45:15.415Z]             file:/builds/worker/fetches/external-gradle-dependencies/google/androidx/test/monitor/1.4.0/monitor-1.4.0.aar
[task 2023-03-02T10:45:15.415Z]    > Failed to transform monitor-1.4.0.aar (androidx.test:monitor:1.4.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.status=release}.
[task 2023-03-02T10:45:15.416Z]       > Could not find monitor-1.4.0.aar (androidx.test:monitor:1.4.0).
[task 2023-03-02T10:45:15.416Z]         Searched in the following locations:
[task 2023-03-02T10:45:15.416Z]             file:/builds/worker/fetches/external-gradle-dependencies/google/androidx/test/monitor/1.4.0/monitor-1.4.0.aar
[task 2023-03-02T10:45:15.416Z] 

This is usually fixed by rerunning the corresponding external-gradle-dependencies task, and then rerunning the failed build task. It's worked so far.

... until we couldn't anymore

2 days ago, reruns didn't work anymore. Neither did rebuilding the cache by introducing a small change. This led to bug 1819776.

I took a closer look at the external-gradle-dependencies tasks and they're all crippled with these silent errors[2]:

[task 2023-03-01T21:47:23.445Z] > Task :app:compileFenixDebugUnitTestKotlin FAILED
[task 2023-03-01T21:47:23.447Z] e: /builds/worker/checkouts/vcs/fenix/app/src/test/java/org/mozilla/fenix/tabstray/TabSheetBehaviorManagerTest.kt: (47, 50): Type mismatch: inferred type is BottomSheetBehavior<ConstraintLayout> but BottomSheetBehavior<View> was expected
[...]
[task 2023-03-01T21:47:23.459Z] e: /builds/worker/checkouts/vcs/fenix/app/src/test/java/org/mozilla/fenix/tabstray/TabSheetBehaviorManagerTest.kt: (389, 51): Type mismatch: inferred type is BottomSheetBehavior<ConstraintLayout> but BottomSheetBehavior<View> was expected
[task 2023-03-01T21:47:23.459Z] 
[task 2023-03-01T21:47:23.459Z] > Task :feature-intent:generateReleaseUnitTestStubRFile
[task 2023-03-01T21:47:23.944Z] > Task :feature-intent:compileDebugUnitTestKotlin
[task 2023-03-01T21:47:27.044Z] 
[task 2023-03-01T21:47:27.045Z] > Task :app:compileFenixBetaUnitTestKotlin FAILED
[task 2023-03-01T21:47:27.046Z] e: /builds/worker/checkouts/vcs/fenix/app/src/test/java/org/mozilla/fenix/tabstray/TabSheetBehaviorManagerTest.kt: (47, 50): Type mismatch: inferred type is BottomSheetBehavior<ConstraintLayout> but BottomSheetBehavior<View> was expected
[...]
[task 2023-03-01T21:47:27.052Z] e: /builds/worker/checkouts/vcs/fenix/app/src/test/java/org/mozilla/fenix/tabstray/TabSheetBehaviorManagerTest.kt: (389, 51): Type mismatch: inferred type is BottomSheetBehavior<ConstraintLayout> but BottomSheetBehavior<View> was expected
[task 2023-03-01T21:47:30.444Z]

The reason why these compilation errors were silently ignored is simple: for the sake of being less prone to intermittent failures, we allow some gradle commands to fail[3].

What should we do?

  1. First immediate action: make these errors fatal and turn the external-gradle-dependencies tasks red whenever a test fail.
  2. Make these tasks more robust to intermittent failures, including network errors.

Regarding #2, I think we should run some shell commands to make sure we don't have any .part files present, nor any empty files, nor any .pom files alone. If that occurs, then we should raise a specific exit code and let Taskcluster rerun the task.

[1] https://github.com/mozilla-mobile/firefox-android/pull/948/checks?check_run_id=11710965714
[2] https://firefox-ci-tc.services.mozilla.com/tasks/SqtLbtwiRFCVYZk4vPdVDg/runs/0/logs/public/logs/live.log#L29018
[3] https://github.com/mozilla-mobile/firefox-android/blob/aa3adc0e486c55efa18f26e4a29615f2ba4aac5a/taskcluster/scripts/toolchain/external-gradle-dependencies.sh#L55

Assignee: nobody → jlorenzo
Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/94a77a00b3d04d46f7d7f33b10901d73530b8f88 [main] Bug 1820129 - part 2: Add missing double quotes in `after.sh` Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/d538f4ffa665ad5fd8a7a5b4e12dad264c010fc1 [main] Bug 1820129 - part 3: Put `set -v` at the beginning of `after.sh` Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/032b9e819ae74c20abe34fb991aef124c95228f9 [main] Bug 1820129 - part 4: Put existing code in `_package_artifacts_downloaded_by_nexus()` Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/25f9ad5932e5ce36793e926a0738be7352b9543a [main] Bug 1820129 - part 5: Extract target dir in a constant Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/a82c3697d046477286dd7240c33f38411ac13ae0 [main] Bug 1820129 - part 6: Extract external deps name in a constant Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/6531bbb5ee71d4b1c8c4b1c22a3ecde4b11cc6fd [main] Bug 1820129 - part 7: Extract nexus dirs in constants Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/f475487e4e509a2e71b76bccadab45f81e6cbd66 [main] Bug 1820129 - part 8: Ensure no empty files nor incomplete downloads are in generated archive Authored by https://github.com/JohanLorenzo https://github.com/mozilla-mobile/firefox-android/commit/8a84822c0f7ebea7e86e790e3482090eb160cd10 [main] Bug 1820129 - part 9: Retry on download errors
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: qe-verify+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: