From 824841197a770935660c281ecd3b73ce62f587f9 Mon Sep 17 00:00:00 2001 From: Ales Nezbeda Date: Fri, 18 Oct 2024 16:05:00 +0200 Subject: [PATCH] Fix assemble cache clean order in 16-minimal, 18-minimal Removal of the cache has to be the last things done in the assemble script. Calling `npm` after deleting the cache folder will cause npm to recreate it - which will fail during the image test. --- 16-minimal/s2i/bin/assemble | 11 ++++++----- 18-minimal/s2i/bin/assemble | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/16-minimal/s2i/bin/assemble b/16-minimal/s2i/bin/assemble index b0446ef1..a5767210 100755 --- a/16-minimal/s2i/bin/assemble +++ b/16-minimal/s2i/bin/assemble @@ -96,6 +96,12 @@ else npm prune # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + NPM_CACHE=$(npm config get cache) if ! mountpoint $NPM_CACHE; then echo "---> Cleaning the npm cache $NPM_CACHE" @@ -104,11 +110,6 @@ else # We do not want to delete .npmrc file. rm -rf "${NPM_CACHE:?}/" fi - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi fi diff --git a/18-minimal/s2i/bin/assemble b/18-minimal/s2i/bin/assemble index b0446ef1..a5767210 100755 --- a/18-minimal/s2i/bin/assemble +++ b/18-minimal/s2i/bin/assemble @@ -96,6 +96,12 @@ else npm prune # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + NPM_CACHE=$(npm config get cache) if ! mountpoint $NPM_CACHE; then echo "---> Cleaning the npm cache $NPM_CACHE" @@ -104,11 +110,6 @@ else # We do not want to delete .npmrc file. rm -rf "${NPM_CACHE:?}/" fi - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi fi