Fixes for live
This commit is contained in:
parent
2c860e8009
commit
dd59bff838
|
@ -149,6 +149,7 @@ class Builder
|
|||
|
||||
mkdir($this->buildPath, 0777, true);
|
||||
file_put_contents($keyFile, $key);
|
||||
chmod($keyFile, 0600);
|
||||
$this->executeCommand('ssh-agent ssh-add '.$keyFile.' && git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath.' && ssh-agent -k');
|
||||
unlink($keyFile);
|
||||
|
||||
|
|
|
@ -13,18 +13,37 @@ class GithubController extends b8\Controller
|
|||
$this->_buildStore = Store\Factory::getStore('Build');
|
||||
}
|
||||
|
||||
public function index()
|
||||
public function webhook($project)
|
||||
{
|
||||
$payload = json_decode($this->getParam('payload'));
|
||||
$payload = json_decode($this->getParam('payload'), true);
|
||||
|
||||
try
|
||||
{
|
||||
$build = new Build();
|
||||
$build->setProjectId($this->getParam('project'));
|
||||
$build->setProjectId($project);
|
||||
$build->setCommitId($payload['after']);
|
||||
$build->setStatus(0);
|
||||
$build->setLog('');
|
||||
$build->setBranch(str_replace('refs/heads/', '', $payload['ref']));
|
||||
}
|
||||
catch(\Exception $ex)
|
||||
{
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
header('Ex: ' . $ex->getMessage());
|
||||
die('FAIL');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$this->_buildStore->save($build);
|
||||
}
|
||||
catch(\Exception $ex)
|
||||
{
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
header('Ex: ' . $ex->getMessage());
|
||||
die('FAIL');
|
||||
}
|
||||
|
||||
die('OK');
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue