Merge pull request #10571 from appwrite/fix-builds-worker-output-directory

fix(builds-worker): Use outputDirectory attribute from deployment
This commit is contained in:
Luke B. Silver 2025-09-30 15:58:13 +01:00 committed by GitHub
commit e244cb2f02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -686,6 +686,7 @@ class Builds extends Action
if ($version === 'v2') { if ($version === 'v2') {
$command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh'; $command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh';
} else { } else {
$outputDirectory = $deployment->getAttribute('outputDirectory') ?? $resource->getAttribute('outputDirectory');
if ($resource->getCollection() === 'sites') { if ($resource->getCollection() === 'sites') {
$listFilesCommand = ''; $listFilesCommand = '';
@ -693,8 +694,8 @@ class Builds extends Action
$listFilesCommand .= 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; $listFilesCommand .= 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build';
// Enter output directory, if set // Enter output directory, if set
if (!empty($resource->getAttribute('outputDirectory', ''))) { if (!empty($outputDirectory)) {
$listFilesCommand .= ' && cd ' . \escapeshellarg($resource->getAttribute('outputDirectory', '')); $listFilesCommand .= ' && cd ' . \escapeshellarg($outputDirectory);
} }
// Print files, and end separation // Print files, and end separation
@ -725,7 +726,7 @@ class Builds extends Action
destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}", destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}",
variables: $vars, variables: $vars,
command: $command, command: $command,
outputDirectory: $resource->getAttribute('outputDirectory', '') outputDirectory: $outputDirectory ?? ''
); );
Console::log('createRuntime finished'); Console::log('createRuntime finished');