Skip to content

Gradle plugin always invalidates configuration cache on github actions, when ratchetFrom is set #2249

@superxiao

Description

@superxiao

If you are submitting a bug, please include the following:

  • summary of problem
  • Gradle or Maven version
  • spotless version
  • operating system and version
  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
  • copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace

Gradle: 8.10
Spotless gradle plugin: 7.0.0.BETA2
When the spotless gradle plugin is used, configuration cache on github actions using setup-gradle usually fails with the following message:

Calculating task graph as configuration cache cannot be reused because the file system entry '.git/refs/remotes/origin/.probe-8edb64c1-4909-420b-b493-b18d007910f4' has been removed.

Spotless config:

spotless {
    ratchetFrom("origin/main")
    java {
        googleJavaFormat()
    }
}

Without ratchetFrom, it's this,

Reusing configuration cache.

It seems the spotpless plugin introduces git and the entire .git folder as an input for configuration cache of some sort, with ratchetFrom.

This issue may be related.

Here is a sample repo where this can reproduce. You would run the .github/workflows/gradle.xml (can be dispatched manually or on pull request/push) action once to generate cache from the setup-gradle action which is invoked inside. A subsequent run should reuse configuration cache, but does not. When you remove ratchetFrom, clear github cache, and run the action twice, the configuration cache is reused.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions