Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle-wrapper.jar verification fails when stored via git-lfs #456

Closed
LivingWithHippos opened this issue Nov 19, 2024 · 5 comments
Closed
Labels
documentation Improvements or additions to documentation

Comments

@LivingWithHippos
Copy link

If the jars are stored with git-lfs the checksum will fail, the lfs flag needs to be added

    steps:
      - uses: actions/checkout@v4
        with:
          lfs: true  # gradle-wrapper.jar verification will fail without this

otherwise there will be a mismatch, for example gradle 8.10

❯ sha256sum gradle-wrapper.jar
2db75c40782f5e8ba1fc278a5574bab070adccb2d21ca5a6e5ed840888448046  gradle-wrapper.jar

action error:

✗ Found unknown Gradle Wrapper JAR files:
 f629a612b54373f56f950e11394850bb65f87dd68d7731fcde2b99564dcfbf78 app/gradle/wrapper/gradle-wrapper.jar
Error: Error: At least one Gradle Wrapper Jar failed validation!

Not really a bug, posting this for reference. Maybe a check could be added to display a more useful error message?

@bigdaz
Copy link
Member

bigdaz commented Dec 9, 2024

Thanks for the report. We can at least update the documentation for this case.
A PR would be welcome :).

@bigdaz
Copy link
Member

bigdaz commented Dec 9, 2024

@LivingWithHippos Looking at the docs for actions/checkout, am I right in thinking that if you intend on running the Gradle build you would always need to add the lfs: true option?

It looks like the wrapper would fail to execute if you omit this option.

@LivingWithHippos
Copy link
Author

LivingWithHippos commented Dec 9, 2024

If you set jars to be managed with git lfs in your repository gradle will always fail without that flag. It will compute the hash of the pointer files instead of the jars (I suppose)

@bigdaz
Copy link
Member

bigdaz commented Dec 9, 2024

Thanks. My point is that if someone is using setup-gradle with the automatic wrapper validation, then they are likely to already be including lfs: true in their workflow. Without this, any Gradle execution will fail, even without wrapper validation.

I wonder why lfs: false is the default for actions/checkout?

@bigdaz
Copy link
Member

bigdaz commented Dec 12, 2024

I've updated the documentation here: https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#wrapper-jar-stored-with-git-lfs.
Unless this issue becomes more widespread, I'm inclined to leave it at that.

@bigdaz bigdaz closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2024
@bigdaz bigdaz added the documentation Improvements or additions to documentation label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants