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

The Corretto distribution fails to find existing versions when using a task cache #474

Closed
4 of 5 tasks
jamestoyer opened this issue Mar 27, 2023 · 5 comments · Fixed by #480
Closed
4 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@jamestoyer
Copy link

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.
Screenshot 2023-03-27 at 14 11 27

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
Screenshot 2023-03-27 at 14 17 50

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.

@jamestoyer jamestoyer added bug Something isn't working needs triage labels Mar 27, 2023
@IvanZosimov
Copy link
Contributor

Hi, @jamestoyer 👋 ! Thanks for the issue, we will investigate it and get back to you with updates!

@IvanZosimov
Copy link
Contributor

Hi, @jamestoyer 👋 This PR should resolve the issue, it's already been merge into the main. So you can try how it works using:

- uses: actions/setup-java@main

The main branch can be used only as a preview of the features that will be added to the next release as it may be not stable. As soon as the next release will be created, I'll ping you.

@IvanZosimov IvanZosimov linked a pull request Jul 7, 2023 that will close this issue
2 tasks
@emiksk
Copy link

emiksk commented Jul 20, 2023

@IvanZosimov
When the bug fix will be released?
I'm having trouble with the bug and hope it will be resolved in v3.

Thank you for your works!

@IvanZosimov
Copy link
Contributor

Hi, @emiksk 👋 Sorry for delays, it will be released very soon.

@IvanZosimov
Copy link
Contributor

Hi, @emiksk and @jamestoyer 👋 The new version of the setup-java is released. Please, check it out.

I'm going to close this issue, If you have any additions or questions feel free to ping us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants