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

lts/* installs old LTS version intermittently #940

Open
2 of 5 tasks
karlhorky opened this issue Jan 12, 2024 · 19 comments
Open
2 of 5 tasks

lts/* installs old LTS version intermittently #940

karlhorky opened this issue Jan 12, 2024 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@karlhorky
Copy link

karlhorky commented Jan 12, 2024

Description:

Using the following configuration installs Node.js 20.10.0, an old version. Node.js 20.11.0 has been out since 10 Jan 2024.

      - uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          check-latest: true

The output looks like this:

Run actions/setup-node@v4
  with:
    node-version: lts/*
    always-auth: false
    check-latest: true
    token: ***
Attempt to resolve LTS alias from manifest...
Found in cache @ /opt/hostedtoolcache/node/20.10.0/x64
Environment details
  node: v20.10.0
  npm: 10.2.3
  yarn: 1.22.21

Action version:

actions/setup-node@v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Node.js lts/*

  node: v20.10.0
  npm: 10.2.3
  yarn: 1.22.21

Repro steps:

Use the configuration above and observe the output above

Expected behavior:

Node.js latest LTS (20.11.0) is installed

Actual behavior:

Node.js older LTS (20.10.0) is installed

cc @MaksimZhukov @dmitry-shibanov @dusan-trickovic

@karlhorky karlhorky added bug Something isn't working needs triage labels Jan 12, 2024
@karlhorky karlhorky changed the title Node.js 20.11.0 not installing with lts/* lts/* installs old LTS version Jan 12, 2024
@karlhorky
Copy link
Author

karlhorky commented Jan 12, 2024

Looks like the manifest might be here (maybe this should be linked in the output of actions/setup-node for easier debugging, if this will continue to be potentially problematic in future?):

https://www.github.com/actions/node-versions/blob/main/versions-manifest.json

I opened a PR there as well, in case that's a better place to discuss:

@HarithaVattikuti
Copy link
Contributor

Hello @karlhorky
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

@HarithaVattikuti
Copy link
Contributor

Hello @karlhorky
The latest version 20.11.0 is merged in node-versions repository. Could you please confirm if the latest version is reflecting at your end.
If you have any concerns please feel free to ping us.

@karlhorky
Copy link
Author

@HarithaVattikuti I just tried re-running my job and it's still on Node.js 20.10.0

Attempt to resolve LTS alias from manifest...
Found in cache @ /opt/hostedtoolcache/node/20.10.0/x64

@karlhorky
Copy link
Author

Is there any way I can manually clear the manifest cache on GitHub Actions?

I know that you can clear other named caches, but these are unrelated to the manifest cache, from what I can tell.

@HarithaVattikuti
Copy link
Contributor

Hello karlhorky, We have tried to reproduce the issue and unable to do so. Below is the screenshot of the same.

Screenshot 2024-01-25 at 4 28 52 PM

Please share a sample repo with minimum code to reproduce the issue.
Feel free to reach out to us in case of any issues

@karlhorky
Copy link
Author

karlhorky commented Jan 26, 2024

@HarithaVattikuti now it's working, thanks!

Attempt to resolve LTS alias from manifest...
Found in cache @ /opt/hostedtoolcache/node/20.11.0/x64

Maybe I tried it before the change was fully rolled out.

Closing.

@karlhorky
Copy link
Author

karlhorky commented Jan 26, 2024

Interesting, this is still intermittently failing on some of our repositories (with a macos-12 or macos-13 runner):

Attempt to resolve LTS alias from manifest...
Found in cache @ /Users/runner/hostedtoolcache/node/20.10.0/x64

https://github.com/upleveled/hotline-bling-codealong/actions/runs/7667389682/job/20897108024?pr=164


@HarithaVattikuti maybe there's a problem with the caches?

Reopening for visibility.

@karlhorky karlhorky reopened this Jan 26, 2024
@karlhorky karlhorky changed the title lts/* installs old LTS version lts/* installs old LTS version intermittently Jan 26, 2024
@HarithaVattikuti
Copy link
Contributor

Hello @karlhorky,
According to your repository set up-node is run on different OS. The hostedtoolcache will reflect the latest node version from the OS image. For Ex: In MacOS-12 Image Cached Tool of node is 20.11.0 but in MacOS-13 Image cached Tool of node is still 20.10.0.
https://github.com/actions/runner-images/blob/macOS-12/20240119.1/images/macos/macos-13-Readme.md#cached-tools
https://github.com/actions/runner-images/blob/macOS-12/20240119.1/images/macos/macos-12-Readme.md#cached-tools
Please use the related OS image for latest node version 20.11.0.
Closing this issue as it is not part of our scope.
Feel Free to reach out to us in case of any issues.

@karlhorky
Copy link
Author

Oh wow, that's a surprising detail 🤔

To me, it seems like Node.js lts/* should be the latest Node.js LTS, not an older cached version.

If it would be possible to fix that and return the latest LTS, I'm sure that would be widely appreciated and reduce confusion.

@karlhorky
Copy link
Author

Update: this continues to be a problem with Node.js v20.12.0 - the lts/* specifier does not install 20.12.0, which has been out for over 5 days now:

      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          cache: 'pnpm'

Logs for the workflow run:

Run actions/setup-node@v4
  
Attempt to resolve LTS alias from manifest...
Found in cache @ /opt/hostedtoolcache/node/20.11.1/x64
Environment details
/home/runner/setup-pnpm/node_modules/.bin/pnpm store path --silent
/home/runner/setup-pnpm/node_modules/.bin/store/v3
Received 0 of 177801572 (0.0%), 0.0 MBs/sec
Received 125829120 of 177801572 (70.8%), 60.0 MBs/sec
Cache Size: ~170 MB (177801572 B)
/usr/bin/tar -xf /home/runner/work/_temp/36665e6f-3c08-4aa9-a645-44132e6[14](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8507621988/job/23299779905?pr=152#step:7:14)367/cache.tzst -P -C /home/runner/work/preflight-test-project-next-js-passing/preflight-test-project-next-js-passing --use-compress-program unzstd
Received 17780[15](https://github.com/upleveled/preflight-test-project-next-js-passing/actions/runs/8507621988/job/23299779905?pr=152#step:7:16)72 of 177801572 (100.0%), 56.5 MBs/sec
Cache restored successfully
Cache restored from key: node-cache-Linux-pnpm-4ef79db9b37b4913d3034ac221942fa51b304d30abec481a5894d6356c04e3e6

@karlhorky
Copy link
Author

@HarithaVattikuti can you reopen this issue please?

Or if not, I'll create a new issue.

@aparnajyothi-y aparnajyothi-y self-assigned this Apr 2, 2024
@karlhorky
Copy link
Author

@aparnajyothi-y if you are taking this over, could you reopen this issue?

@aparnajyothi-y
Copy link
Contributor

Hello @karlhorky, I have tried to run the same job to use lts* in my local and it is downloading the latest version 20.12.0.
If a previous LTS version was cached in the runner, actions/setup-node might reuse the cached version instead of fetching the latest one. As a workaround, we need to explicitly setting the cache input to 'none' in the actions/setup-node step of your job. This will prevent actions/setup-node from using a cached version of Node.js.
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'none'

If we want to keep the caching but ensure that always using the latest LTS version then add a step to your workflow that updates Node.js to the latest LTS version after setting it up

    - name: Setup Node.js
              uses: actions/setup-node@v4
              with:
                  node-version: 'lts/*'

   - name: Update to latest LTS version
      run: |
        npm install -g n
        sudo n lts
        echo ""NODE_PATH=$(npm root --quiet -g)"" >> $GITHUB_ENV.

@aparnajyothi-y aparnajyothi-y reopened this Apr 3, 2024
@karlhorky
Copy link
Author

karlhorky commented Apr 3, 2024

@aparnajyothi-y what I think should be supported (and what I believe would be the behavior that users would expect and want):

  1. lts/* retrieves the latest Node.js LTS version
  2. The cache is used when it is available
  3. The cache is evicted *without user intervention* when any new LTS version is released (from my understanding, this seems like the area where setup-node or its dependencies/infrastructure could be fixed)
  4. No additional configuration such as cache: 'none' is required (also, cache: 'none' is invalid, unrelated configuration)
  5. No additional obscure steps (such as installing a Node.js version manager) are required

@aparnajyothi-y
Copy link
Contributor

Hello @karlhorky, We have furthermore investigated and found that the action itself doesn't control the cache, it's managed by the runner environment. Automatic cache eviction may need changes on the runner's side as setup-node uses the caching facilities provided by the runner environment, you can refer here. Automatic cache eviction is a potential feature where old or unused cached dependencies would be automatically removed. This ensures that the cache does not keep growing indefinitely and consume all available storage.
Using cache when available is actually a part of the Setup-action's functionality. The action will check if the required Node.js version is in the cache and use it if it's available. By caching these dependencies, subsequent runs of the workflow can be faster as they can reuse the cached dependencies instead of downloading them again.
Please let us know in case of any further clarification.

@karlhorky
Copy link
Author

I'm not sure I'm understanding what you're saying, but maybe you're saying this bug should be also reported somewhere else?

Where exactly can this be reported also for the runners so that the behavior is automatic cache evictions (or cache upgrades) on new LTS versions?

I and others think that the current behavior is broken, so it should be fixed.

I assume it may not be the runner's responsibility to know about new LTS versions of Node.js (that seems like responsibility of actions/setup-node) - it may actually be a split responsibility: both actions/setup-node and also in the runner environments:

  1. To me, it seems that logically, the place that would be related to "performing some action when a new LTS version is released" would be actions/setup-node (this current repo)
  2. But in this case, the action needs to evict the cache, where you mentioned the management is the responsibility of the runner

So, if this mental model is correct, there may need to be a "cache eviction API" exposed by the runner, in order for actions/setup-node to be able to evict the cache on new LTS versions.

@aparnajyothi-y
Copy link
Contributor

Hello @karlhorky, As we have mentioned in the above comment, this feature might be shared between the actions/setup-node and the GitHub Actions runner. The actions/setup-node should ideally handle actions related to the release of new LTS versions, while cache management is typically handled by the runner.
If we got ""cache eviction API"" support in the runner, that would allow actions like actions/setup-node to evict the cache when new LTS versions are released, ensuring that the cache is always up-to-date.
Please let us know in case of any clarification is needed from setup-node. Thank you.

@karlhorky
Copy link
Author

karlhorky commented Apr 18, 2024

Ok great, are you a part of the GitHub Actions team?

Can you reach out to someone internally on the runner side to convey the need for a Cache Eviction API to allow for the actions/setup-node LTS version identifier lts/* to use the latest LTS release without user interaction?

I see that the following people are maintainers / contributors on the public GitHub repos, but I have no visibility / connections beyond that:

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

No branches or pull requests

4 participants
@karlhorky @HarithaVattikuti @aparnajyothi-y and others