Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/PHPCensor/Model/Build/GithubBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public function sendStatusPostback()
break;
}

$url = Config::getInstance()->get('php-censor.url');
$phpCensorUrl = Config::getInstance()->get('php-censor.url');

$params = [
'state' => $status,
'target_url' => $url . '/build/view/' . $this->getId(),
'target_url' => $phpCensorUrl . '/build/view/' . $this->getId(),
'description' => $description,
'context' => 'PHP Censor',
];
Expand Down Expand Up @@ -163,9 +163,10 @@ public function getFileLinkTemplate()
* Handle any post-clone tasks, like applying a pull request patch on top of the branch.
* @param Builder $builder
* @param $cloneTo
* @param array $extra
* @return bool
*/
protected function postCloneSetup(Builder $builder, $cloneTo)
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
{
$buildType = $this->getExtra('build_type');

Expand All @@ -177,14 +178,17 @@ protected function postCloneSetup(Builder $builder, $cloneTo)
$remoteBranch = $this->getExtra('remote_branch');

$cmd = 'cd "%s" && git checkout -b php-censor/' . $this->getId() . ' %s && git pull -q --no-edit %s %s';
if (!empty($extra['git_ssh_wrapper'])) {
$cmd = 'export GIT_SSH="'.$extra['git_ssh_wrapper'].'" && ' . $cmd;
}
$success = $builder->executeCommand($cmd, $cloneTo, $this->getBranch(), $remoteUrl, $remoteBranch);
}
} catch (\Exception $ex) {
$success = false;
}

if ($success) {
$success = parent::postCloneSetup($builder, $cloneTo);
$success = parent::postCloneSetup($builder, $cloneTo, $extra);
}

return $success;
Expand Down
3 changes: 2 additions & 1 deletion src/PHPCensor/Model/Build/MercurialBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ protected function cloneBySsh(Builder $builder, $cloneTo)
* Handle post-clone tasks (switching branch, etc.)
* @param Builder $builder
* @param $cloneTo
* @param array $extra
* @return bool
*/
protected function postCloneSetup(Builder $builder, $cloneTo)
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
{
$success = true;
$commit = $this->getCommitId();
Expand Down
9 changes: 7 additions & 2 deletions src/PHPCensor/Model/Build/RemoteGitBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ protected function cloneBySsh(Builder $builder, $cloneTo)
$success = $builder->executeCommand($cmd, $this->getBranch(), $this->getCloneUrl(), $cloneTo);

if ($success) {
$success = $this->postCloneSetup($builder, $cloneTo);
$extra = [
'git_ssh_wrapper' => $gitSshWrapper
];

$success = $this->postCloneSetup($builder, $cloneTo, $extra);
}

// Remove the key file and git wrapper:
Expand All @@ -128,9 +132,10 @@ protected function cloneBySsh(Builder $builder, $cloneTo)
* Handle any post-clone tasks, like switching branches.
* @param Builder $builder
* @param $cloneTo
* @param array $extra
* @return bool
*/
protected function postCloneSetup(Builder $builder, $cloneTo)
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
{
$success = true;
$commit = $this->getCommitId();
Expand Down