Merge pull request #45889 from nextcloud/fix/noid/cypress-local-changes

This commit is contained in:
John Molakvoæ 2024-06-18 15:11:50 +02:00 committed by GitHub
commit ae4a64b724
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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, {