mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
WIP: Build from template
This commit is contained in:
parent
1b4036078b
commit
399847d7ea
2 changed files with 23 additions and 3 deletions
|
|
@ -129,12 +129,32 @@ class BuildsV1 extends Worker
|
||||||
$owner = $github->getOwnerName($installationId);
|
$owner = $github->getOwnerName($installationId);
|
||||||
$repositoryName = $github->getRepositoryName($repositoryId);
|
$repositoryName = $github->getRepositoryName($repositoryId);
|
||||||
$branchName = $deployment->getAttribute('vcsBranch');
|
$branchName = $deployment->getAttribute('vcsBranch');
|
||||||
$gitCloneCommand = $github->generateGitCloneCommand($owner, $repositoryId, $branchName, $tmpDirectory, $rootDirectory);
|
$gitCloneCommand = $github->generateGitCloneCommand($owner, $repositoryName, $branchName, $tmpDirectory, $rootDirectory);
|
||||||
\var_dump($gitCloneCommand);
|
\var_dump($gitCloneCommand);
|
||||||
$stdout = '';
|
$stdout = '';
|
||||||
$stderr = '';
|
$stderr = '';
|
||||||
Console::execute('mkdir -p /tmp/builds/' . $buildId, '', $stdout, $stderr);
|
Console::execute('mkdir -p /tmp/builds/' . $buildId, '', $stdout, $stderr);
|
||||||
Console::execute($gitCloneCommand, '', $stdout, $stderr);
|
Console::execute($gitCloneCommand, '', $stdout, $stderr);
|
||||||
|
|
||||||
|
// build from template
|
||||||
|
$templateRepositoryName = $template->getAttribute('templateRepositoryName');
|
||||||
|
$templateOwnerName = $template->getAttribute('templateOwnerName');
|
||||||
|
|
||||||
|
if (!empty($templateRepositoryName) && !empty($templateOwnerName)) {
|
||||||
|
// clone template repo
|
||||||
|
$tmpTemplateDirectory = '/tmp/builds/' . $buildId . '/template';
|
||||||
|
$templateRootDirectory = $template->getAttribute('templateDirectory', '');
|
||||||
|
var_dump($templateOwnerName . " " . $templateRepositoryName);
|
||||||
|
$gitCloneCommandForTemplate = $github->generateGitCloneCommand($templateOwnerName, $templateRepositoryName, 'main', $tmpTemplateDirectory, $templateRootDirectory);
|
||||||
|
var_dump("clone cmd for template " . $gitCloneCommandForTemplate);
|
||||||
|
Console::execute($gitCloneCommandForTemplate, '', $stdout, $stderr);
|
||||||
|
|
||||||
|
// TODO: move template to code directory
|
||||||
|
// Console::execute('mv FROM TO', '', $stdout, $stderr);
|
||||||
|
|
||||||
|
// TODO: commit and push
|
||||||
|
}
|
||||||
|
|
||||||
Console::execute('tar --exclude code.tar.gz -czf /tmp/builds/' . $buildId . '/code.tar.gz -C /tmp/builds/' . $buildId . '/code' . (empty($rootDirectory) ? '' : '/' . $rootDirectory) . ' .', '', $stdout, $stderr);
|
Console::execute('tar --exclude code.tar.gz -czf /tmp/builds/' . $buildId . '/code.tar.gz -C /tmp/builds/' . $buildId . '/code' . (empty($rootDirectory) ? '' : '/' . $rootDirectory) . ' .', '', $stdout, $stderr);
|
||||||
|
|
||||||
$deviceFunctions = $this->getFunctionsDevice($project->getId());
|
$deviceFunctions = $this->getFunctionsDevice($project->getId());
|
||||||
|
|
|
||||||
4
composer.lock
generated
4
composer.lock
generated
|
|
@ -2705,7 +2705,7 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/vcs.git",
|
"url": "https://github.com/utopia-php/vcs.git",
|
||||||
"reference": "7fb5b733ab0676b257d8bc8fc4e0c4cafd4c756c"
|
"reference": "df56d0eecf308e0c8b1e86c6801bb44c7c363052"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"adhocore/jwt": "^1.1",
|
"adhocore/jwt": "^1.1",
|
||||||
|
|
@ -2750,7 +2750,7 @@
|
||||||
"utopia",
|
"utopia",
|
||||||
"vcs"
|
"vcs"
|
||||||
],
|
],
|
||||||
"time": "2023-06-17T14:27:48+00:00"
|
"time": "2023-06-19T16:54:01+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/websocket",
|
"name": "utopia-php/websocket",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue