actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.37k stars 1.16k forks source link

Cache Step not honouring `GITHUB_ACTIONS_RUNNER_FORCED_NODE_VERSION=node16` #1258

Closed PatrickMilroy closed 2 months ago

PatrickMilroy commented 9 months ago

With the release of Runner v2.310.0 https://github.com/actions/runner/releases/tag/v2.310.0, the default version of Node to use has been changed use node20

Update default version to node20 by @takost in https://github.com/actions/runner/pull/2844

We are using self-hosted runners, running Amazon Linux 2. This changed resulted in the following error in the Github runner service not starting correctly with the following error

<13>Oct  9 23:40:03 user-data: Oct 09 23:40:03 ip-10-0-21-13.us-west-2.compute.internal runsvc.sh[11016]: ./externals/node20/bin/node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by ./externals/node20/bin/node)
<13>Oct  9 23:40:03 user-data: Oct 09 23:40:03 ip-10-0-21-13.us-west-2.compute.internal runsvc.sh[11016]: ./externals/node20/bin/node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by ./externals/node20/bin/node)

To get around this, we set the env var GITHUB_ACTIONS_RUNNER_FORCED_NODE_VERSION=node16 which allowed the service to start correctly and GitHub actions to be able to run correctly.

However, in jobs where we using actions/cache@v3 to cache node modules, we are receiving the following error:

2023-10-10T08:34:48.3722137Z ##[error]The template is not valid. /opt/actions-runner/_work/news-mono/news-mono/./.github/actions/yarn-install/action.yml (Line: 104, Col: 14): hashFiles('**/yarn.lock') failed. Fail to hash files under directory '/opt/actions-runner/_work/news-mono/news-mono'

Further inspection of the debug log seems to suggest that it is using the default node version i.e 20

