mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
fix(cypress): Check for local changes before trying to apply them
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
parent
8359b806f4
commit
a5ba81a250
1 changed files with 20 additions and 3 deletions
|
|
@ -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, {
|
||||
|
|
|
|||
Loading…
Reference in a new issue