Code Monkey home page Code Monkey logo

Comments (18)

aparnajyothi-y avatar aparnajyothi-y commented on August 15, 2024

Hello @Ivanuil, Thank you for creating this issue and we will look into it :)

from setup-java.

Sebagai avatar Sebagai commented on August 15, 2024

Haha

from setup-java.

abelmatos avatar abelmatos commented on August 15, 2024

I'm using the default installed version java 21.
there is a 17 too
https://github.com/actions/runner-images/blob/ubuntu22/20240516.1/images/ubuntu/Ubuntu2204-Readme.md#java
e.g.

        # https://github.com/actions/runner-images/blob/ubuntu22/20240516.1/images/ubuntu/Ubuntu2204-Readme.md#java
      - name: Switch to Java 17
        run: echo "JAVA_HOME=$JAVA_HOME_17_X64" | tee -a $GITHUB_ENV ;  sudo update-java-alternatives --set $JAVA_HOME_17_X64;

Will be cool this action to take advantage of the pre-existent java versions already installed

from setup-java.

oscar-b avatar oscar-b commented on August 15, 2024

We're seeing the same thing on our self hosted runners. Shouldn't it re-use /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 if it's already there? Or do we need to setup a tools cache like Githubs runners? This is all quite poorly documented for us running self hosted runners. Any idea @aparnajyothi-y

from setup-java.

oscar-b avatar oscar-b commented on August 15, 2024

Try specifying java-version: 17.0.11, the action doesn't use the cache if it's not an exact version.

https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L553

from setup-java.

Ivanuil avatar Ivanuil commented on August 15, 2024

Try specifying java-version: 17.0.11, the action doesn't use the cache if it's not an exact version.

That did the trick. Thanks)

from setup-java.

mahabaleshwars avatar mahabaleshwars commented on August 15, 2024

Hello @Ivanuil, I've tried to reproduce the issue but didn't encounter any problems. Here's a screenshot for you to look at. Could you please outline the steps that led to this issue, so I can attempt to recreate it?

Image

from setup-java.

oscar-b avatar oscar-b commented on August 15, 2024

@mahabaleshwars
Your screenshot says: "Java 17 was downloaded"

It should say: "Resolved Java 17.0.11 from tool-cache" when it re-uses the cache.

Look at the code I pointed to above, using "17" as the version will disqualify that dir in _work/_tool/Java_Oracle_jdk. However, if you'd happen to have both 17 and 17.0.1, it will pass the check that it has any caches and 17 will find its directory anyway. The logic there is quite badly implemented.

from setup-java.

mahabaleshwars avatar mahabaleshwars commented on August 15, 2024

Hello @Ivanuil,
If you're using the setup-java action and specify a major version like java-version: 17, the action will try to resolve it to the latest minor version. If a new minor version is released (say 17.0.12), it won't match the cache key for 17.0.11 and the JDK will be downloaded again.
To ensure that the exact version is cached and used across workflows, it's recommended to specify the exact JDK version you want to cache in your workflow file, like java-version: 17.0.11. This way, the cache key will remain consistent across workflow runs.

from setup-java.

oscar-b avatar oscar-b commented on August 15, 2024

Hello @Ivanuil Yeah but that's not how it works in reality, unfortunately. See my comments above.

from setup-java.

LetapF avatar LetapF commented on August 15, 2024

something is downloading every time that i build something

jobs:
  build_android:
    if: "contains(github.event.head_commit.message, 'build-android')"
    name: Build Android
    runs-on: self-hosted
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - name: use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "18.19.1"
      - name: Setup Java
        uses: actions/[email protected]
        with:
          java-version: 17.0.11
          distribution: "oracle"
          check-latest: false
          cache: "gradle"
      - name: Setup Android SDK
        uses: android-actions/setup-android@v3

image

from setup-java.

Ivanuil avatar Ivanuil commented on August 15, 2024

something is downloading every time that i build something

jobs:
  build_android:
    if: "contains(github.event.head_commit.message, 'build-android')"
    name: Build Android
    runs-on: self-hosted
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - name: use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "18.19.1"
      - name: Setup Java
        uses: actions/[email protected]
        with:
          java-version: 17.0.11
          distribution: "oracle"
          check-latest: false
          cache: "gradle"
      - name: Setup Android SDK
        uses: android-actions/setup-android@v3

image

Same for me :( Everything worked as it was supposed to for a month. And a few days ago the action started redownloading something on every run. It also usually fails to download (percentage get stuck at some point) and i have to cancel that run

from setup-java.

Ivanuil avatar Ivanuil commented on August 15, 2024

My job looks like this:

- name: set up JDK 17
        uses: actions/[email protected]
        with:
          distribution: 'oracle'
          java-version: 17.0.11
          check-latest: false
          cache: 'maven'

from setup-java.

mahabaleshwars avatar mahabaleshwars commented on August 15, 2024

Hi @Ivanuil, I've attempted to reproduce the issue but I didn't encounter the problem you described. Could you provide a public repository where the issue is reproducible?

from setup-java.

Ivanuil avatar Ivanuil commented on August 15, 2024

Hi @Ivanuil, I've attempted to reproduce the issue but I didn't encounter the problem you described. Could you provide a public repository where the issue is reproducible?

Sure, repo: https://github.com/Ivanuil/FriendAlertBot
action: https://github.com/Ivanuil/FriendAlertBot/actions/runs/9856712473

from setup-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.