From 1c9beb8622b052f4897ecb1946be0a787fb12735 Mon Sep 17 00:00:00 2001 From: zhenyus Date: Tue, 25 Feb 2025 03:08:06 +0800 Subject: [PATCH] fix(pipeline): update cache paths for npm, yarn, and pnpm installations to use /tmp directory Signed-off-by: zhenyus --- .../freeleaps/devops/DependenciesResolver.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/first-class-pipeline/src/com/freeleaps/devops/DependenciesResolver.groovy b/first-class-pipeline/src/com/freeleaps/devops/DependenciesResolver.groovy index 079a576c..4d9d8bc4 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/DependenciesResolver.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/DependenciesResolver.groovy @@ -85,9 +85,9 @@ class DependenciesResolver { if (cachingEnabled) { steps.dir(this.workspace) { - steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: ".${configurations.name}-npm-cache", cacheValidityDecidingFile: 'package-lock.json']]) { - steps.sh "mkdir -p .${configurations.name}-npm-cache" - steps.sh "npm install --cache .${configurations.name}-npm-cache --prefer-offline --no-audit" + steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: "/tmp/.${configurations.name}-npm-cache", cacheValidityDecidingFile: 'package-lock.json']]) { + steps.sh "mkdir -p /tmp/.${configurations.name}-npm-cache" + steps.sh "npm install --cache /tmp/.${configurations.name}-npm-cache --prefer-offline --no-audit" } } } else { @@ -111,9 +111,9 @@ class DependenciesResolver { if (cachingEnabled) { steps.dir(this.workspace) { - steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: ".${configurations.name}-yarn-cache", cacheValidityDecidingFile: 'yarn.lock']]) { - steps.sh "mkdir -p ${configurations.name}-pnpm-cache" - steps.sh "yarn install --cache-folder ${configurations.name}-pnpm-cache --prefer-offline" + steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: "/tmp/.${configurations.name}-yarn-cache", cacheValidityDecidingFile: 'yarn.lock']]) { + steps.sh "mkdir -p /tmp/.${configurations.name}-pnpm-cache" + steps.sh "yarn install --cache-folder /tmp/.${configurations.name}-pnpm-cache --prefer-offline" } } } else { @@ -137,9 +137,9 @@ class DependenciesResolver { if (cachingEnabled) { steps.dir(this.workspace) { - steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: ".${configurations.name}-pnpm-cache", cacheValidityDecidingFile: 'pnpm-lock.yaml']]) { + steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: "/tmp/.${configurations.name}-pnpm-cache", cacheValidityDecidingFile: 'pnpm-lock.yaml']]) { steps.sh "mkdir -p ${configurations.name}-pnpm-cache" - steps.sh "pnpm install --store-dir ${configurations.name}-pnpm-cache --prefer-offline" + steps.sh "pnpm install --store-dir /tmp/.${configurations.name}-pnpm-cache --prefer-offline" } } } else {