Fix startup bugs

This commit is contained in:
Matej Bačo
2023-04-20 23:00:23 +02:00
parent 62b24de063
commit 8d5a53a0b1
4 changed files with 12 additions and 8 deletions
+1 -1
View File
@@ -2317,7 +2317,7 @@ $collections = [
'filters' => [],
],
[
'$id' => ID::custom('repoId'),
'$id' => ID::custom('vcsRepoId'),
'type' => Database::VAR_STRING,
'signed' => true,
'size' => 2048,
+5 -4
View File
@@ -38,7 +38,7 @@ App::get('/v1/vcs/github/installations')
->action(function (Response $response, Document $project) {
$projectId = $project->getId();
$appName = App::getEnv('VCS_GITHUB_NAME', '');
$appName = App::getEnv('VCS_GITHUB_NAME');
$response->redirect(`https://github.com/apps/"{$appName}"/installations/new?state={$projectId}`);
});
@@ -121,9 +121,9 @@ App::get('v1/vcs/github/installations/:installationId/repositories')
$privateKey = App::getEnv('VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('VCS_GITHUB_APP_ID');
//TODO: Update GitHub Username
$githubAppName = App::getEnv('VCS_GITHUB_NAME');
$github = new GitHub();
$github->initialiseVariables($installationId, $privateKey, $githubAppId, 'vermakhushboo');
$github->initialiseVariables($installationId, $privateKey, $githubAppId, $githubAppName);
$repos = $github->listRepositoriesForGitHubApp();
$response->dynamic(new Document([
@@ -149,6 +149,7 @@ App::post('/v1/vcs/github/incomingwebhook')
$github = new GitHub();
$privateKey = App::getEnv('VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('VCS_GITHUB_APP_ID');
$githubAppName = App::getEnv('VCS_GITHUB_NAME');
$parsedPayload = $github->parseWebhookEventPayload($event, $payload);
$parsedPayload = json_decode($parsedPayload, true);
@@ -247,7 +248,7 @@ App::post('/v1/vcs/github/incomingwebhook')
$installationId = $parsedPayload["installationId"];
$pullRequestNumber = $parsedPayload["pullRequestNumber"];
$repositoryName = $parsedPayload["repositoryName"];
$github->initialiseVariables($installationId, $privateKey, $githubAppId, 'vermakhushboo');
$github->initialiseVariables($installationId, $privateKey, $githubAppId, $githubAppName);
$vcsRepos = $dbForConsole->find('vcs_repos', [
Query::equal('repositoryId', [$repositoryId]),
+2 -1
View File
@@ -102,9 +102,10 @@ class BuildsV1 extends Worker
$privateKey = App::getEnv('VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('VCS_GITHUB_APP_ID');
$githubAppName = App::getEnv('VCS_GITHUB_NAME');
$github = new GitHub();
$github->initialiseVariables($installationId, $privateKey, $githubAppId, 'vermakhushboo'); //TODO: Update GitHub Username
$github->initialiseVariables($installationId, $privateKey, $githubAppId, $githubAppName);
$branchName = $deployment->getAttribute('branch');
$gitCloneCommand = $github->generateGitCloneCommand($repositoryId, $branchName);
$stdout = '';
+4 -2
View File
@@ -809,11 +809,13 @@ class DeletesV1 extends Worker
$this->listByGroup('functions', [
Query::equal('vcsInstallationInternalId', [$document->getInternalId()])
], $dbForProject, function($function) use ($dbForProject) {
$dbForProject->deleteDocument('vcs_repos', $function->getAttribute('vcsRepoId'));
$function = $function
->setAttribute('vcsInstallationId', '')
->setAttribute('vcsInstallationInternalId', '')
->setAttribute('repoId', '')
->setAttribute('repoInternalId', '');
->setAttribute('vcsRepoId', '')
->setAttribute('vcsRepoInternalId', '');
$dbForProject->updateDocument('functions', $function->getId(), $function);
});
}