Fix Build Structure in Executor
This commit is contained in:
parent
ee2670fcd7
commit
d429aa180f
1 changed files with 8 additions and 13 deletions
|
@ -673,6 +673,10 @@ function runBuildStage(string $buildId, string $projectID): Document
|
||||||
// Check if build has already been run
|
// Check if build has already been run
|
||||||
$build = $database->getDocument('builds', $buildId);
|
$build = $database->getDocument('builds', $buildId);
|
||||||
|
|
||||||
|
|
||||||
|
// Start tracking time
|
||||||
|
$buildStart = \time();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// If we already have a built package ready there is no need to rebuild.
|
// If we already have a built package ready there is no need to rebuild.
|
||||||
if ($build->getAttribute('status') === 'ready' && \file_exists($build->getAttribute('outputPath'))) {
|
if ($build->getAttribute('status') === 'ready' && \file_exists($build->getAttribute('outputPath'))) {
|
||||||
|
@ -728,9 +732,6 @@ function runBuildStage(string $buildId, string $projectID): Document
|
||||||
|
|
||||||
$vars = $build->getAttribute('vars', []);
|
$vars = $build->getAttribute('vars', []);
|
||||||
|
|
||||||
// Start tracking time
|
|
||||||
$buildStart = \time();
|
|
||||||
|
|
||||||
$orchestration
|
$orchestration
|
||||||
->setCpus(App::getEnv('_APP_FUNCTIONS_CPUS', 0))
|
->setCpus(App::getEnv('_APP_FUNCTIONS_CPUS', 0))
|
||||||
->setMemory(App::getEnv('_APP_FUNCTIONS_MEMORY', 256))
|
->setMemory(App::getEnv('_APP_FUNCTIONS_MEMORY', 256))
|
||||||
|
@ -1084,23 +1085,17 @@ App::post('/v1/deployment')
|
||||||
'$id' => $buildId,
|
'$id' => $buildId,
|
||||||
'$read' => (!empty($userId)) ? ['user:' . $userId] : [],
|
'$read' => (!empty($userId)) ? ['user:' . $userId] : [],
|
||||||
'$write' => ['role:all'],
|
'$write' => ['role:all'],
|
||||||
'dateCreated' => time(),
|
'startTime' => time(),
|
||||||
'status' => 'processing',
|
'status' => 'processing',
|
||||||
|
'deploymentId' => $deploymentId,
|
||||||
'runtime' => $function->getAttribute('runtime'),
|
'runtime' => $function->getAttribute('runtime'),
|
||||||
'outputPath' => '',
|
'outputPath' => '',
|
||||||
'source' => $deployment->getAttribute('path'),
|
'source' => $deployment->getAttribute('path'),
|
||||||
'sourceType' => Storage::DEVICE_LOCAL,
|
'sourceType' => Storage::DEVICE_LOCAL,
|
||||||
'stdout' => '',
|
'stdout' => '',
|
||||||
'stderr' => '',
|
'stderr' => '',
|
||||||
'time' => 0,
|
'endTime' => 0,
|
||||||
'vars' => [
|
'duration' => 0
|
||||||
'ENTRYPOINT_NAME' => $deployment->getAttribute('entrypoint'),
|
|
||||||
'APPWRITE_FUNCTION_ID' => $function->getId(),
|
|
||||||
'APPWRITE_FUNCTION_NAME' => $function->getAttribute('name', ''),
|
|
||||||
'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'],
|
|
||||||
'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'],
|
|
||||||
'APPWRITE_FUNCTION_PROJECT_ID' => $projectID,
|
|
||||||
]
|
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$deployment->setAttribute('buildId', $buildId);
|
$deployment->setAttribute('buildId', $buildId);
|
||||||
|
|
Loading…
Reference in a new issue