Skip to content

ci(android): sign with ephemeral keystore when secret is absent - #114

Open
DonLakeFlyer wants to merge 1 commit into
masterfrom
ci-android-keystore-fallback
Open

ci(android): sign with ephemeral keystore when secret is absent#114
DonLakeFlyer wants to merge 1 commit into
masterfrom
ci-android-keystore-fallback

Conversation

@DonLakeFlyer

Copy link
Copy Markdown
Owner

Problem

The Android CI job fails on Dependabot and fork pull requests (e.g. #113):

Failed to load signer "signer #1"
java.io.IOException: Failed to read Keystore password for signer #1: standard input closed
apksigner command failed.
ninja: build stopped: subcommand failed.

These runs have no access to repository Actions secrets, so
QT_ANDROID_KEYSTORE_STORE_PASS resolves to an empty string. apksigner then
falls back to prompting for the password interactively, and stdin is closed on
the runner, so the build dies at the signing step after a full ~18 minute compile.

Fix

Port the Create Debug Keystore guard from the upstream mavlink/qgroundcontrol
Android workflow. When the signing secret is empty, generate a throwaway keystore
into $RUNNER_TEMP with keytool and override the four QT_ANDROID_KEYSTORE_*
variables via $GITHUB_ENV.

  • master / tag pushes: secret present, step skipped, APK signed with the
    committed keystore exactly as before.
  • Dependabot / fork PRs: signed with an ephemeral key that is discarded with the
    runner. No credential literal is attached to a committed private key.

Testing

pre-commit passes on the changed file (actionlint, zizmor, yamllint, TruffleHog).

Dependabot and fork pull requests run without repository Actions secrets,
so QT_ANDROID_KEYSTORE_STORE_PASS resolved to an empty string and apksigner
fell back to prompting for the password on a closed stdin, failing the build.

Generate a throwaway debug keystore and override the keystore environment
variables when the secret is unavailable, matching the upstream workflow.
Signed builds on master and tags are unaffected.
Copilot AI lite review requested due to automatic review settings September 5, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new keystore fallback can also activate on push/tag runs if the signing secret is absent, which risks producing artifacts signed with an ephemeral debug key instead of failing fast.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adjusts the Android GitHub Actions workflow to avoid CI failures on fork/Dependabot pull requests by generating an ephemeral keystore when repository secrets are unavailable, preventing apksigner from prompting on closed stdin.

Changes:

  • Add a conditional “Create Debug Keystore” step that generates a temporary keystore in $RUNNER_TEMP when the signing password env var is empty.
  • Override QT_ANDROID_KEYSTORE_* variables via $GITHUB_ENV so downstream CMake/Gradle signing proceeds non-interactively.
File summaries
File Description
.github/workflows/android.yml Adds an ephemeral-keystore fallback for PR contexts without secrets to keep Android CI builds from failing at the signing step.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +62 to +77
# Dependabot and fork PRs get no repo secrets, leaving apksigner prompting on closed stdin.
- name: Create Debug Keystore
if: ${{ env.QT_ANDROID_KEYSTORE_STORE_PASS == '' }}
run: |
keytool -genkey -v \
-keystore "${RUNNER_TEMP}/debug.keystore" \
-storepass android -alias androiddebugkey -keypass android \
-keyalg RSA -keysize 2048 -validity 10000 \
-dname "CN=Android Debug,O=Android,C=US"
{
echo "QT_ANDROID_KEYSTORE_PATH=${RUNNER_TEMP}/debug.keystore"
echo "QT_ANDROID_KEYSTORE_ALIAS=androiddebugkey"
echo "QT_ANDROID_KEYSTORE_STORE_PASS=android"
echo "QT_ANDROID_KEYSTORE_KEY_PASS=android"
} >> "$GITHUB_ENV"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants