mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
feat(builds): log user build command in deployment build logs
When a Site or Function build command references an environment variable (e.g. `flutter build web --dart-define=KEY=$GOOGLE_MAPS_API_KEY`) and the variable is misspelled or unset, bash silently expands it to an empty string. Build logs previously did not surface the build command, so users had no signal that the expansion was happening. Echo the unexpanded, user-typed `buildCommands` value at the top of the build log. `$` is escaped to `\$` before `escapeshellarg` so the outer bash wrapper does not expand variables in the log line, and the user sees exactly what they typed (e.g. `$GOOGLE_MAPS_API_KEY`). Empty `buildCommands` is skipped (no log line). Applies uniformly to Sites and Functions, since both flow through the same build worker path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
4a44af7308
commit
1e48c56d63
@@ -719,7 +719,14 @@ class Builds extends Action
|
||||
}
|
||||
}
|
||||
|
||||
$command = 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh ' . \trim(\escapeshellarg($command));
|
||||
$userBuildCommand = $deployment->getAttribute('buildCommands', '');
|
||||
$logCommand = '';
|
||||
if (! empty($userBuildCommand)) {
|
||||
$escapedForLog = \str_replace('$', '\\$', $userBuildCommand);
|
||||
$logCommand = 'echo ' . \escapeshellarg('Build command: ' . $escapedForLog) . ' && ';
|
||||
}
|
||||
|
||||
$command = $logCommand . 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh ' . \trim(\escapeshellarg($command));
|
||||
}
|
||||
|
||||
$response = $executor->createRuntime(
|
||||
|
||||
Reference in New Issue
Block a user