2023-10-10T08:34:48.3583849Z ##[debug]Search root directory: '/opt/actions-runner/_work/news-mono/news-mono'
2023-10-10T08:34:48.3584294Z ##[debug]Search pattern: '**/yarn.lock'
2023-10-10T08:34:48.3586306Z ##[debug]Starting process:
2023-10-10T08:34:48.3586679Z ##[debug]  File name: '/opt/actions-runner/externals/node20/bin/node'
2023-10-10T08:34:48.3587057Z ##[debug]  Arguments: '"/opt/actions-runner/bin/hashFiles"'
2023-10-10T08:34:48.3587446Z ##[debug]  Working directory: '/opt/actions-runner/_work/news-mono/news-mono'
2023-10-10T08:34:48.3587816Z ##[debug]  Require exit code zero: 'False'
2023-10-10T08:34:48.3588117Z ##[debug]  Encoding web name:  ; code page: ''
2023-10-10T08:34:48.3588445Z ##[debug]  Force kill process on cancellation: 'False'
2023-10-10T08:34:48.3588760Z ##[debug]  Redirected STDIN: 'False'
2023-10-10T08:34:48.3589062Z ##[debug]  Persist current code page: 'False'
2023-10-10T08:34:48.3589381Z ##[debug]  Keep redirected STDIN open: 'False'
2023-10-10T08:34:48.3589696Z ##[debug]  High priority process: 'False'
2023-10-10T08:34:48.3592848Z ##[debug]Updated oom_score_adj to 500 for PID: 4784.
2023-10-10T08:34:48.3593517Z ##[debug]Process started with process id 4784, waiting for process exit.
2023-10-10T08:34:48.3595633Z ##[debug]STDOUT/STDERR stream read finished.
2023-10-10T08:34:48.3597248Z ##[debug]STDOUT/STDERR stream read finished.
2023-10-10T08:34:48.3598318Z ##[debug]/opt/actions-runner/externals/node20/bin/node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/actions-runner/externals/node20/bin/node)
2023-10-10T08:34:48.3599291Z ##[debug]/opt/actions-runner/externals/node20/bin/node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /opt/actions-runner/externals/node20/bin/node)
2023-10-10T08:34:48.3600275Z ##[debug]Finished process 4784 with exit code 1, and elapsed time 00:00:00.0010039.
2023-10-10T08:34:48.3614999Z ##[debug]/opt/actions-runner/_work/news-mono/news-mono/./.github/actions/yarn-install/action.yml (Line: 104, Col: 14):
2023-10-10T08:34:48.3616014Z ##[debug]Evaluating: format('{0}-{1}-build-{2}-
2023-10-10T08:34:48.3616336Z ##[debug]', runner.os, env.os_id, env.cache-name)
2023-10-10T08:34:48.3616621Z ##[debug]Evaluating format:
2023-10-10T08:34:48.3616885Z ##[debug]..Evaluating String:
2023-10-10T08:34:48.3617154Z ##[debug]..=> '{0}-{1}-build-{2}-
2023-10-10T08:34:48.3617377Z ##[debug]'
2023-10-10T08:34:48.3617649Z ##[debug]..Evaluating Index:
2023-10-10T08:34:48.3617911Z ##[debug]....Evaluating runner:
2023-10-10T08:34:48.3618167Z ##[debug]....=> Object
2023-10-10T08:34:48.3618550Z ##[debug]....Evaluating String:
2023-10-10T08:34:48.3618786Z ##[debug]....=> 'os'
2023-10-10T08:34:48.3619088Z ##[debug]..=> 'Linux'
2023-10-10T08:34:48.3619345Z ##[debug]..Evaluating Index:
2023-10-10T08:34:48.3619604Z ##[debug]....Evaluating env:
2023-10-10T08:34:48.3619851Z ##[debug]....=> Object
2023-10-10T08:34:48.3620099Z ##[debug]....Evaluating String:
2023-10-10T08:34:48.3620344Z ##[debug]....=> 'os_id'
2023-10-10T08:34:48.3620569Z ##[debug]..=> 'amzn-2'
2023-10-10T08:34:48.3620823Z ##[debug]..Evaluating Index:
2023-10-10T08:34:48.3621075Z ##[debug]....Evaluating env:
2023-10-10T08:34:48.3621318Z ##[debug]....=> Object
2023-10-10T08:34:48.3621563Z ##[debug]....Evaluating String:
2023-10-10T08:34:48.3621819Z ##[debug]....=> 'cache-name'
2023-10-10T08:34:48.3622098Z ##[debug]..=> 'cache-2023.3-node-modules'
2023-10-10T08:34:48.3622464Z ##[debug]=> 'Linux-amzn-2-build-cache-2023.3-node-modules-
2023-10-10T08:34:48.3622745Z ##[debug]'
2023-10-10T08:34:48.3623070Z ##[debug]Result: 'Linux-amzn-2-build-cache-2023.3-node-modules-
2023-10-10T08:34:48.3623371Z ##[debug]'
2023-10-10T08:34:48.3722137Z ##[error]The template is not valid. /opt/actions-runner/_work/news-mono/news-mono/./.github/actions/yarn-install/action.yml (Line: 104, Col: 14): hashFiles('**/yarn.lock') failed. Fail to hash files under directory '/opt/actions-runner/_work/news-mono/news-mono'
2023-10-10T08:34:48.3724810Z ##[debug]GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid. /opt/actions-runner/_work/news-mono/news-mono/./.github/actions/yarn-install/action.yml (Line: 104, Col: 14): hashFiles('**/yarn.lock') failed. Fail to hash files under directory '/opt/actions-runner/_work/news-mono/news-mono'
2023-10-10T08:34:48.3725822Z ##[debug]   at GitHub.DistributedTask.ObjectTemplating.TemplateValidationErrors.Check()
2023-10-10T08:34:48.3726887Z ##[debug]   at GitHub.DistributedTask.Pipelines.ObjectTemplating.PipelineTemplateEvaluator.EvaluateStepInputs(TemplateToken token, DictionaryContextData contextData, IList`1 expressionFunctions)
2023-10-10T08:34:48.3727727Z ##[debug]   at GitHub.Runner.Worker.ActionRunner.RunAsync()
2023-10-10T08:34:48.3728272Z ##[debug]   at GitHub.Runner.Worker.Handlers.CompositeActionHandler.RunStepAsync(IStep step)

Is there anyway to get the cache action to use a specific version of node, or to honour the node version used by the Actions runner service?

Aplogies if this is not the right place to raise this, was not sure if this belonged here or in the runner repo šŸ™šŸ»

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

github-actions[bot] commented 2 months ago

This issue was closed because it has been inactive for 5 days since being marked as stale.