Skip to content

Commit

Permalink
Fix secrel#publish-to-grc workflow ubuntu/gradle version issue (#3789)
Browse files Browse the repository at this point in the history
### **Problem**
Gradle 8.11, used by the latest Ubuntu runner (`ubuntu-latest`),
introduced a failure in the Publish to GHCR workflow. The failure occurs
due to an issue with the `removeUnusedEntriesOlderThan` property in
Gradle's caching system. [Example
failures](https://github.com/department-of-veterans-affairs/abd-vro-internal/actions/runs/11960038018/job/33343170178):
```
Compiling initialization script '/home/runner/.gradle/init.d/gradle-actions.inject-develocity.init.gradle' using BuildScriptTransformer.
Starting Build

FAILURE: Build failed with an exception.

* Where:
Initialization script '/home/runner/work/_temp/dummy-cleanup-project/init.gradle' line: 8

* What went wrong:
Cannot get the value of write-only property 'removeUnusedEntriesOlderThan' for object of type org.gradle.api.internal.cache.DefaultCacheConfigurations$DefaultCacheResourceConfiguration.
```

Initially, this error was limited to the Publish to GHCR workflow but
later spread to all pipelines after [upgrading Gradle in this
commit](13b270d).
The issue appears tied to Gradle's handling of cached entries,
potentially triggered by specific pipeline actions.

![image](https://github.com/user-attachments/assets/3ea42f09-bd0e-4f5e-8a0a-9e11383e90df)

![image](https://github.com/user-attachments/assets/d5a668ee-6cee-427f-811d-65ddb5d38949)


---

### **Solution**
This PR resolves the issue by specifying `ubuntu-22.04` as the runner
environment. This uses Gradle 8.10.2, the last known version where
workflows passed successfully. See the [Ubuntu 22.04 environment
documentation](https://github.com/actions/runner-images/blob/ubuntu24/20241117.1/images/ubuntu/Ubuntu2004-Readme.md)
for details.

Given this project's upcoming decommissioning, addressing the root cause
(Gradle's cache behavior) is unlikely worth the effort. Downgrading the
environment provides a practical solution to restore pipeline
functionality.

Note: of the last [set of successful Secrel pipeline
runs](https://github.com/department-of-veterans-affairs/abd-vro-internal/actions?query=workflow%3ASecrel+is%3Asuccess),
the [last one to
succeed](https://github.com/department-of-veterans-affairs/abd-vro-internal/actions/runs/11815172342)
was running [Gradle
8.10.2](https://github.com/department-of-veterans-affairs/abd-vro-internal/pull/450/files)

---

### **Expected Outcome**
Once this PR is merged into `develop`, the Secrel pipeline in
[abd-vro-internal](https://github.com/department-of-veterans-affairs/abd-vro-internal/actions)
should run successfully without errors. Fingers crossed 🤞!

---

### **Notes for Future Investigation**
If the project weren't being decommissioned, potential areas for deeper
investigation include:
- The caching logic around `removeUnusedEntriesOlderThan`.
- When and why does Gradle start deleting cached entries in these
workflows?
- Possible fixes or workarounds for Gradle 8.11+.

---
  • Loading branch information
gabezurita authored Nov 22, 2024
2 parents 97bd3ed + 71ea21a commit a57b16e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/secrel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
outputs:
vro-images: ${{ steps.publish-images.outputs.images_list }}
slack-response-ts: ${{ fromJson(steps.notify-slack.outputs.slack-result).response.message.ts }}
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04 # NOTE: As VRO is being shut down, this version is pinned to get around a .gradle issue with removeUnusedEntriesOlderThan.
steps:
- name: "Determine image tag"
id: image-props
Expand Down
2 changes: 1 addition & 1 deletion gradle-plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
// Set versions for these plugins so we don't have to repeat the versions in convention.gradle files
// https://discuss.gradle.org/t/applying-a-plugin-version-inside-a-convention-plugin/42160
// Syntax: "<pluginName>:<pluginName>.gradle.plugin:<pluginVersion>"
implementation 'io.freefair.lombok:io.freefair.lombok.gradle.plugin:8.11'
implementation 'io.freefair.lombok:io.freefair.lombok.gradle.plugin:8.10.2' // NOTE: As VRO is being shut down, this version is pinned to get around a .gradle issue with removeUnusedEntriesOlderThan.
implementation 'com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:6.24.0'
implementation 'com.felipefzdz.gradle.shellcheck:com.felipefzdz.gradle.shellcheck.gradle.plugin:1.4.6'
implementation 'com.palantir.docker:com.palantir.docker.gradle.plugin:0.35.0'
Expand Down

0 comments on commit a57b16e

Please sign in to comment.