Skip to content

Configuration Cache Incompatibility in DeployGate Gradle Plugin #270

@zaburen

Description

@zaburen

🚨 Configuration Cache Incompatibility in DeployGate Gradle Plugin

🐞 Description

The DeployGate Gradle plugin appears to be incompatible with Gradle’s Configuration Cache. When running tasks like uploadDeployGateAabProdRelease, with Gradle cache turned on, the build fails with:

Error:

Cannot query the value of property 'appOwnerName' because it has no value available.

Our current abridged workflow file looks like this.

...
      - name: Build APKs and AABs 
        run: |
          ./gradlew bundleProdRelease

      - name: Distribute all Prod App to DeployGate
        env:
          DEPLOYGATE_APP_OWNER_NAME: ${{secrets.APP_OWNER}}
          DEPLOYGATE_API_TOKEN: ${{secrets.TOKEN}}
          DEPLOYGATE_MESSAGE: ${{ github.event.inputs.message }}
        run: |
          ./gradlew uploadDeployGateAabProdRelease

...

This works fine as long as caching is turned off. However once caching is turned on

org.gradle.configuration-cache=true

We get the error listed above.

🤔 Suspicious Area

This is not an area I am very familiar with, so I could be wrong, but it looks like property declarations such as appOwnerName, apiToken, and message if using the Gradle Property API would allow the property to be properly cached. However this is just from looking at various articles and documentations.

💡 Workarounds

Disable gradle caching all together:
Add to gradle.properties:

org.gradle.configuration-cache=false

OR

In the workflow add the flowing before upload tasks

--no-configuration-cache

💻 Environment

  • Plugin version: 2.8.0 & 2.9.0
  • Android Gradle version: 8.10.1
  • CI: GitHub Actions

🔎 Additional context

I tried another approach, instead of using environment variables, I passed properties to the deploygate block in build.gradle file.

Workflow:

...
      - name: Build APKs and AABs 
        run: |
          ./gradlew bundleProdRelease

      - name: Distribute all Prod App to DeployGate
        run: |
          ./gradlew \
              - PdeploygateAppOwner="${{ secrets.APP_OWNER }}" \
              - P... \
              - P... \
              uploadDeployGateAabProdRelease

...

Then in the build.gradle file

val propertyOwner = project.findProperty("deploygateAppOwner") as? String ?: ""
val propertyToken = project.findProperty("deploygateApiToken") as? String ?: ""
val propertyMessage = project.findProperty("deploygateMessage") as? String

deploygate {

    println("📦 Configuring DeployGate:")
    println("└▶ appOwnerName = $propertyOwner")
    println("└▶ apiToken set = ${propertyToken.isNotEmpty()}")

    appOwnerName = propertyOwner
    apiToken = propertyToken
    ...
}

With the log output in the deploygate block I was able to confirm that the values were being passed, even through the Github runner. However, despite this, the plugin still fails during execution with No value available.

If there is any further information I can provide please let me know. And of course I will be glad to do anything I can do to help with this issue!

Also thanks for making such a great plugin! 👍 💯

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions