fix(dependencies): update cache names to use configurations instead of component names for pip, npm, and pnpm

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-02-22 23:15:27 +08:00
parent e53b6b03b5
commit 1ef15f4d97

View File

@ -60,7 +60,7 @@ class DependenciesResolver {
if (cachingEnabled) { if (cachingEnabled) {
steps.dir(this.workspace) { steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', cacheName: "${component.name}-pip-cache", includes: '**/*', path: '.pip-cache', cacheValidityDecidingFile: 'requirements.txt']]) { steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', cacheName: "${configurations.name}-pip-cache", includes: '**/*', path: '.pip-cache', cacheValidityDecidingFile: 'requirements.txt']]) {
steps.sh "pip install --cache-dir .pip-cache -r ${requirementsFile}" steps.sh "pip install --cache-dir .pip-cache -r ${requirementsFile}"
} }
} }
@ -82,7 +82,7 @@ class DependenciesResolver {
if (cachingEnabled) { if (cachingEnabled) {
steps.dir(this.workspace) { steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', cacheName: "${component.name}-npm-cache", includes: '**/*', path: '.npm-cache', cacheValidityDecidingFile: 'package-lock.json']]) { steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', cacheName: "${configurations.name}-npm-cache", includes: '**/*', path: '.npm-cache', cacheValidityDecidingFile: 'package-lock.json']]) {
steps.sh "npm install --cache .npm-cache --prefer-offline --no-audit" steps.sh "npm install --cache .npm-cache --prefer-offline --no-audit"
} }
} }
@ -104,7 +104,7 @@ class DependenciesResolver {
if (cachingEnabled) { if (cachingEnabled) {
steps.dir(this.workspace) { steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', cacheName: "${component.name}-pnpm-cache", path: '.yarn-cache', cacheValidityDecidingFile: 'yarn.lock']]) { steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', cacheName: "${configurations.name}-pnpm-cache", path: '.yarn-cache', cacheValidityDecidingFile: 'yarn.lock']]) {
steps.sh "yarn install --cache-folder .yarn-cache --prefer-offline" steps.sh "yarn install --cache-folder .yarn-cache --prefer-offline"
} }
} }