build_android_bundle_local.sh: Do it in Dagger #444

Closed
opened 2026-06-05 15:03:52 +00:00 by guettli · 2 comments
guettli commented 2026-06-05 15:03:52 +00:00 (Migrated from codeberg.org)

Do that via Dagger.


17:02 ❯ ./scripts/build_android_bundle_local.sh

[1/1] Android SDK
  ├─ [1/6] android-arm-profile/linux-x64                           514ms
  ├─ [2/6] android-arm-release/linux-x64                           404ms
  ├─ [3/6] android-arm64-profile/linux-x64                         467ms
  ├─ [4/6] android-arm64-release/linux-x64                         410ms
  ├─ [5/6] android-x64-profile/linux-x64                           463ms
  └─ [6/6] android-x64-release/linux-x64                           405ms
[!] No Android SDK found. Try setting the ANDROID_HOME environment variable.
exit status 1
Do that via Dagger. ``` 17:02 ❯ ./scripts/build_android_bundle_local.sh [1/1] Android SDK ├─ [1/6] android-arm-profile/linux-x64 514ms ├─ [2/6] android-arm-release/linux-x64 404ms ├─ [3/6] android-arm64-profile/linux-x64 467ms ├─ [4/6] android-arm64-release/linux-x64 410ms ├─ [5/6] android-x64-profile/linux-x64 463ms └─ [6/6] android-x64-release/linux-x64 405ms [!] No Android SDK found. Try setting the ANDROID_HOME environment variable. exit status 1 ```
guettlibot commented 2026-06-05 15:10:04 +00:00 (Migrated from codeberg.org)

Now I have everything I need. Let me write the implementation plan.


Implementation Plan

Context: scripts/build_android_bundle_local.sh fails locally because it requires a host Android SDK. The equivalent Dagger infrastructure already exists in ci/main.go (BuildAndroidRelease, StampAndroidVersionCode, SignAndroidBundle, PublishAndroid). The plan is to delete the shell script and redirect the two Taskfile tasks that depend on it to the existing Dagger pipeline.


Step 1 — Delete scripts/build_android_bundle_local.sh

Remove the file entirely. All its logic (keystore decode, flutter build appbundle, GIT_HASH dart-define) is already covered by BuildAndroidRelease + SignAndroidBundle in ci/main.go.


Step 2 — Remove build-android-bundle-local from Taskfile.yml

Delete the entire build-android-bundle-local task (lines 529–541). It is only ever called as a dep of deploy-android-bundle and has no standalone callers.


Step 3 — Rewrite deploy-android-bundle in Taskfile.yml

The existing deploy-android-bundle task depends on build-android-bundle-local and then runs python3 scripts/deploy_playstore.py directly. The Dagger PublishAndroid function already does build → stamp versionCode → sign → Play Store upload in one pipeline.

Replace the task body:

deploy-android-bundle:
  desc: Build, sign, and upload AAB to Play Store internal track via Dagger
  deps: [generate-changelog]
  dotenv: [".env"]
  preconditions:
    - sh: test -n "$PLAY_STORE_CONFIG_JSON"
      msg: "PLAY_STORE_CONFIG_JSON is not set"
    - sh: test -n "$ANDROID_KEYSTORE_BASE64"
      msg: "ANDROID_KEYSTORE_BASE64 is not set"
    - sh: test -n "$ANDROID_KEYSTORE_PASSWORD"
      msg: "ANDROID_KEYSTORE_PASSWORD is not set"
  cmds:
    - HASH=$(git rev-parse --short HEAD) && sops exec-env secrets.enc.yaml 'scripts/silent_on_success.sh timeout --kill-after=10 1800 dagger call --progress=plain -q -m ci --source=. publish-android --play-store-config env:PLAY_STORE_CONFIG_JSON --keystore-base64 env:ANDROID_KEYSTORE_BASE64 --keystore-password env:ANDROID_KEYSTORE_PASSWORD --commit-hash "$HASH"'

Key differences from the old task:

  • deps now lists generate-changelog directly instead of build-android-bundle-local (which used to pull in _preflight, _android-sdk-check, _codegen, generate-changelog).
  • No _android-sdk-check dep — Dagger provides the Android SDK inside the container.
  • sops exec-env still injects the secrets; Dagger receives them via env: references.
  • scripts/silent_on_success.sh is kept for consistent log behaviour with other deploy tasks.

No changes needed to ci/main.go

PublishAndroid already handles the full pipeline. The versionCode is stamped via time.Now().Unix() (equivalent to the old date +%s build number). The --build-name flag from the old script is not passed in the Dagger path either — this is an acceptable difference since the Play Store ignores the version name for track routing.


Verification

After the change, task deploy-android-bundle should run cleanly on a machine with no Android SDK installed (just Docker/Podman + Dagger), injecting credentials via sops as before.

