Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access secure file on Azure DevOps from pipeline when signing Android apk

How to access .jks file stored in "Azure Secure Files" from "Azure Pipelines" while signing Android apk?

My idea is just to call gradlew assembleRelease to generate and sign apk on Azure Pipeline. Signing in gradle is configured like this:

    signingConfigs {
    register("release") {
        storeFile(file(System.getenv("APK_KEYSTORE")))
        storePassword(System.getenv("APK_KEYSTORE_PASSWORD"))
        keyAlias(System.getenv("APK_KEY_ALIAS"))
        keyPassword(System.getenv("APK_KEY_PASSWORD"))
    }
}

It works locally but can't access the APK_KEYSTORE file stored in "secured files" in Azure

What I've already tried and it works is this Android signing task, but I need signing and generating apk locally also, so I need this one example above

like image 456
artois Avatar asked Oct 29 '25 15:10

artois


1 Answers

How to access .jks file stored in "Azure Secure Files" from "Azure Pipelines" while signing Android apk?

In Azure Pipelines, you couldn't directly use the Secure file from Pipelines -> Library -> Secure files.

You need to add the Download secure file task in the Pipeline. Then the .jks file will be download to $(Agent.TempDirectory). This is the Agent temp folder(e.g. /home/vsts/work/_temp).

Here is an example:

enter image description here

When running the pipeline, the .jks will be downloaded to the local, and then you can find and use it in the temp folder(Path: $(Agent.TempDirectory)/key.jks ).

like image 65
Kevin Lu-MSFT Avatar answered Nov 01 '25 04:11

Kevin Lu-MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!