Fix orchestrator site detection timing

This commit is contained in:
Chirag Aggarwal
2026-05-25 08:33:48 +05:30
parent ca7acc8a47
commit e4b6d47c3a
@@ -1354,6 +1354,23 @@ class Builds extends Action
$projectQuery = 'project=' . \rawurlencode($project->getId());
$appwriteProjectHeader = ['X-Appwrite-Project' => $project->getId()];
if ($version !== 'v2' && $resource->getCollection() === 'sites') {
$listFilesCommand = '';
$listFilesCommand .= 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build';
if (! empty($outputDirectory)) {
$listFilesCommand .= ' && cd ' . \escapeshellarg($outputDirectory);
}
$listFilesCommand .= ' && find . -name \'node_modules\' -prune -o -type f -print && echo "{APPWRITE_DETECTION_SEPARATOR_END}"';
if (empty($command)) {
$command = $listFilesCommand;
} else {
$command .= ' && ' . $listFilesCommand;
}
}
if ($version === 'v2') {
$buildCommand = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh';
} else {
@@ -1376,11 +1393,6 @@ class Builds extends Action
. " mkdir -p /tmp/build-output && cp -R {$escapedOutputPath}/. /tmp/build-output/;"
. " else echo {$escapedOutputDirectoryError} >&2; exit 1; fi";
}
} elseif ($resource->getCollection() === 'sites') {
$buildCommand .= ' && echo "{APPWRITE_DETECTION_SEPARATOR_START}"'
. " && cd {$escapedOutputPath}"
. ' && find . -name \'node_modules\' -prune -o -type f -print'
. ' && echo "{APPWRITE_DETECTION_SEPARATOR_END}"';
}
if ($version !== 'v2') {