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

Switch to Using Gradle Wrapper Exclusively #3803

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

gabezurita
Copy link
Collaborator

@gabezurita gabezurita commented Nov 26, 2024

What was the problem?

The workflow used gradle/actions/setup-gradle@v3 to manage the Gradle version, which was redundant since the project already uses the Gradle Wrapper (./gradlew). This redundancy created the potential for version conflicts if setup-gradle and the Gradle Wrapper specified different versions.

Additionally, setting the Ubuntu version in the workflow worked temporarily but failed after Ubuntu 20.04.6 upgraded to Gradle 8.11 (GitHub Actions update) 😅. It's also impossible to pin to the correct minor version in GH workflows (20.04.05).


How does this fix it?

  • Removed gradle/actions/setup-gradle@v3 to ensure the Gradle Wrapper exclusively manages the Gradle version.
  • The Gradle version specified in gradle-wrapper.properties (8.10.2) is always used, ensuring consistency and avoiding version mismatches.
  • Simplified workflow by eliminating unnecessary cache settings (cache-read-only, gradle-home-cache-cleanup).
  • Added a step to clear Gradle caches (rm -rf ~/.gradle || true) to prevent residual or mismatched Gradle versions from interfering with the build process.

This approach aligns the workflow with best practices by relying on the Gradle Wrapper for version management and ensures the workflow remains functional despite changes to the Ubuntu image.


How to test this PR

  1. Verify that the workflow executes successfully in CI pipelines.
  2. Confirm that Gradle 8.10.2 (as defined in gradle-wrapper.properties) is used during all builds.

Note: running abd-vro-internal, this change seems to work!
https://github.com/department-of-veterans-affairs/abd-vro-internal/actions/runs/12022537477/job/33514927530#step:13:2
image
image

- Removed `gradle/actions/setup-gradle@v3` from the workflow as it is redundant when using the Gradle Wrapper (`./gradlew`).
- Ensures the Gradle version specified in `gradle-wrapper.properties` is always used, avoiding potential version conflicts.
- Simplifies the workflow and eliminates the need for `cache-read-only` and `gradle-home-cache-cleanup` settings.
- Focuses cache management on clearing `~/.gradle` to avoid issues with residual or mismatched Gradle versions.

Setting the Ubuntu version worked only momentarily, as Ubuntu 20.04 upgraded to Gradle 8.11 a few days ago :homer_doh:
actions/runner-images#10999
Copy link
Contributor

github-actions bot commented Nov 26, 2024

Test Results

136 tests  ±0   136 ✅ ±0   23s ⏱️ -4s
 39 suites ±0     0 💤 ±0 
 39 files   ±0     0 ❌ ±0 

Results for commit cde044b. ± Comparison against base commit fb4f060.

♻️ This comment has been updated with latest results.

Copy link
Contributor

JaCoCo Test Coverage

Overall Project 73%

There is no coverage information present for the Files changed

@gabezurita gabezurita marked this pull request as ready for review November 26, 2024 03:28
@gabezurita gabezurita requested a review from a team as a code owner November 26, 2024 03:28
@gabezurita gabezurita marked this pull request as draft November 26, 2024 03:29
@gabezurita gabezurita marked this pull request as ready for review November 26, 2024 03:31
Copy link
Contributor

@dfitchett dfitchett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! 👍

@gabezurita gabezurita merged commit aad6a8c into develop Nov 26, 2024
17 checks passed
@gabezurita gabezurita deleted the set-correct-gradle-version branch November 26, 2024 17:16
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 this pull request may close these issues.

3 participants