-
Notifications
You must be signed in to change notification settings - Fork 813
Description
Description:
When using self-hosted runners on GHES with a tool cache, setup-java fails to find the cached version of the corretto distribution. This is due to Corretto using non-semver version numbers, e.g. for Java 17 the version is 17.0.6.10.1
Task version:
3.3 and greater
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Repro steps:
To repro, build a task cache with a given version of Java, e.g.:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'Once the task cache has been build, run a job with the above step that uses the task cache. When you run the job setup-java will fail to find the cached version and and attempt to reach out to the internet. In our case this is blocked by a firewall rule.

To show that this is indeed an issue with the directory names on disk, the following can be done to make setup-java find it. In our case the Corretto Java version is 17.0.6.10.1:
- name: Fix Java Dir
run: mv /opt/hostedtoolcache/Java_Corretto_jdk/17.0.6.10.1 /opt/hostedtoolcache/Java_Corretto_jdk/17.0.6
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'The results of running this are as follows

Expected behavior:
The setup-java action should correctly find cached versions of Corretto on disk
Actual behavior:
The setup-java action fails to find cached versions of Corretto on disk and instead attempts to download a version from the internet.