Add urls in deployment details
This commit is contained in:
parent
2856077c04
commit
ced6eed6fa
6 changed files with 69 additions and 21 deletions
|
@ -2341,6 +2341,16 @@ $projectCollections = array_merge([
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('providerCommitAuthorUrl'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'signed' => true,
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'format' => '',
|
||||||
|
'filters' => [],
|
||||||
|
'required' => false,
|
||||||
|
'array' => false,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('providerCommitAuthor'),
|
'$id' => ID::custom('providerCommitAuthor'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
@ -2381,6 +2391,16 @@ $projectCollections = array_merge([
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('providerBranchUrl'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'signed' => true,
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'format' => '',
|
||||||
|
'filters' => [],
|
||||||
|
'required' => false,
|
||||||
|
'array' => false,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('providerRootDirectory'),
|
'$id' => ID::custom('providerRootDirectory'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
|
|
@ -56,12 +56,14 @@ $redeployVcs = function (Request $request, Document $function, Document $project
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId', '');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId', '');
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
$owner = $github->getOwnerName($providerInstallationId);
|
$owner = $github->getOwnerName($providerInstallationId);
|
||||||
$providerRepositoryId = $function->getAttribute('providerRepositoryId', '');
|
$providerRepositoryId = $function->getAttribute('providerRepositoryId', '');
|
||||||
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
||||||
$providerBranch = $function->getAttribute('providerBranch', 'main');
|
$providerBranch = $function->getAttribute('providerBranch', 'main');
|
||||||
$repositoryUrl = "https://github.com/$owner/$repositoryName/tree/$providerBranch";
|
$authorUrl = "https://github.com/$owner";
|
||||||
|
$repositoryUrl = "https://github.com/$owner/$repositoryName";
|
||||||
|
$branchUrl = "https://github.com/$owner/$repositoryName/tree/$providerBranch";
|
||||||
$commitDetails = $github->getLatestCommit($owner, $repositoryName, $providerBranch);
|
$commitDetails = $github->getLatestCommit($owner, $repositoryName, $providerBranch);
|
||||||
|
|
||||||
$deployment = $dbForProject->createDocument('deployments', new Document([
|
$deployment = $dbForProject->createDocument('deployments', new Document([
|
||||||
|
@ -81,10 +83,12 @@ $redeployVcs = function (Request $request, Document $function, Document $project
|
||||||
'providerRepositoryId' => $providerRepositoryId,
|
'providerRepositoryId' => $providerRepositoryId,
|
||||||
'repositoryId' => $function->getAttribute('repositoryId', ''),
|
'repositoryId' => $function->getAttribute('repositoryId', ''),
|
||||||
'repositoryInternalId' => $function->getAttribute('repositoryInternalId', ''),
|
'repositoryInternalId' => $function->getAttribute('repositoryInternalId', ''),
|
||||||
|
'providerBranchUrl' => $branchUrl,
|
||||||
'providerRepositoryName' => $repositoryName,
|
'providerRepositoryName' => $repositoryName,
|
||||||
'providerRepositoryOwner' => $owner,
|
'providerRepositoryOwner' => $owner,
|
||||||
'providerRepositoryUrl' => $repositoryUrl,
|
'providerRepositoryUrl' => $repositoryUrl,
|
||||||
'providerCommitHash' => $commitDetails['commitHash'] ?? '',
|
'providerCommitHash' => $commitDetails['commitHash'] ?? '',
|
||||||
|
'providerCommitAuthorUrl' => $authorUrl,
|
||||||
'providerCommitAuthor' => $commitDetails['commitAuthor'] ?? '',
|
'providerCommitAuthor' => $commitDetails['commitAuthor'] ?? '',
|
||||||
'providerCommitMessage' => $commitDetails['commitMessage'] ?? '',
|
'providerCommitMessage' => $commitDetails['commitMessage'] ?? '',
|
||||||
'providerCommitUrl' => $commitDetails['commitUrl'] ?? '',
|
'providerCommitUrl' => $commitDetails['commitUrl'] ?? '',
|
||||||
|
@ -93,6 +97,7 @@ $redeployVcs = function (Request $request, Document $function, Document $project
|
||||||
'search' => implode(' ', [$deploymentId, $entrypoint]),
|
'search' => implode(' ', [$deploymentId, $entrypoint]),
|
||||||
'activate' => true,
|
'activate' => true,
|
||||||
]));
|
]));
|
||||||
|
var_dump($deployment);
|
||||||
|
|
||||||
$projectId = $project->getId();
|
$projectId = $project->getId();
|
||||||
$functionId = $function->getId();
|
$functionId = $function->getId();
|
||||||
|
|
|
@ -38,7 +38,7 @@ use Utopia\Validator\Boolean;
|
||||||
|
|
||||||
use function Swoole\Coroutine\batch;
|
use function Swoole\Coroutine\batch;
|
||||||
|
|
||||||
$createGitDeployments = function (GitHub $github, string $providerInstallationId, array $repositories, string $providerBranch, string $providerRepositoryName, string $providerRepositoryUrl, string $providerRepositoryOwner, string $providerCommitHash, string $providerCommitAuthor, string $providerCommitMessage, string $providerCommitUrl, string $providerPullRequestId, bool $external, Database $dbForConsole, callable $getProjectDB, Request $request) {
|
$createGitDeployments = function (GitHub $github, string $providerInstallationId, array $repositories, string $providerBranch, string $providerBranchUrl, string $providerRepositoryName, string $providerRepositoryUrl, string $providerRepositoryOwner, string $providerCommitHash, string $providerCommitAuthor, string $providerCommitAuthorUrl, string $providerCommitMessage, string $providerCommitUrl, string $providerPullRequestId, bool $external, Database $dbForConsole, callable $getProjectDB, Request $request) {
|
||||||
foreach ($repositories as $resource) {
|
foreach ($repositories as $resource) {
|
||||||
$resourceType = $resource->getAttribute('resourceType');
|
$resourceType = $resource->getAttribute('resourceType');
|
||||||
|
|
||||||
|
@ -186,10 +186,12 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
|
||||||
'providerRepositoryId' => $providerRepositoryId,
|
'providerRepositoryId' => $providerRepositoryId,
|
||||||
'repositoryId' => $repositoryId,
|
'repositoryId' => $repositoryId,
|
||||||
'repositoryInternalId' => $repositoryInternalId,
|
'repositoryInternalId' => $repositoryInternalId,
|
||||||
|
'providerBranchUrl' => $providerBranchUrl,
|
||||||
'providerRepositoryName' => $providerRepositoryName,
|
'providerRepositoryName' => $providerRepositoryName,
|
||||||
'providerRepositoryOwner' => $providerRepositoryOwner,
|
'providerRepositoryOwner' => $providerRepositoryOwner,
|
||||||
'providerRepositoryUrl' => $providerRepositoryUrl,
|
'providerRepositoryUrl' => $providerRepositoryUrl,
|
||||||
'providerCommitHash' => $providerCommitHash,
|
'providerCommitHash' => $providerCommitHash,
|
||||||
|
'providerCommitAuthorUrl' => $providerCommitAuthorUrl,
|
||||||
'providerCommitAuthor' => $providerCommitAuthor,
|
'providerCommitAuthor' => $providerCommitAuthor,
|
||||||
'providerCommitMessage' => $providerCommitMessage,
|
'providerCommitMessage' => $providerCommitMessage,
|
||||||
'providerCommitUrl' => $providerCommitUrl,
|
'providerCommitUrl' => $providerCommitUrl,
|
||||||
|
@ -386,7 +388,7 @@ App::get('/v1/vcs/github/callback')
|
||||||
if (!empty($providerInstallationId)) {
|
if (!empty($providerInstallationId)) {
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
$owner = $github->getOwnerName($providerInstallationId) ?? '';
|
$owner = $github->getOwnerName($providerInstallationId) ?? '';
|
||||||
|
|
||||||
$projectInternalId = $project->getInternalId();
|
$projectInternalId = $project->getInternalId();
|
||||||
|
@ -472,7 +474,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories/:pr
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$owner = $github->getOwnerName($providerInstallationId);
|
$owner = $github->getOwnerName($providerInstallationId);
|
||||||
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
||||||
|
@ -482,7 +484,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories/:pr
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = $github->listRepositoryContents($owner, $repositoryName, $providerRootDirectory);
|
$files = $github->listRepositoryContents($owner, $repositoryName, $providerRootDirectory);
|
||||||
$languages = $github->getRepositoryLanguages($owner, $repositoryName);
|
$languages = $github->listRepositoryLanguages($owner, $repositoryName);
|
||||||
|
|
||||||
$detectorFactory = new Detector($files, $languages);
|
$detectorFactory = new Detector($files, $languages);
|
||||||
|
|
||||||
|
@ -543,13 +545,13 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$page = 1;
|
$page = 1;
|
||||||
$perPage = 100;
|
$perPage = 100;
|
||||||
|
|
||||||
$loadPage = function ($page) use ($github, $perPage) {
|
$loadPage = function ($page) use ($github, $perPage) {
|
||||||
$repos = $github->listRepositoriesForVCSApp($page, $perPage);
|
$repos = $github->listRepositories($page, $perPage);
|
||||||
return $repos;
|
return $repos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -606,7 +608,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||||
return function () use ($repo, $github) {
|
return function () use ($repo, $github) {
|
||||||
try {
|
try {
|
||||||
$files = $github->listRepositoryContents($repo['organization'], $repo['name'], '');
|
$files = $github->listRepositoryContents($repo['organization'], $repo['name'], '');
|
||||||
$languages = $github->getRepositoryLanguages($repo['organization'], $repo['name']);
|
$languages = $github->listRepositoryLanguages($repo['organization'], $repo['name']);
|
||||||
|
|
||||||
$detectorFactory = new Detector($files, $languages);
|
$detectorFactory = new Detector($files, $languages);
|
||||||
|
|
||||||
|
@ -716,7 +718,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
$owner = $github->getOwnerName($providerInstallationId);
|
$owner = $github->getOwnerName($providerInstallationId);
|
||||||
|
|
||||||
$repository = $github->createRepository($owner, $name, $private);
|
$repository = $github->createRepository($owner, $name, $private);
|
||||||
|
@ -770,7 +772,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$owner = $github->getOwnerName($providerInstallationId) ?? '';
|
$owner = $github->getOwnerName($providerInstallationId) ?? '';
|
||||||
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
||||||
|
@ -817,7 +819,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$owner = $github->getOwnerName($providerInstallationId) ?? '';
|
$owner = $github->getOwnerName($providerInstallationId) ?? '';
|
||||||
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
||||||
|
@ -865,6 +867,7 @@ App::post('/v1/vcs/github/events')
|
||||||
if ($event == $github::EVENT_PUSH) {
|
if ($event == $github::EVENT_PUSH) {
|
||||||
$providerBranchCreated = $parsedPayload["created"] ?? false;
|
$providerBranchCreated = $parsedPayload["created"] ?? false;
|
||||||
$providerBranch = $parsedPayload["branch"] ?? '';
|
$providerBranch = $parsedPayload["branch"] ?? '';
|
||||||
|
$providerBranchUrl = $parsedPayload["branchUrl"] ?? '';
|
||||||
$providerRepositoryId = $parsedPayload["repositoryId"] ?? '';
|
$providerRepositoryId = $parsedPayload["repositoryId"] ?? '';
|
||||||
$providerRepositoryName = $parsedPayload["repositoryName"] ?? '';
|
$providerRepositoryName = $parsedPayload["repositoryName"] ?? '';
|
||||||
$providerInstallationId = $parsedPayload["installationId"] ?? '';
|
$providerInstallationId = $parsedPayload["installationId"] ?? '';
|
||||||
|
@ -872,10 +875,11 @@ App::post('/v1/vcs/github/events')
|
||||||
$providerCommitHash = $parsedPayload["commitHash"] ?? '';
|
$providerCommitHash = $parsedPayload["commitHash"] ?? '';
|
||||||
$providerRepositoryOwner = $parsedPayload["owner"] ?? '';
|
$providerRepositoryOwner = $parsedPayload["owner"] ?? '';
|
||||||
$providerCommitAuthor = $parsedPayload["headCommitAuthor"] ?? '';
|
$providerCommitAuthor = $parsedPayload["headCommitAuthor"] ?? '';
|
||||||
|
$providerCommitAuthorUrl = $parsedPayload["authorUrl"] ?? '';
|
||||||
$providerCommitMessage = $parsedPayload["headCommitMessage"] ?? '';
|
$providerCommitMessage = $parsedPayload["headCommitMessage"] ?? '';
|
||||||
$providerCommitUrl = $parsedPayload["headCommitUrl"] ?? '';
|
$providerCommitUrl = $parsedPayload["headCommitUrl"] ?? '';
|
||||||
|
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
//find functionId from functions table
|
//find functionId from functions table
|
||||||
$repositories = $dbForConsole->find('repositories', [
|
$repositories = $dbForConsole->find('repositories', [
|
||||||
|
@ -885,7 +889,7 @@ App::post('/v1/vcs/github/events')
|
||||||
|
|
||||||
// create new deployment only on push and not when branch is created
|
// create new deployment only on push and not when branch is created
|
||||||
if (!$providerBranchCreated) {
|
if (!$providerBranchCreated) {
|
||||||
$createGitDeployments($github, $providerInstallationId, $repositories, $providerBranch, $providerRepositoryName, $providerRepositoryUrl, $providerRepositoryOwner, $providerCommitHash, $providerCommitAuthor, $providerCommitMessage, $providerCommitUrl, '', false, $dbForConsole, $getProjectDB, $request);
|
$createGitDeployments($github, $providerInstallationId, $repositories, $providerBranch, $providerBranchUrl, $providerRepositoryName, $providerRepositoryUrl, $providerRepositoryOwner, $providerCommitHash, $providerCommitAuthor, $providerCommitAuthorUrl, $providerCommitMessage, $providerCommitUrl, '', false, $dbForConsole, $getProjectDB, $request);
|
||||||
}
|
}
|
||||||
} elseif ($event == $github::EVENT_INSTALLATION) {
|
} elseif ($event == $github::EVENT_INSTALLATION) {
|
||||||
if ($parsedPayload["action"] == "deleted") {
|
if ($parsedPayload["action"] == "deleted") {
|
||||||
|
@ -913,6 +917,7 @@ App::post('/v1/vcs/github/events')
|
||||||
} elseif ($event == $github::EVENT_PULL_REQUEST) {
|
} elseif ($event == $github::EVENT_PULL_REQUEST) {
|
||||||
if ($parsedPayload["action"] == "opened" || $parsedPayload["action"] == "reopened" || $parsedPayload["action"] == "synchronize") {
|
if ($parsedPayload["action"] == "opened" || $parsedPayload["action"] == "reopened" || $parsedPayload["action"] == "synchronize") {
|
||||||
$providerBranch = $parsedPayload["branch"] ?? '';
|
$providerBranch = $parsedPayload["branch"] ?? '';
|
||||||
|
$providerBranchUrl = $parsedPayload["branchUrl"] ?? '';
|
||||||
$providerRepositoryId = $parsedPayload["repositoryId"] ?? '';
|
$providerRepositoryId = $parsedPayload["repositoryId"] ?? '';
|
||||||
$providerRepositoryName = $parsedPayload["repositoryName"] ?? '';
|
$providerRepositoryName = $parsedPayload["repositoryName"] ?? '';
|
||||||
$providerInstallationId = $parsedPayload["installationId"] ?? '';
|
$providerInstallationId = $parsedPayload["installationId"] ?? '';
|
||||||
|
@ -922,13 +927,14 @@ App::post('/v1/vcs/github/events')
|
||||||
$providerRepositoryOwner = $parsedPayload["owner"] ?? '';
|
$providerRepositoryOwner = $parsedPayload["owner"] ?? '';
|
||||||
$external = $parsedPayload["external"] ?? true;
|
$external = $parsedPayload["external"] ?? true;
|
||||||
$providerCommitUrl = $parsedPayload["headCommitUrl"] ?? '';
|
$providerCommitUrl = $parsedPayload["headCommitUrl"] ?? '';
|
||||||
|
$providerCommitAuthorUrl = $parsedPayload["authorUrl"] ?? '';
|
||||||
|
|
||||||
// Ignore sync for non-external. We handle it in push webhook
|
// Ignore sync for non-external. We handle it in push webhook
|
||||||
if (!$external && $parsedPayload["action"] == "synchronize") {
|
if (!$external && $parsedPayload["action"] == "synchronize") {
|
||||||
return $response->json($parsedPayload);
|
return $response->json($parsedPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$commitDetails = $github->getCommit($providerRepositoryOwner, $providerRepositoryName, $providerCommitHash);
|
$commitDetails = $github->getCommit($providerRepositoryOwner, $providerRepositoryName, $providerCommitHash);
|
||||||
$providerCommitAuthor = $commitDetails["commitAuthor"] ?? '';
|
$providerCommitAuthor = $commitDetails["commitAuthor"] ?? '';
|
||||||
|
@ -939,7 +945,7 @@ App::post('/v1/vcs/github/events')
|
||||||
Query::orderDesc('$createdAt')
|
Query::orderDesc('$createdAt')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$createGitDeployments($github, $providerInstallationId, $repositories, $providerBranch, $providerRepositoryName, $providerRepositoryUrl, $providerRepositoryOwner, $providerCommitHash, $providerCommitAuthor, $providerCommitMessage, $providerCommitUrl, $providerPullRequestId, $external, $dbForConsole, $getProjectDB, $request);
|
$createGitDeployments($github, $providerInstallationId, $repositories, $providerBranch, $providerBranchUrl, $providerRepositoryName, $providerRepositoryUrl, $providerRepositoryOwner, $providerCommitHash, $providerCommitAuthor, $providerCommitAuthorUrl, $providerCommitMessage, $providerCommitUrl, $providerPullRequestId, $external, $dbForConsole, $getProjectDB, $request);
|
||||||
} elseif ($parsedPayload["action"] == "closed") {
|
} elseif ($parsedPayload["action"] == "closed") {
|
||||||
// Allowed external contributions cleanup
|
// Allowed external contributions cleanup
|
||||||
|
|
||||||
|
@ -1135,7 +1141,7 @@ App::patch('/v1/vcs/github/installations/:installationId/repositories/:repositor
|
||||||
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
|
||||||
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID');
|
||||||
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
$providerInstallationId = $installation->getAttribute('providerInstallationId');
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$repositories = [$repository];
|
$repositories = [$repository];
|
||||||
$providerRepositoryId = $repository->getAttribute('providerRepositoryId');
|
$providerRepositoryId = $repository->getAttribute('providerRepositoryId');
|
||||||
|
|
|
@ -171,7 +171,7 @@ class BuildsV1 extends Worker
|
||||||
$rootDirectory = \ltrim($rootDirectory, '.');
|
$rootDirectory = \ltrim($rootDirectory, '.');
|
||||||
$rootDirectory = \ltrim($rootDirectory, '/');
|
$rootDirectory = \ltrim($rootDirectory, '/');
|
||||||
|
|
||||||
$github->initialiseVariables($providerInstallationId, $privateKey, $githubAppId);
|
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
|
||||||
|
|
||||||
$owner = $github->getOwnerName($providerInstallationId);
|
$owner = $github->getOwnerName($providerInstallationId);
|
||||||
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
||||||
|
|
4
composer.lock
generated
4
composer.lock
generated
|
@ -2463,7 +2463,7 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/vcs.git",
|
"url": "https://github.com/utopia-php/vcs.git",
|
||||||
"reference": "6ee80b55a3cef5a8d29ab6a9b2af2db278789e38"
|
"reference": "9f1665cb7818a05adf77c17972e560c2e43b7974"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"adhocore/jwt": "^1.1",
|
"adhocore/jwt": "^1.1",
|
||||||
|
@ -2512,7 +2512,7 @@
|
||||||
"utopia",
|
"utopia",
|
||||||
"vcs"
|
"vcs"
|
||||||
],
|
],
|
||||||
"time": "2023-08-09T15:07:12+00:00"
|
"time": "2023-08-09T17:22:48+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/websocket",
|
"name": "utopia-php/websocket",
|
||||||
|
|
|
@ -106,6 +106,12 @@ class Deployment extends Model
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => '7c3f25d',
|
'example' => '7c3f25d',
|
||||||
])
|
])
|
||||||
|
->addRule('providerCommitAuthorUrl', [
|
||||||
|
'type' => self::TYPE_STRING,
|
||||||
|
'description' => 'The url of vcs commit author',
|
||||||
|
'default' => '',
|
||||||
|
'example' => 'https://github.com/vermakhushboo',
|
||||||
|
])
|
||||||
->addRule('providerCommitAuthor', [
|
->addRule('providerCommitAuthor', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'The name of vcs commit author',
|
'description' => 'The name of vcs commit author',
|
||||||
|
@ -124,7 +130,18 @@ class Deployment extends Model
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb',
|
'example' => 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb',
|
||||||
])
|
])
|
||||||
;
|
->addRule('providerBranch', [
|
||||||
|
'type' => self::TYPE_STRING,
|
||||||
|
'description' => 'The branch of the vcs repository',
|
||||||
|
'default' => '',
|
||||||
|
'example' => '0.7.x',
|
||||||
|
])
|
||||||
|
->addRule('providerBranchUrl', [
|
||||||
|
'type' => self::TYPE_STRING,
|
||||||
|
'description' => 'The branch of the vcs repository',
|
||||||
|
'default' => '',
|
||||||
|
'example' => 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue