Resolve merge conflicts

This commit is contained in:
Khushboo Verma 2024-08-06 14:02:48 +05:30
commit ccdfc8b1ea
5 changed files with 17 additions and 5 deletions

View file

@ -1462,7 +1462,8 @@ App::post('/v1/functions/:functionId/deployments/:deploymentId/build')
->inject('project') ->inject('project')
->inject('queueForEvents') ->inject('queueForEvents')
->inject('queueForBuilds') ->inject('queueForBuilds')
->action(function (string $functionId, string $deploymentId, string $buildId, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds) { ->inject('deviceForFunctions')
->action(function (string $functionId, string $deploymentId, string $buildId, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Device $deviceForFunctions) {
$function = $dbForProject->getDocument('functions', $functionId); $function = $dbForProject->getDocument('functions', $functionId);
if ($function->isEmpty()) { if ($function->isEmpty()) {
@ -1474,13 +1475,23 @@ App::post('/v1/functions/:functionId/deployments/:deploymentId/build')
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
} }
$path = $deployment->getAttribute('path');
if(empty($path) || !$deviceForFunctions->exists($path)) {
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
}
$deploymentId = ID::unique(); $deploymentId = ID::unique();
$destination = $deviceForFunctions->getPath($deploymentId . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION));
$deviceForFunctions->transfer($path, $destination, $deviceForFunctions);
$deployment->removeAttribute('$internalId'); $deployment->removeAttribute('$internalId');
$deployment = $dbForProject->createDocument('deployments', $deployment->setAttributes([ $deployment = $dbForProject->createDocument('deployments', $deployment->setAttributes([
'$internalId' => '',
'$id' => $deploymentId, '$id' => $deploymentId,
'buildId' => '', 'buildId' => '',
'buildInternalId' => '', 'buildInternalId' => '',
'path' => $destination,
'entrypoint' => $function->getAttribute('entrypoint'), 'entrypoint' => $function->getAttribute('entrypoint'),
'commands' => $function->getAttribute('commands', ''), 'commands' => $function->getAttribute('commands', ''),
'search' => implode(' ', [$deploymentId, $function->getAttribute('entrypoint')]), 'search' => implode(' ', [$deploymentId, $function->getAttribute('entrypoint')]),

View file

@ -787,7 +787,7 @@ $image = $this->getParam('image', '');
<<: *x-logging <<: *x-logging
restart: unless-stopped restart: unless-stopped
stop_signal: SIGINT stop_signal: SIGINT
image: openruntimes/executor:0.6.2 image: openruntimes/executor:0.6.5
networks: networks:
- appwrite - appwrite
- runtimes - runtimes

View file

@ -873,7 +873,7 @@ services:
hostname: exc1 hostname: exc1
<<: *x-logging <<: *x-logging
stop_signal: SIGINT stop_signal: SIGINT
image: openruntimes/executor:0.6.4 image: openruntimes/executor:0.6.5
restart: unless-stopped restart: unless-stopped
networks: networks:
- appwrite - appwrite

View file

@ -333,6 +333,7 @@ class Builds extends Action
$source = $path; $source = $path;
$build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('source', $source)); $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('source', $source));
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttribute('path', $source));
$this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole); $this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
} }

View file

@ -194,8 +194,7 @@ class Executor
} }
$runtimeId = "$projectId-$deploymentId"; $runtimeId = "$projectId-$deploymentId";
$route = '/runtimes/' . $runtimeId . '/execution'; $route = '/runtimes/' . $runtimeId . '/executions';
// Remove after migration // Remove after migration
if ($version == 'v3') { if ($version == 'v3') {
@ -217,6 +216,7 @@ class Executor
'version' => $version, 'version' => $version,
'runtimeEntrypoint' => $runtimeEntrypoint, 'runtimeEntrypoint' => $runtimeEntrypoint,
'logging' => $logging, 'logging' => $logging,
'restartPolicy' => 'always' // Once utopia/orchestration has it, use DockerAPI::ALWAYS (0.13+)
]; ];
if(!empty($body)) { if(!empty($body)) {