Upgrade console, reword commands into 1 param
This commit is contained in:
parent
e86382ce55
commit
7e386b885c
14 changed files with 27 additions and 98 deletions
|
@ -2910,7 +2910,7 @@ $collections = [
|
|||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('buildCommand'),
|
||||
'$id' => ID::custom('commands'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 16384,
|
||||
|
@ -2918,18 +2918,7 @@ $collections = [
|
|||
'required' => false,
|
||||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('installCommand'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 16384,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
]
|
||||
],
|
||||
'indexes' => [
|
||||
[
|
||||
|
@ -3078,18 +3067,7 @@ $collections = [
|
|||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('buildCommand'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 2048,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('installCommand'),
|
||||
'$id' => ID::custom('commands'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 2048,
|
||||
|
@ -3290,27 +3268,6 @@ $collections = [
|
|||
'lengths' => [],
|
||||
'orders' => [],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('_key_entrypoint'),
|
||||
'type' => Database::INDEX_KEY,
|
||||
'attributes' => ['entrypoint'],
|
||||
'lengths' => [2048],
|
||||
'orders' => [Database::ORDER_ASC],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('_key_build_command'),
|
||||
'type' => Database::INDEX_KEY,
|
||||
'attributes' => ['buildCommand'],
|
||||
'lengths' => [2048],
|
||||
'orders' => [Database::ORDER_ASC],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('_key_install_command'),
|
||||
'type' => Database::INDEX_KEY,
|
||||
'attributes' => ['installCommand'],
|
||||
'lengths' => [2048],
|
||||
'orders' => [Database::ORDER_ASC],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('_key_size'),
|
||||
'type' => Database::INDEX_KEY,
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
Subproject commit bfde5717475802bd0a2ab5751ab2d7b3cece0bcc
|
||||
Subproject commit d358c7df6e0cb2e6826d519dc7b069da9a6f84b0
|
|
@ -61,8 +61,7 @@ $redeployVcsLogic = function (Request $request, Document $function, Document $pr
|
|||
'resourceId' => $function->getId(),
|
||||
'resourceType' => 'functions',
|
||||
'entrypoint' => $entrypoint,
|
||||
'buildCommand' => $function->getAttribute('buildCommand', ''),
|
||||
'installCommand' => $function->getAttribute('installCommand', ''),
|
||||
'commands' => $function->getAttribute('commands', ''),
|
||||
'type' => 'vcs',
|
||||
'vcsInstallationId' => $installation->getId(),
|
||||
'vcsInstallationInternalId' => $installation->getInternalId(),
|
||||
|
@ -115,8 +114,7 @@ App::post('/v1/functions')
|
|||
->param('enabled', true, new Boolean(), 'Is function enabled?', true)
|
||||
->param('logging', true, new Boolean(), 'Do executions get logged?', true)
|
||||
->param('entrypoint', '', new Text('1028'), 'Entrypoint File.')
|
||||
->param('buildCommand', '', new Text('1028'), 'Build Command.', true)
|
||||
->param('installCommand', '', new Text('1028'), 'Install Command.', true)
|
||||
->param('commands', '', new Text('1028'), 'Build Commands.', true)
|
||||
->param('vcsInstallationId', '', new Text(128), 'Appwrite Installation ID for vcs deployment.', true)
|
||||
->param('vcsRepositoryId', '', new Text(128), 'Repository ID of the repo linked to the function', true)
|
||||
->param('vcsBranch', '', new Text(128), 'Production branch for the repo linked to the function', true)
|
||||
|
@ -133,7 +131,7 @@ App::post('/v1/functions')
|
|||
->inject('user')
|
||||
->inject('events')
|
||||
->inject('dbForConsole')
|
||||
->action(function (string $functionId, string $name, string $runtime, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $buildCommand, string $installCommand, string $vcsInstallationId, string $vcsRepositoryId, string $vcsBranch, bool $vcsSilentMode, string $vcsRootDirectory, string $templateRepositoryName, string $templateOwnerName, string $templateRootDirectory, string $templateBranch, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance, Database $dbForConsole) use ($redeployVcsLogic) {
|
||||
->action(function (string $functionId, string $name, string $runtime, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $commands, string $vcsInstallationId, string $vcsRepositoryId, string $vcsBranch, bool $vcsSilentMode, string $vcsRootDirectory, string $templateRepositoryName, string $templateOwnerName, string $templateRootDirectory, string $templateBranch, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance, Database $dbForConsole) use ($redeployVcsLogic) {
|
||||
$functionId = ($functionId == 'unique()') ? ID::unique() : $functionId;
|
||||
|
||||
// build from template
|
||||
|
@ -197,8 +195,7 @@ App::post('/v1/functions')
|
|||
'schedule' => $schedule,
|
||||
'timeout' => $timeout,
|
||||
'entrypoint' => $entrypoint,
|
||||
'buildCommand' => $buildCommand,
|
||||
'installCommand' => $installCommand,
|
||||
'commands' => $commands,
|
||||
'vcsInstallationId' => $installation->getId(),
|
||||
'vcsInstallationInternalId' => $installation->getInternalId(),
|
||||
'vcsRepositoryId' => $vcsRepositoryId,
|
||||
|
@ -634,8 +631,7 @@ App::put('/v1/functions/:functionId')
|
|||
->param('enabled', true, new Boolean(), 'Is function enabled?', true)
|
||||
->param('logging', true, new Boolean(), 'Do executions get logged?', true)
|
||||
->param('entrypoint', '', new Text('1028'), 'Entrypoint File.')
|
||||
->param('buildCommand', '', new Text('1028'), 'Build Command.', true)
|
||||
->param('installCommand', '', new Text('1028'), 'Install Command.', true)
|
||||
->param('commands', '', new Text('1028'), 'Build Commands.', true)
|
||||
->param('vcsInstallationId', '', new Text(128), 'Appwrite Installation ID for vcs deployment.', true)
|
||||
->param('vcsRepositoryId', '', new Text(128), 'Repository ID of the repo linked to the function', true)
|
||||
->param('vcsBranch', '', new Text(128), 'Production branch for the repo linked to the function', true)
|
||||
|
@ -648,7 +644,7 @@ App::put('/v1/functions/:functionId')
|
|||
->inject('user')
|
||||
->inject('events')
|
||||
->inject('dbForConsole')
|
||||
->action(function (string $functionId, string $name, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $buildCommand, string $installCommand, string $vcsInstallationId, string $vcsRepositoryId, string $vcsBranch, bool $vcsSilentMode, string $vcsRootDirectory, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance, Database $dbForConsole) use ($redeployVcsLogic) {
|
||||
->action(function (string $functionId, string $name, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $commands, string $vcsInstallationId, string $vcsRepositoryId, string $vcsBranch, bool $vcsSilentMode, string $vcsRootDirectory, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance, Database $dbForConsole) use ($redeployVcsLogic) {
|
||||
// TODO: If only branch changes, re-deploy
|
||||
|
||||
$function = $dbForProject->getDocument('functions', $functionId);
|
||||
|
@ -729,8 +725,7 @@ App::put('/v1/functions/:functionId')
|
|||
|
||||
if (
|
||||
$function->getAttribute('entrypoint') !== $entrypoint ||
|
||||
$function->getAttribute('buildCommand') !== $buildCommand ||
|
||||
$function->getAttribute('installCommand') !== $installCommand ||
|
||||
$function->getAttribute('commands') !== $commands ||
|
||||
$function->getAttribute('vcsRootDirectory') !== $vcsRootDirectory
|
||||
) {
|
||||
$live = false;
|
||||
|
@ -746,8 +741,7 @@ App::put('/v1/functions/:functionId')
|
|||
'live' => $live,
|
||||
'logging' => $logging,
|
||||
'entrypoint' => $entrypoint,
|
||||
'buildCommand' => $buildCommand,
|
||||
'installCommand' => $installCommand,
|
||||
'commands' => $commands,
|
||||
'vcsInstallationId' => $installation->getId(),
|
||||
'vcsInstallationInternalId' => $installation->getInternalId(),
|
||||
'vcsRepositoryId' => $vcsRepositoryId,
|
||||
|
@ -925,8 +919,7 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
}
|
||||
|
||||
$entrypoint = $function->getAttribute('entrypoint', '');
|
||||
$buildCommand = $function->getAttribute('buildCommand', '');
|
||||
$installCommand = $function->getAttribute('installCommand', '');
|
||||
$commands = $function->getAttribute('commands', '');
|
||||
|
||||
if (empty($entrypoint)) {
|
||||
throw new Exception(Exception::FUNCTION_ENTRYPOINT_MISSING);
|
||||
|
@ -1034,8 +1027,7 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
'resourceId' => $function->getId(),
|
||||
'resourceType' => 'functions',
|
||||
'entrypoint' => $entrypoint,
|
||||
'buildCommand' => $buildCommand,
|
||||
'installCommand' => $installCommand,
|
||||
'commands' => $commands,
|
||||
'path' => $path,
|
||||
'size' => $fileSize,
|
||||
'search' => implode(' ', [$deploymentId, $entrypoint]),
|
||||
|
@ -1068,8 +1060,7 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
'resourceId' => $function->getId(),
|
||||
'resourceType' => 'functions',
|
||||
'entrypoint' => $entrypoint,
|
||||
'buildCommand' => $buildCommand,
|
||||
'installCommand' => $installCommand,
|
||||
'commands' => $commands,
|
||||
'path' => $path,
|
||||
'size' => $fileSize,
|
||||
'chunksTotal' => $chunks,
|
||||
|
|
|
@ -580,8 +580,7 @@ $createGitDeployments = function (GitHub $github, string $installationId, array
|
|||
'resourceId' => $functionId,
|
||||
'resourceType' => 'functions',
|
||||
'entrypoint' => $function->getAttribute('entrypoint'),
|
||||
'installCommand' => $function->getAttribute('installCommand'),
|
||||
'buildCommand' => $function->getAttribute('buildCommand'),
|
||||
'commands' => $function->getAttribute('commands'),
|
||||
'type' => 'vcs',
|
||||
'vcsInstallationId' => $vcsInstallationId,
|
||||
'vcsInstallationInternalId' => $vcsInstallationInternalId,
|
||||
|
@ -891,7 +890,7 @@ App::delete('/v1/vcs/installations/:installationId')
|
|||
});
|
||||
|
||||
App::get('/v1/vcs/github/installations/:installationId/repositories/:repositoryId/detection')
|
||||
->desc('Detect function settings like runtime for specified root directory')
|
||||
->desc('Detect runtime settings from source code')
|
||||
->groups(['api', 'vcs'])
|
||||
->label('scope', 'public')
|
||||
->label('sdk.namespace', 'vcs')
|
||||
|
|
|
@ -330,17 +330,7 @@ class BuildsV1 extends Worker
|
|||
'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '',
|
||||
]);
|
||||
|
||||
$command = '';
|
||||
|
||||
if (!empty($deployment->getAttribute('installCommand', ''))) {
|
||||
$command .= $deployment->getAttribute('installCommand', '');
|
||||
}
|
||||
|
||||
if (!empty($deployment->getAttribute('buildCommand', ''))) {
|
||||
$separator = empty($command) ? '' : ' && ';
|
||||
$command .= $separator . $deployment->getAttribute('buildCommand', '');
|
||||
}
|
||||
|
||||
$command = $deployment->getAttribute('commands', '');
|
||||
$command = \str_replace('"', '\\"', $command);
|
||||
|
||||
$response = null;
|
||||
|
|
|
@ -9,8 +9,7 @@ class Deployments extends Base
|
|||
'buildId',
|
||||
'activate',
|
||||
'entrypoint',
|
||||
'buildCommand',
|
||||
'installCommand'
|
||||
'commands'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,8 +14,7 @@ class Functions extends Base
|
|||
'schedulePrevious',
|
||||
'timeout',
|
||||
'entrypoint',
|
||||
'buildCommand',
|
||||
'installCommand'
|
||||
'commands'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -105,16 +105,10 @@ class Func extends Model
|
|||
'default' => '',
|
||||
'example' => 'index.js',
|
||||
])
|
||||
->addRule('buildCommand', [
|
||||
->addRule('commands', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'The build command used to build the deployment.',
|
||||
'default' => '',
|
||||
'example' => 'npm run build',
|
||||
])
|
||||
->addRule('installCommand', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'The install command used to build the deployment.',
|
||||
'default' => '',
|
||||
'example' => 'npm install',
|
||||
])
|
||||
->addRule('vcsInstallationId', [
|
||||
|
|
Loading…
Reference in a new issue