Skip to content

Commit 8248411

Browse files
SlouchyButtonphracek
authored andcommitted
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.
1 parent 4e33a03 commit 8248411

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

16-minimal/s2i/bin/assemble

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ else
9696
npm prune
9797

9898
# Clear the npm's cache and tmp directories only if they are not a docker volumes
99+
NPM_TMP=$(npm config get tmp)
100+
if ! mountpoint $NPM_TMP; then
101+
echo "---> Cleaning the $NPM_TMP/npm-*"
102+
rm -rf $NPM_TMP/npm-*
103+
fi
104+
99105
NPM_CACHE=$(npm config get cache)
100106
if ! mountpoint $NPM_CACHE; then
101107
echo "---> Cleaning the npm cache $NPM_CACHE"
@@ -104,11 +110,6 @@ else
104110
# We do not want to delete .npmrc file.
105111
rm -rf "${NPM_CACHE:?}/"
106112
fi
107-
NPM_TMP=$(npm config get tmp)
108-
if ! mountpoint $NPM_TMP; then
109-
echo "---> Cleaning the $NPM_TMP/npm-*"
110-
rm -rf $NPM_TMP/npm-*
111-
fi
112113

113114
fi
114115

18-minimal/s2i/bin/assemble

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ else
9696
npm prune
9797

9898
# Clear the npm's cache and tmp directories only if they are not a docker volumes
99+
NPM_TMP=$(npm config get tmp)
100+
if ! mountpoint $NPM_TMP; then
101+
echo "---> Cleaning the $NPM_TMP/npm-*"
102+
rm -rf $NPM_TMP/npm-*
103+
fi
104+
99105
NPM_CACHE=$(npm config get cache)
100106
if ! mountpoint $NPM_CACHE; then
101107
echo "---> Cleaning the npm cache $NPM_CACHE"
@@ -104,11 +110,6 @@ else
104110
# We do not want to delete .npmrc file.
105111
rm -rf "${NPM_CACHE:?}/"
106112
fi
107-
NPM_TMP=$(npm config get tmp)
108-
if ! mountpoint $NPM_TMP; then
109-
echo "---> Cleaning the $NPM_TMP/npm-*"
110-
rm -rf $NPM_TMP/npm-*
111-
fi
112113

113114
fi
114115

0 commit comments

Comments
 (0)