Merge pull request #11 in TEA/dafa-web-monorepo from ekegu/Jenkinsfile-npm-cache-fix to develop

* commit '1c18b46fa22b4b64487414a760a05600056c4958':
  Jenkinsfile edited online with Bitbucket
This commit is contained in:
Gustav Ek
2021-05-06 10:17:50 +02:00

View File

@@ -65,11 +65,9 @@ pipeline {
# Try to get the file from cache
cp ${CACHE_DIRECTORY}/$(cat hashed.pkg-lock) node_modules.tar.gz 2> /dev/null
# Check if we found the cached node_modules
test -f node_modules.tar.gz
# If we found the cached node_modules, extract the files to node_modules
tar -zxf node_modules.tar.gz
(test -f node_modules.tar.gz && tar -zxf node_modules.tar.gz && echo "Using cached node_modules from ${CACHE_DIRECTORY}/$(cat hashed.pkg-lock)") || echo "No cached node_modules.tar.gz found"
# Echo to the logs stating that we are using cache
echo "Using cached node_modules from ${CACHE_DIRECTORY}/$(cat hashed.pkg-lock)"
) || true
# If we did not find the cached node_modules, install from the lock