fix(ci): stop gradle daemon between flutter build apk and assembleAndroidTest (#554)
## Summary The Firebase Test Lab job (issue #549) failed because `flutter build apk --debug --no-pub` spawned a Gradle daemon, whose journal-cache lock file was left on the persistent Dagger `gradle-cache` mount after the `WithExec` container was torn down. The next exec, `./gradlew --no-daemon app:assembleAndroidTest`, then timed out after 60s waiting for that stale lock: ``` > Timeout waiting to lock journal cache (/home/ci/.gradle/caches/journal-1). It is currently in use by another process. Owner PID: 88 Our PID: 53 ``` The pre-existing `--no-daemon` only prevented stale daemon-registry reuse, not stale lock files. **Fix:** chain `./gradlew --stop` into the first `WithExec` so the daemon shuts down gracefully and releases its locks before Dagger snapshots the layer. ## Test plan - [ ] CI passes - [ ] Manually re-run the Firebase Tests workflow (`workflow_dispatch`) and confirm the Gradle journal-lock error no longer appears Closes #549 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Till Düßmann (Claude agent) <tilldu@googlemail.com> Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/554
This commit was merged in pull request #554.
This commit is contained in:
committed by
guettli
co-authored by
guettli
Till Düßmann
parent
0297701829
commit
de2b9d22b4
+8
-1
@@ -814,7 +814,14 @@ func (m *Ci) DeployApk(
|
||||
// Returns a flat directory with app-debug.apk and app-debug-androidTest.apk.
|
||||
func (m *Ci) BuildAndroidDebugApks() *dagger.Directory {
|
||||
built := m.firebaseBase().
|
||||
WithExec([]string{"flutter", "build", "apk", "--debug", "--no-pub"}).
|
||||
// `flutter build apk` spawns a Gradle daemon. When this WithExec ends the
|
||||
// container is torn down and the daemon is killed, but its journal-cache
|
||||
// lock file on the persistent gradle-cache volume keeps its dead PID — the
|
||||
// next gradlew invocation then times out waiting for that lock. `gradlew
|
||||
// --stop` shuts the daemon down gracefully so the lock is released before
|
||||
// Dagger snapshots the layer.
|
||||
WithExec([]string{"/bin/bash", "-c",
|
||||
`flutter build apk --debug --no-pub && (cd android && ./gradlew --stop)`}).
|
||||
WithWorkdir("/src/android").
|
||||
// --no-daemon avoids connecting to a stale daemon whose registry file was
|
||||
// preserved in the Dagger layer snapshot but whose process no longer exists.
|
||||
|
||||
Reference in New Issue
Block a user