1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

fix: issue with auto deploy flag

This commit is contained in:
Christy Jacob 2022-02-21 14:41:50 +04:00
parent 6752300cc1
commit 33c58bfc65
3 changed files with 11 additions and 2 deletions

View file

@ -519,7 +519,9 @@ App::post('/v1/functions/:functionId/deployments')
throw new Exception('Failed moving file', 500);
}
if ((bool) $activate) {
$activate = (bool) filter_var($activate, FILTER_VALIDATE_BOOLEAN);
if ($activate) {
// Remove deploy for all other deployments.
$deployments = $dbForProject->find('deployments', [
new Query('activate', Query::TYPE_EQUAL, [true]),
@ -545,7 +547,7 @@ App::post('/v1/functions/:functionId/deployments')
'path' => $path,
'size' => $size,
'search' => implode(' ', [$deploymentId, $entrypoint]),
'activate' => ((bool) $activate === true),
'activate' => $activate,
]));
// Enqueue a message to start the build

View file

@ -203,6 +203,7 @@ App::post('/v1/runtimes')
'-f',
'/dev/null'
];
$containerId = $orchestration->run(
image: $baseImage,
name: $runtimeId,

View file

@ -140,8 +140,14 @@ class BuildsV1 extends Worker
Console::success("Build id: $buildId created");
var_dump("Going to set auto deploy");
var_dump($deployment);
var_dump($deployment->getAttribute('activate'));
var_dump(gettype($deployment->getAttribute('activate')));
/** Set auto deploy */
if ($deployment->getAttribute('activate') === true) {
var_dump("Setting auto deploy");
$function->setAttribute('deployment', $deployment->getId());
$function = $dbForProject->updateDocument('functions', $functionId, $function);
}