ben-manes/gradle-versions-plugin

Different result for CI/CD pipeline and local

RowanG1 opened this issue · 9 comments

When running the version plugin locally on Mac and Ubuntu, I get the expected list of outdated libraries. But on pipeline, I get only 3 results. I am baffled as to what might be the cause of the discrepancy. I am using Gitlab for the pipeline. I even tried using a different docker image for Android.

Perhaps it is a caching issue? Can you try with —refresh-dependencies?

Unfortunately, that did not work:
Using fastlane command ->
gradle(task: "dependencyUpdates", flags: "--refresh-dependencies")

hmm.. well that's not very much for me to advise on. You can use --info to inspect the gradle logs and why it resolved.

This plugin resolves a copy of your configuration and dependency with the dynamic version, +, and let Gradle do the work like it otherwise would. Does your CI has different restrictions, like using a repository cache, that do not apply when running locally? Sometimes dynamic queries resolve to stale maven-metadata.xml on a cached in a proxy whereas point lookups for absent versions are resolved anew.

I am not aware of gitlab having restrictions. I even tried running the gitlab .yml on my local machine, but the result remains the same, even after removing the cache field on the gitlab script (previously it cached .gradle folder).
Anyhow, I really appreciate your help.

yeah, I didn't know if you had a Nexus, Artifactory, etc. set up for your CI. Sometimes you'll see builds use that for improved reproducibility, e.g. when an external repository goes dark. I'd use the --info flag to inspect the logs and see how Gradle resolved a dependency, e.g. did it make the network requests, did it hit some resolution strategy or constraint, etc?

The --info helped to find the issue, which showed that gradle properties were missing. I didn't realise that to run the dependency tool, all gradle properties need to be supplied, for all flavors.

oh good, Android has its quirks so I guess so? 🤷

Sorry, I was mistaken about the comment: "all gradle properties need to be supplied, for all flavors". Actually, we use one private library, that is authenticated. Gradle needed the key/secret values for the library (which happens to be the same for all flavors).

oh thanks for the clarification. glad it is working now! hope you find it useful.