Skip to content

Commit

Permalink
Fix assemble cache clean order in 16-minimal, 18-minimal
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SlouchyButton authored and phracek committed Nov 4, 2024
1 parent 4e33a03 commit 8248411
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions 16-minimal/s2i/bin/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down
11 changes: 6 additions & 5 deletions 18-minimal/s2i/bin/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down

0 comments on commit 8248411

Please sign in to comment.