1
0
Fork 0
mirror of synced 2024-06-27 18:50:47 +12:00

QA changes

This commit is contained in:
Matej Bačo 2023-08-07 17:37:36 +02:00
parent 2bbdbaebd3
commit 11068696c9
8 changed files with 199 additions and 244 deletions

View file

@ -114,17 +114,17 @@ App::post('/v1/functions')
->param('timeout', 15, new Range(1, (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Function maximum execution time in seconds.', true)
->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('commands', '', new Text('1028'), 'Build Commands.', true)
->param('installationId', '', new Text(128), 'Appwrite Installation ID for vcs deployment.', true)
->param('providerRepositoryId', '', new Text(128), 'Repository ID of the repo linked to the function', true)
->param('providerBranch', '', new Text(128), 'Production branch for the repo linked to the function', true)
->param('entrypoint', '', new Text(1028), 'Entrypoint File.')
->param('commands', '', new Text(1028, 0), 'Build Commands.', true)
->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for vcs deployment.', true)
->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the function', true)
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the function', true)
->param('providerSilentMode', false, new Boolean(), 'Is VCS connection in silent mode for the repo linked to the function?', true)
->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo', true)
->param('templateRepository', '', new Text(128), 'Repository name of the template', true)
->param('templateOwner', '', new Text(128), 'Owner name of the template', true)
->param('templateRootDirectory', '', new Text(128), 'Path to function code in the template repo', true)
->param('templateBranch', '', new Text(128), 'Branch of template repo with the code', true)
->param('templateRepository', '', new Text(128, 0), 'Repository name of the template', true)
->param('templateOwner', '', new Text(128, 0), 'Owner name of the template', true)
->param('templateRootDirectory', '', new Text(128, 0), 'Path to function code in the template repo', true)
->param('templateBranch', '', new Text(128, 0), 'Branch of template repo with the code', true)
->inject('request')
->inject('response')
->inject('dbForProject')
@ -581,11 +581,11 @@ App::put('/v1/functions/:functionId')
->param('timeout', 15, new Range(1, (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Maximum execution time in seconds.', true)
->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('commands', '', new Text('1028'), 'Build Commands.', true)
->param('installationId', '', new Text(128), 'Appwrite Installation ID for vcs deployment.', true)
->param('providerRepositoryId', '', new Text(128), 'Repository ID of the repo linked to the function', true)
->param('providerBranch', '', new Text(128), 'Production branch for the repo linked to the function', true)
->param('entrypoint', '', new Text(1028), 'Entrypoint File.')
->param('commands', '', new Text(1028, 0), 'Build Commands.', true)
->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for vcs deployment.', true)
->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the function', true)
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the function', true)
->param('providerSilentMode', false, new Boolean(), 'Is VCS connection in silent mode for the repo linked to the function?', true)
->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo', true)
->inject('request')
@ -1386,7 +1386,7 @@ App::post('/v1/functions/:functionId/executions')
$headersFiltered = [];
foreach ($headers as $key => $value) {
if (\in_array($key, FUNCTION_WHITELIST_HEADERS_REQUEST)) {
if (\in_array(\strtolower($key), FUNCTION_WHITELIST_HEADERS_REQUEST)) {
$headersFiltered[] = [ 'key' => $key, 'value' => $value ];
}
}
@ -1491,7 +1491,7 @@ App::post('/v1/functions/:functionId/executions')
$headersFiltered = [];
foreach ($executionResponse['headers'] as $key => $value) {
if (\in_array($key, FUNCTION_WHITELIST_HEADERS_REQUEST)) {
if (\in_array(\strtolower($key), FUNCTION_WHITELIST_HEADERS_RESPONSE)) {
$headersFiltered[] = [ 'name' => $key, 'value' => $value ];
}
}

View file

@ -243,8 +243,9 @@ App::get('/v1/vcs/github/authorize')
->param('success', '', fn ($clients) => new Host($clients), 'URL to redirect back to console after a successful installation attempt.', true, ['clients'])
->param('failure', '', fn ($clients) => new Host($clients), 'URL to redirect back to console after a failed installation attempt.', true, ['clients'])
->param('projectId', '', new UID(), 'Project ID')
->inject('request')
->inject('response')
->action(function (string $success, string $failure, string $projectId, Response $response) {
->action(function (string $success, string $failure, string $projectId, Request $request, Response $response) {
$state = \json_encode([
'projectId' => $projectId,
'success' => $success,
@ -253,7 +254,8 @@ App::get('/v1/vcs/github/authorize')
$appName = App::getEnv('_APP_VCS_GITHUB_APP_NAME');
$url = "https://github.com/apps/$appName/installations/new?" . \http_build_query([
'state' => $state
'state' => $state,
'redirect_uri' => $request->getProtocol() . '://' . $request->getHostname() . "/v1/vcs/github/callback"
]);
$response
@ -556,7 +558,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
$repo['pushedAt'] = $repo['pushed_at'] ?? null;
$repo['provider'] = $installation->getAttribute('provider', '') ?? '';
$repo['organization'] = $installation->getAttribute('organization', '') ?? '';
return new Document($repo);
return $repo;
}, $repos);
$repos = batch(\array_map(function ($repo) use ($github) {
@ -595,6 +597,10 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
};
}, $repos));
$repos = \array_map(function ($repo) {
return new Document($repo);
}, $repos);
$response->dynamic(new Document([
'providerRepositories' => $repos,
'total' => \count($repos),

View file

@ -187,7 +187,7 @@ const APP_AUTH_TYPE_ADMIN = 'Admin';
// Response related
const MAX_OUTPUT_CHUNK_SIZE = 2 * 1024 * 1024; // 2MB
// Function headers
const FUNCTION_WHITELIST_HEADERS_REQUEST = ['content-type', 'agent'];
const FUNCTION_WHITELIST_HEADERS_REQUEST = ['content-type', 'agent', 'content-length'];
const FUNCTION_WHITELIST_HEADERS_RESPONSE = ['content-type', 'content-length'];
// Usage metrics
const METRIC_TEAMS = 'teams';

View file

@ -94,7 +94,7 @@ Server::setResource('execute', function () {
if ($execution->isEmpty()) {
$headersFiltered = [];
foreach ($headers as $key => $value) {
if (\in_array($key, FUNCTION_WHITELIST_HEADERS_REQUEST)) {
if (\in_array(\strtolower($key), FUNCTION_WHITELIST_HEADERS_REQUEST)) {
$headersFiltered[] = [ 'key' => $key, 'value' => $value ];
}
}
@ -203,7 +203,7 @@ Server::setResource('execute', function () {
$headersFiltered = [];
foreach ($executionResponse['headers'] as $key => $value) {
if (\in_array($key, FUNCTION_WHITELIST_HEADERS_REQUEST)) {
if (\in_array(\strtolower($key), FUNCTION_WHITELIST_HEADERS_RESPONSE)) {
$headersFiltered[] = [ 'name' => $key, 'value' => $value ];
}
}

View file

@ -1,5 +1,4 @@
{
"minimum-stability": "dev",
"name": "appwrite/server-ce",
"description": "End to end backend server for frontend and mobile apps.",
"type": "project",
@ -42,7 +41,7 @@
"ext-openssl": "*",
"ext-zlib": "*",
"ext-sockets": "*",
"appwrite/php-runtimes": "dev-feat-add-start-commands as 0.11.99",
"appwrite/php-runtimes": "0.12.0",
"appwrite/php-clamav": "2.0.*",
"utopia-php/abuse": "0.27.*",
"utopia-php/analytics": "0.10.*",
@ -52,14 +51,14 @@
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.38.*",
"utopia-php/domains": "1.1.*",
"utopia-php/framework": "dev-fix-router-behaviour as 0.29.99",
"utopia-php/framework": "0.30.0",
"utopia-php/dsn": "0.1.*",
"utopia-php/image": "0.5.*",
"utopia-php/locale": "0.4.*",
"utopia-php/logger": "0.3.*",
"utopia-php/messaging": "0.1.*",
"utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "dev-feat-upgrade-framework-lib as 0.4.99",
"utopia-php/platform": "0.4.1",
"utopia-php/pools": "0.4.*",
"utopia-php/preloader": "0.2.*",
"utopia-php/queue": "0.5.*",

382
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -724,7 +724,7 @@ services:
openruntimes-executor:
container_name: openruntimes-executor
hostname: exc1
hostname: executor
<<: *x-logging
stop_signal: SIGINT
image: meldiron/executor:0.3.6

View file

@ -68,7 +68,7 @@ class Execution extends Model
])
->addRule('requestHeaders', [
'type' => Response::MODEL_HEADERS,
'description' => 'HTTP request headers as a key-value object. This will return only whitelisted headers.',
'description' => 'HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.',
'default' => [],
'example' => [['Content-Type' => 'application/json']],
'array' => true,