feat: fix retry deployment endpoint
This commit is contained in:
parent
41cb259e95
commit
16a46ad99a
1 changed files with 17 additions and 17 deletions
|
@ -558,22 +558,6 @@ App::post('/v1/functions/:functionId/deployments')
|
||||||
throw new Exception('Failed moving file', 500);
|
throw new Exception('Failed moving file', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
$activate = (bool) filter_var($activate, FILTER_VALIDATE_BOOLEAN);
|
|
||||||
|
|
||||||
if ($activate) {
|
|
||||||
// Remove deploy for all other deployments.
|
|
||||||
$activeDeployments = $dbForProject->find('deployments', [
|
|
||||||
new Query('activate', Query::TYPE_EQUAL, [true]),
|
|
||||||
new Query('resourceId', Query::TYPE_EQUAL, [$functionId]),
|
|
||||||
new Query('resourceType', Query::TYPE_EQUAL, ['functions'])
|
|
||||||
]);
|
|
||||||
|
|
||||||
foreach ($activeDeployments as $activeDeployment) {
|
|
||||||
$activeDeployment->setAttribute('activate', false);
|
|
||||||
$dbForProject->updateDocument('deployments', $activeDeployment->getId(), $activeDeployment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($chunksUploaded === $chunks) {
|
if($chunksUploaded === $chunks) {
|
||||||
$fileSize = $deviceFunctions->getFileSize($path);
|
$fileSize = $deviceFunctions->getFileSize($path);
|
||||||
|
|
||||||
|
@ -595,6 +579,22 @@ App::post('/v1/functions/:functionId/deployments')
|
||||||
} else {
|
} else {
|
||||||
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment->setAttribute('size', $fileSize)->setAttribute('metadata', $metadata));
|
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment->setAttribute('size', $fileSize)->setAttribute('metadata', $metadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$activate = (bool) filter_var($activate, FILTER_VALIDATE_BOOLEAN);
|
||||||
|
if ($activate) {
|
||||||
|
// Remove deploy for all other deployments.
|
||||||
|
$activeDeployments = $dbForProject->find('deployments', [
|
||||||
|
new Query('activate', Query::TYPE_EQUAL, [true]),
|
||||||
|
new Query('resourceId', Query::TYPE_EQUAL, [$functionId]),
|
||||||
|
new Query('resourceType', Query::TYPE_EQUAL, ['functions'])
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($activeDeployments as $activeDeployment) {
|
||||||
|
$activeDeployment->setAttribute('activate', false);
|
||||||
|
$dbForProject->updateDocument('deployments', $activeDeployment->getId(), $activeDeployment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Enqueue a message to start the build
|
// Enqueue a message to start the build
|
||||||
Resque::enqueue(Event::BUILDS_QUEUE_NAME, Event::BUILDS_CLASS_NAME, [
|
Resque::enqueue(Event::BUILDS_QUEUE_NAME, Event::BUILDS_CLASS_NAME, [
|
||||||
'projectId' => $project->getId(),
|
'projectId' => $project->getId(),
|
||||||
|
@ -1110,7 +1110,7 @@ App::post('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId')
|
||||||
// Enqueue a message to start the build
|
// Enqueue a message to start the build
|
||||||
Resque::enqueue(Event::BUILDS_QUEUE_NAME, Event::BUILDS_CLASS_NAME, [
|
Resque::enqueue(Event::BUILDS_QUEUE_NAME, Event::BUILDS_CLASS_NAME, [
|
||||||
'projectId' => $project->getId(),
|
'projectId' => $project->getId(),
|
||||||
'functionId' => $function->getId(),
|
'resourceId' => $function->getId(),
|
||||||
'deploymentId' => $deploymentId,
|
'deploymentId' => $deploymentId,
|
||||||
'type' => BUILD_TYPE_RETRY
|
'type' => BUILD_TYPE_RETRY
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue