Fix environment variables during build
This commit is contained in:
parent
18e1420899
commit
f3e97e4133
|
@ -2038,6 +2038,28 @@ $collections = [
|
|||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'endTime',
|
||||
'type' => Database::VAR_INTEGER,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'duration',
|
||||
'type' => Database::VAR_INTEGER,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'deploymentId',
|
||||
'type' => Database::VAR_STRING,
|
||||
|
@ -2104,28 +2126,6 @@ $collections = [
|
|||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'endTime',
|
||||
'type' => Database::VAR_INTEGER,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'duration',
|
||||
'type' => Database::VAR_INTEGER,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'sourceType',
|
||||
'type' => Database::VAR_STRING,
|
||||
|
|
|
@ -730,7 +730,25 @@ function runBuildStage(string $buildId, string $projectID): Document
|
|||
throw new Exception('Code is not readable: ' . $build->getAttribute('source', ''));
|
||||
}
|
||||
|
||||
$vars = $build->getAttribute('vars', []);
|
||||
$deployment = $database->getDocument('deployments', $build->getAttribute('deploymentId', ''));
|
||||
$resourceId = $deployment->getAttribute('resourceId', '');
|
||||
$resourceType = $deployment->getAttribute('resourceType', '');
|
||||
|
||||
if (empty($resourceId)) {
|
||||
throw new Exception('Invalid resource ID on build ' . $build->getId());
|
||||
}
|
||||
|
||||
if (empty($resourceType)) {
|
||||
throw new Exception('Invalid resource type on build' . $build->getId());
|
||||
}
|
||||
|
||||
$resource = $database->getDocument($resourceType, $resourceId);
|
||||
|
||||
if ($resource->isEmpty()) {
|
||||
throw new Exception('Resource not found on build ' . $build->getId());
|
||||
}
|
||||
|
||||
$vars = $resource->getAttribute('vars', []);
|
||||
|
||||
$orchestration
|
||||
->setCpus(App::getEnv('_APP_FUNCTIONS_CPUS', 0))
|
||||
|
|
Loading…
Reference in a new issue