Enhance npm cache clean error handling in Jenkinsfile

Wrapped npm cache clean command in a try-catch block to improve error handling. This ensures that the build process can proceed even if the npm cache clean step fails. Added an informational echo message for better diagnostics in case of failure.
This commit is contained in:
Teriuihi 2024-08-10 03:21:16 +02:00
parent 98b86363f5
commit 2a56144bbc

6
Jenkinsfile vendored
View File

@ -11,7 +11,11 @@ pipeline {
def success = false
// Clean npm cache and try normal install and npm ci once
sh 'npm cache clean --force'
try {
sh 'npm cache clean --force'
} catch (Exception e0) {
echo 'npm cache clean --force failed trying more things'
}
try {
sh 'npm install'
success = true