1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Fix environment variables during build

This commit is contained in:
Bradley Schofield 2022-01-26 10:49:02 +00:00
parent 18e1420899
commit f3e97e4133
2 changed files with 41 additions and 23 deletions

View file

@ -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,

View file

@ -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))