diff options
Diffstat (limited to 'cypress/dockerNode.ts')
-rw-r--r-- | cypress/dockerNode.ts | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/cypress/dockerNode.ts b/cypress/dockerNode.ts index 861bfb607d9..530a013aa2c 100644 --- a/cypress/dockerNode.ts +++ b/cypress/dockerNode.ts @@ -9,7 +9,9 @@ import Docker from 'dockerode' import waitOn from 'wait-on' import tar from 'tar' +import path from 'path' import { execSync } from 'child_process' +import { existsSync } from 'fs' export const docker = new Docker() @@ -129,7 +131,6 @@ export const configureNextcloud = async function() { */ export const applyChangesToNextcloud = async function() { console.log('\nApply local changes to nextcloud...') - const container = docker.getContainer(CONTAINER_NAME) const htmlPath = '/var/www/html' const folderPaths = [ @@ -151,10 +152,26 @@ export const applyChangesToNextcloud = async function() { './version.php', ] - folderPaths.forEach((path) => { - console.log(`├─ Copying ${path}`) + let needToApplyChanges = false + + folderPaths.forEach((folderPath) => { + const fullPath = path.join(htmlPath, folderPath) + + if (existsSync(fullPath)) { + needToApplyChanges = true + console.log(`├─ Copying ${folderPath}`) + } }) + // Don't try to apply changes, when there are none. Otherwise we + // still execute the 'chown' command, which is not needed. + if (!needToApplyChanges) { + console.log('└─ No local changes found to apply') + return + } + + const container = docker.getContainer(CONTAINER_NAME) + // Tar-streaming the above folders into the container const serverTar = tar.c({ gzip: false }, folderPaths) await container.putArchive(serverTar, { |