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

Action should use existing Gradle wrapper distributions for cache-cleanup where possible #515

Closed
stefan-rademacher-tk opened this issue Jan 15, 2025 · 4 comments · Fixed by #525
Milestone

Comments

@stefan-rademacher-tk
Copy link

Hi.

We are using the setup-gradle action with the default configuration 'gradle-version: wrapper'.

In the section ‘Post Setup Gradle’, the action tries to download Gradle 8.11 from services.gradle.org, even though we have a Gradle Wrapper configuration with Gradle 8.10.2 (from an on-premise webserver) configured:

Provision Gradle >= 8.11
Gradle distribution 8.11 not found in cache. Will download. 
Downloaded https://services.gradle.org/distributions/gradle-8.11-bin.zip to /__w/_temp/.gradle-actions/gradle-installations/downloads/gradle-8.11-bin.zip (size 136917193)
…

This doesn't work in our corporate network, since the proxy slows down the download drastically.

Would be nice, if ...

  1. ...either the Gradle Wrapper configuration could be found and reused for cache cleanup
  2. ...or the download URL would be configurable.

The first option seems more appealing to me.

This issue is related to #436.

Thank you, Stefan

@bigdaz
Copy link
Member

bigdaz commented Jan 15, 2025

Thanks for reporting. As a workaround, is it possible to pre-install Gradle >= 8.11 on the runners? If cache-cleanup finds Gradle on the PATH, then no download will be necessary.

I agree that re-using existing wrapper distributions would be the optimal solution, but it's not clear when we'll have time to implement this.

@stefan-rademacher-tk
Copy link
Author

Thanks for providing the workaround. We'll consider that.

@bigdaz
Copy link
Member

bigdaz commented Jan 24, 2025

@stefan-rademacher-tk You may have seen that this issue has been resolved. This is done by re-using known an existing wrapper executable for cache-cleanup, assuming that it meets the minimum version requirements (>= 8.11 and at least as new as the newest version that executed a build during the Job).

While this has not yet been released, it would be great if you could try out a pre-release version to ensure that it solves your problem:

  • Update the wrapper for your project to at least 8.11
  • In your workflow reference gradle/actions/setup-gradle@main
  • Ensure that the runner doesn't have 8.11 (or newer) pre-installed. (This is the workaround noted above).

To verify that it's working, check for a message like this in the action logs.

Image

Thanks!

@stefan-rademacher-tk
Copy link
Author

Hi. I could successfully avoid the download:

Provision Gradle >= 8.12.1
  Gradle version 8.12.1 is available at /__w/setup-gradle-test/setup-gradle-test/gradlew and >= 8.12.1. Not installing.

Thank you for fixing this so quickly!

@bigdaz bigdaz changed the title Allow custom Gradle Distribution URL's for cache cleanup builds Action should use existing Gradle wrapper distributions for cache-cleanup where possible Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants