aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorMarcel Müller <marcel-mueller@gmx.de>2024-06-15 20:19:05 +0200
committerMarcel Müller <marcel-mueller@gmx.de>2024-06-15 20:19:05 +0200
commita5ba81a25030cea96cc5d12fbb164a6378bdd868 (patch)
tree97156dfcde19815bcdeb3d493768058f651ae8de /cypress
parent8359b806f4fdc6ca7270c38744684de8ef830174 (diff)
downloadnextcloud-server-a5ba81a25030cea96cc5d12fbb164a6378bdd868.tar.gz
nextcloud-server-a5ba81a25030cea96cc5d12fbb164a6378bdd868.zip
fix(cypress): Check for local changes before trying to apply them
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/dockerNode.ts23
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, {