openvidu-test-e2e: improve storeFolderInCache

pull/672/head
pabloFuente 2021-11-18 19:22:32 +01:00
parent 7f24241bc4
commit 2b6752fd73
1 changed files with 12 additions and 6 deletions

View File

@ -146,12 +146,18 @@ def removeStrandedContainers(removeTestingContainers) {
} }
def storeFolderInCache(folderToStore, cacheDestiny) { def storeFolderInCache(folderToStore, cacheDestiny) {
if (fileExists(folderToStore)) { script {
println('Storing in cache') env.folderToStore = folderToStore
sh "sudo mkdir -p ${cacheDestiny}" env.cacheDestiny = cacheDestiny
sh "sudo mv ${folderToStore}/* ${cacheDestiny}" sh(script: '''#!/bin/bash -xe
} else { if [[ (-d ${folderToStore}) && ("$(ls -A ${folderToStore})") ]]; then
println('Folder to store in cache does not exist') echo "Storing in cache"
sudo mkdir -p ${cacheDestiny}
sudo mv ${folderToStore}/* ${cacheDestiny}
else
echo "Folder to store in cache does not exist or is empty"
fi
'''.stripIndent())
} }
} }