-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Windows] use npm config
instead of npm_config_cache
#2153
Conversation
The `npm_config_cache` env, if set, will have highest priority, and harder to change. One way to un-set this is add a global workflow env, like: ``` env: npm_config_cache: '' ``` This commit change the cache config to use `npm config set cache $CachePath --global`, which should save the path under the global npmrc at: `C:\npm\prefix\etc\npmrc`, and allow easier later reset with user/repo level `.npmrc` files. For the record, my usage is to unify all platform's npm cache to `~/.npm/`, then use the same cache action config on all platform to cache the folder.
Please make sure this doesn't regress #1566 |
Also on why preset env is better removed: 5412 | │ │ ├─ C:\actions\runner-provisioner-Windows\provisioner.exe --agentdirectory c:...\settings\.cache (+30)
1416 | │ │ │ ├─ "c:\runners\2.274.2\bin\Runner.Listener.exe" run
3292 | │ │ │ │ └─ "c:\runners\2.274.2\bin\Runner.Worker.exe" spawnclient 1864 1876
2080 | │ │ │ │ ├─ \??\C:\windows\system32\conhost.exe 0x4
- 4656 | │ │ │ │ └─ "C:\Program Files\PowerShell\7\pwsh.EXE" -command ". 'D:\a\_temp...dfc0606bba.ps1'" (+27)
- 7152 | │ │ │ │ └─ C:\windows\system32\cmd.exe /c ""C:\hostedtoolcache\windows\n...dev.7 --ps tree" (+43)
- 6448 | │ │ │ │ └─ "C:\hostedtoolcache\windows\node\14.15.0\x64\\node.exe" "...-dev.7 --ps tree (+95)
- 5788 | │ │ │ │ └─ WMIC PROCESS get Commandline,ParentProcessId,Processid
+ 4888 | │ │ │ │ └─ "C:\Program Files\PowerShell\7\pwsh.EXE" -command ". 'D:\a\_temp...5220dee320.ps1'" (+27)
+ 5444 | │ │ │ │ └─ C:\windows\system32\cmd.exe /c ""C:\hostedtoolcache\windows\n...dev.7 --ps tree" (+43)
+ 4328 | │ │ │ │ └─ "C:\hostedtoolcache\windows\node\14.15.0\x64\\node.exe" "...-dev.7 --ps tree (+95)
+ 896 | │ │ │ │ └─ WMIC PROCESS get Commandline,ParentProcessId,Processid You'll see the same So the problem with changing the env is:
To change the "snapshot" env hold by the worker (for all step of all job) can only be done with the workflow env config, And with current workflow syntax, I don't see how to set persisting dynamically calculated env in one step, and be able to use that in follow up steps. So I'd suggest use conf files instead of env for persisting global settings. |
notable change: - ci: cache: wait for: actions/runner-images#2153 - add: ci: `.github/ci-patch.js` for doing ci patch in one place - ci & script sort - package update
/azp run windows2016, windows2019 |
Azure Pipelines successfully started running 2 pipeline(s). |
That's some long builds! Not sure how to test the build result, but I think a few check should pass:
NOTE: the command
|
notable change: - deprecate: `fileProcessorWebpack` - temp-fix: ci: wait for npm/cli#2411 - temp-fix: ci: cache: wait for: actions/runner-images#2153 - fix: use `@dr-js/core@0.4.3-dev.1` with fix for nodejs@15.5 caused responder send noop - fix: output: log git diff in git status check - fix: test: treat `before|after` the same as `it` - add: `copyAfterEdit` to `node/file` - add: bin: `is-hash-changed` to `cache-step` - add: ci: `.github/ci-patch.js` for doing ci patch in one place - node: use `getToggle` for `Preset.Toggle` - bin: suppot `checksum-file-only` for `cache-step` - bin: sort babel resolve path & test - bin: sort `cache-step` options - ci & script sort - package update
Description
This commit change the way to set npm cache path from env to config file on Windows runners.
The
npm_config_cache
env, if set, will have highest priority, and harder to change.One way to un-set this is add a global workflow env, like:
This commit change the cache config to use
npm config set cache $CachePath --global
,which should save the path under the global npmrc at:
C:\npm\prefix\etc\npmrc
,and allow easier later reset with user/repo level
.npmrc
files.For the record, my usage is to unify all platform's npm cache to
~/.npm/
,then use the same cache action config on all platform to cache the folder.
Related issue:
Check list