Summary
This is a feature request for build cache: support specifying a list of environment variable name, and take them into consideration when calculating cache id.
Details
This proposal wants to add a configuration to specify a list of environment variable name, and use them when calculating cache id.
Use case
Running CDN_PREFIX=/a/b rush build --to <app>, it writes cache archive with cache id <cache_id_a>(for example)
Then, running CDN_PREFIX=/c/d rush build --to <app>, it calculates cache id to <cache_id_a> which is same as calculated in the first command, and restores the cache archive, which is wrong.
With specifying "CDN_PREFIX" as one of the environment variables, the cache id of second command will be <cache_id_b>, and the second command can get its own cache archive.
Possible solutions
- Specify it in "common/config/rush/build-cache.json"
{
"cachingEnvVariables": [
"CDN_PREFIX" <-- here
]
}
- Specify it in "/config/rush-project.json"
{
"operationSettings": [
{
"operationName": "build",
"outputFolderNames": [
"dist"
],
"cachingEnvVariables": [
"CDN_PREFIX" <-- here
]
}
]
}
- Specify it in "common/config/rush/command-line.json"
{
"commands": [
{
"name": "build",
// ...
"cachingEnvVariables": [
"CDN_PREFIX" <-- here
]
}
]
}
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question |
Answer |
@microsoft/rush globally installed version? |
latest |
rushVersion from rush.json? |
latest |
useWorkspaces from rush.json? |
true |
| Operating system? |
Mac |
| Would you consider contributing a PR? |
Yes |
Node.js version (node -v)? |
14 |
@elliot-nelson @dmichon-msft
Summary
This is a feature request for build cache: support specifying a list of environment variable name, and take them into consideration when calculating cache id.
Details
This proposal wants to add a configuration to specify a list of environment variable name, and use them when calculating cache id.
Use case
Running
CDN_PREFIX=/a/b rush build --to <app>, it writes cache archive with cache id<cache_id_a>(for example)Then, running
CDN_PREFIX=/c/d rush build --to <app>, it calculates cache id to<cache_id_a>which is same as calculated in the first command, and restores the cache archive, which is wrong.With specifying "CDN_PREFIX" as one of the environment variables, the cache id of second command will be
<cache_id_b>, and the second command can get its own cache archive.Possible solutions
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/rushglobally installed version?rushVersionfrom rush.json?useWorkspacesfrom rush.json?node -v)?@elliot-nelson @dmichon-msft