From 61dde9642bd3e99b83469123b17ff17c3aec1ecc Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 27 Jan 2026 11:19:12 +0000 Subject: [PATCH] fix: npm cache folder access --- Jenkinsfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 446ab33..22501c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,32 +33,32 @@ pipeline { sh "docker run --rm --volumes-from jenkins -w \$(pwd) static-toolbox '${env.SOURCE_DIR}/**/*.html' --config .htmlhintrc" } } + stage('Lighthouse Audit') { steps { - echo "Running Lighthouse audit..." - // Clean old report and containers + echo "Running Lighthouse audit..." + // Clean old report and prepare reports and npm cache folders sh """ docker run --rm --volumes-from jenkins -w \$(pwd) alpine:latest \ sh -c "rm -rf ./.lighthouseci && mkdir -p ./.lighthouseci && chmod 777 ./.lighthouseci" - """ - sh "docker rm -f lighthouse-audit || true" + # On s'assure que le dossier existe et qu'il est accessible par tous les conteneurs + docker run --rm -v /home/lucas/.npm-cache:/tmp/npm-cache alpine:latest \ + sh -c "mkdir -p /tmp/npm-cache && chmod 777 /tmp/npm-cache" + """ // Run sh """ - docker run --name lighthouse-audit \ + docker run --rm \ --volumes-from jenkins \ -w \$(pwd) \ - -e CHROME_PATH=/usr/bin/chromium-browser \ -v /home/lucas/.npm-cache:/tmp/npm-cache \ -e npm_config_cache=/tmp/npm-cache \ + -e CHROME_PATH=/usr/bin/chromium-browser \ --entrypoint "" \ zenika/alpine-chrome:with-node \ npx --prefer-offline -p @lhci/cli@0.13.0 lhci autorun --config=./.lighthouserc.cjs """ - - // Clean - sh "docker rm -f lighthouse-audit" } }