Now I have everything I need. Let me write the implementation plan. --- ## Implementation Plan **Context:** `scripts/build_android_bundle_local.sh` fails locally because it requires a host Android SDK. The equivalent Dagger infrastructure already exists in `ci/main.go` (`BuildAndroidRelease`, `StampAndroidVersionCode`, `SignAndroidBundle`, `PublishAndroid`). The plan is to delete the shell script and redirect the two Taskfile tasks that depend on it to the existing Dagger pipeline. --- ### Step 1 — Delete `scripts/build_android_bundle_local.sh` Remove the file entirely. All its logic (keystore decode, flutter build appbundle, GIT_HASH dart-define) is already covered by `BuildAndroidRelease` + `SignAndroidBundle` in `ci/main.go`. --- ### Step 2 — Remove `build-android-bundle-local` from `Taskfile.yml` Delete the entire `build-android-bundle-local` task (lines 529–541). It is only ever called as a dep of `deploy-android-bundle` and has no standalone callers. --- ### Step 3 — Rewrite `deploy-android-bundle` in `Taskfile.yml` The existing `deploy-android-bundle` task depends on `build-android-bundle-local` and then runs `python3 scripts/deploy_playstore.py` directly. The Dagger `PublishAndroid` function already does build → stamp versionCode → sign → Play Store upload in one pipeline. Replace the task body: ```yaml deploy-android-bundle: desc: Build, sign, and upload AAB to Play Store internal track via Dagger deps: [generate-changelog] dotenv: [".env"] preconditions: - sh: test -n "$PLAY_STORE_CONFIG_JSON" msg: "PLAY_STORE_CONFIG_JSON is not set" - sh: test -n "$ANDROID_KEYSTORE_BASE64" msg: "ANDROID_KEYSTORE_BASE64 is not set" - sh: test -n "$ANDROID_KEYSTORE_PASSWORD" msg: "ANDROID_KEYSTORE_PASSWORD is not set" cmds: - HASH=$(git rev-parse --short HEAD) && sops exec-env secrets.enc.yaml 'scripts/silent_on_success.sh timeout --kill-after=10 1800 dagger call --progress=plain -q -m ci --source=. publish-android --play-store-config env:PLAY_STORE_CONFIG_JSON --keystore-base64 env:ANDROID_KEYSTORE_BASE64 --keystore-password env:ANDROID_KEYSTORE_PASSWORD --commit-hash "$HASH"' ``` Key differences from the old task: - `deps` now lists `generate-changelog` directly instead of `build-android-bundle-local` (which used to pull in `_preflight`, `_android-sdk-check`, `_codegen`, `generate-changelog`). - No `_android-sdk-check` dep — Dagger provides the Android SDK inside the container. - `sops exec-env` still injects the secrets; Dagger receives them via `env:` references. - `scripts/silent_on_success.sh` is kept for consistent log behaviour with other deploy tasks. --- ### No changes needed to `ci/main.go` `PublishAndroid` already handles the full pipeline. The versionCode is stamped via `time.Now().Unix()` (equivalent to the old `date +%s` build number). The `--build-name` flag from the old script is not passed in the Dagger path either — this is an acceptable difference since the Play Store ignores the version name for track routing. --- ### Verification After the change, `task deploy-android-bundle` should run cleanly on a machine with no Android SDK installed (just Docker/Podman + Dagger), injecting credentials via `sops` as before.
guettlibot commented 2026-06-05 19:50:04 +00:00 (Migrated from codeberg.org)

PR created: https://codeberg.org/guettli/sharedinbox/pulls/449


Here's what was done to close #444:

Changes:

  • Deleted scripts/build_android_bundle_local.sh — this script required a host Android SDK (ANDROID_HOME) which caused the No Android SDK found error when none was installed locally.
  • Removed the build-android-bundle-local Taskfile task that invoked it (it also depended on _android-sdk-check).
  • Rewrote deploy-android-bundle to delegate to the existing Dagger publish-android pipeline via sops exec-env for local secret injection. The Dagger pipeline already handles everything the script did (keystore decode, AAB build, signing) plus version-code stamping — no changes to ci/main.go were needed.

PR: https://codeberg.org/guettli/sharedinbox/pulls/449

PR created: https://codeberg.org/guettli/sharedinbox/pulls/449 --- Here's what was done to close #444: **Changes:** - Deleted `scripts/build_android_bundle_local.sh` — this script required a host Android SDK (`ANDROID_HOME`) which caused the `No Android SDK found` error when none was installed locally. - Removed the `build-android-bundle-local` Taskfile task that invoked it (it also depended on `_android-sdk-check`). - Rewrote `deploy-android-bundle` to delegate to the existing Dagger `publish-android` pipeline via `sops exec-env` for local secret injection. The Dagger pipeline already handles everything the script did (keystore decode, AAB build, signing) plus version-code stamping — no changes to `ci/main.go` were needed. **PR:** https://codeberg.org/guettli/sharedinbox/pulls/449
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guettli/sharedinbox#444