Fixes for Gogs build and webhook. Issue #13
This commit is contained in:
parent
cc618b0c80
commit
9e478fd821
|
@ -66,6 +66,9 @@ class BuildFactory
|
|||
case 'svn':
|
||||
$type = 'SubversionBuild';
|
||||
break;
|
||||
case 'gogs':
|
||||
$type = 'GogsBuild';
|
||||
break;
|
||||
default:
|
||||
return $build;
|
||||
}
|
||||
|
|
|
@ -276,9 +276,9 @@ class ProjectController extends PHPCensor\Controller
|
|||
$values['key'] = $values['ssh_private_key'];
|
||||
$values['pubkey'] = $values['ssh_public_key'];
|
||||
|
||||
if ($values['type'] == "gitlab") {
|
||||
$accessInfo = $project->getAccessInformation();
|
||||
$reference = $accessInfo["user"].'@'.$accessInfo["domain"].':' . $accessInfo["port"] . '/' . ltrim($project->getReference(), '/') . ".git";
|
||||
if ($values['type'] == 'gitlab') {
|
||||
$accessInfo = $project->getAccessInformation();
|
||||
$reference = $accessInfo["user"] . '@' . $accessInfo["domain"] . ':' . $accessInfo["port"] . '/' . ltrim($project->getReference(), '/') . ".git";
|
||||
$values['reference'] = $reference;
|
||||
}
|
||||
|
||||
|
@ -332,17 +332,18 @@ class ProjectController extends PHPCensor\Controller
|
|||
|
||||
$options = [
|
||||
'choose' => Lang::get('select_repository_type'),
|
||||
'github' => Lang::get('github'),
|
||||
'bitbucket' => Lang::get('bitbucket'),
|
||||
'gitlab' => Lang::get('gitlab'),
|
||||
'remote' => Lang::get('remote'),
|
||||
'github' => 'GitHub',
|
||||
'bitbucket' => 'Bitbucket',
|
||||
'gitlab' => 'GitLab',
|
||||
'gogs' => 'Gogs',
|
||||
'remote' => 'Git',
|
||||
'local' => Lang::get('local'),
|
||||
'hg' => Lang::get('hg'),
|
||||
'svn' => Lang::get('svn'),
|
||||
'hg' => 'Mercurial (Hg)',
|
||||
'svn' => 'SVN',
|
||||
];
|
||||
|
||||
$field = Form\Element\Select::create('type', Lang::get('where_hosted'), true);
|
||||
$field->setPattern('^(github|bitbucket|gitlab|remote|local|hg|svn)');
|
||||
$field->setPattern('^(github|bitbucket|gitlab|gogs|remote|local|hg|svn)');
|
||||
$field->setOptions($options);
|
||||
$field->setClass('form-control')->setContainerClass('form-group');
|
||||
$form->addField($field);
|
||||
|
|
|
@ -80,7 +80,7 @@ class WebhookController extends Controller
|
|||
*/
|
||||
public function bitbucket($projectId)
|
||||
{
|
||||
$project = $this->fetchProject($projectId, 'bitbucket');
|
||||
$project = $this->fetchProject($projectId, ['bitbucket', 'remote']);
|
||||
|
||||
// Support both old services and new webhooks
|
||||
if ($payload = $this->getParam('payload')) {
|
||||
|
@ -183,7 +183,7 @@ class WebhookController extends Controller
|
|||
*/
|
||||
public function github($projectId)
|
||||
{
|
||||
$project = $this->fetchProject($projectId, 'github');
|
||||
$project = $this->fetchProject($projectId, ['github', 'remote']);
|
||||
|
||||
switch ($_SERVER['CONTENT_TYPE']) {
|
||||
case 'application/json':
|
||||
|
@ -346,7 +346,7 @@ class WebhookController extends Controller
|
|||
*/
|
||||
public function gitlab($projectId)
|
||||
{
|
||||
$project = $this->fetchProject($projectId, 'gitlab');
|
||||
$project = $this->fetchProject($projectId, ['gitlab', 'remote']);
|
||||
|
||||
$payloadString = file_get_contents("php://input");
|
||||
$payload = json_decode($payloadString, true);
|
||||
|
@ -421,7 +421,7 @@ class WebhookController extends Controller
|
|||
*/
|
||||
public function gogs($projectId)
|
||||
{
|
||||
$project = $this->fetchProject($projectId, 'gogs');
|
||||
$project = $this->fetchProject($projectId, ['gogs', 'remote']);
|
||||
switch ($_SERVER['CONTENT_TYPE']) {
|
||||
case 'application/json':
|
||||
$payload = json_decode(file_get_contents('php://input'), true);
|
||||
|
|
|
@ -78,7 +78,8 @@ abstract class BaseCommandExecutor implements CommandExecutorInterface
|
|||
$this->lastOutput = [];
|
||||
|
||||
$command = call_user_func_array('sprintf', $args);
|
||||
$this->logger->logDebug($command);
|
||||
$this->logger->logDebug('Command: ' . $command);
|
||||
$this->logger->logDebug('Args: ' . json_encode($args));
|
||||
|
||||
if ($this->quiet) {
|
||||
$this->logger->log('Executing: ' . $command);
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* BitBucket Build Model
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*/
|
||||
* Bitbucket Build Model
|
||||
*
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class BitbucketBuild extends RemoteGitBuild
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
|
@ -17,11 +10,10 @@ use b8\HttpClient;
|
|||
use PHPCensor\Model\BuildError;
|
||||
|
||||
/**
|
||||
* Github Build Model
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*/
|
||||
* Github Build Model
|
||||
*
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class GithubBuild extends RemoteGitBuild
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* Gitlab Build Model
|
||||
* @author André Cianfarani <a.cianfarani@c2is.fr>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*/
|
||||
* Gitlab Build Model
|
||||
*
|
||||
* @author André Cianfarani <a.cianfarani@c2is.fr>
|
||||
*/
|
||||
class GitlabBuild extends RemoteGitBuild
|
||||
{
|
||||
|
||||
|
|
10
src/PHPCensor/Model/Build/GogsBuild.php
Normal file
10
src/PHPCensor/Model/Build/GogsBuild.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* GogsBuild Build Model
|
||||
*/
|
||||
class GogsBuild extends RemoteGitBuild
|
||||
{
|
||||
}
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
|
@ -13,11 +6,10 @@ use PHPCensor\Model\Build;
|
|||
use PHPCensor\Builder;
|
||||
|
||||
/**
|
||||
* Local Build Model
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*/
|
||||
* Local Build Model
|
||||
*
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class LocalBuild extends Build
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
|
@ -14,9 +7,8 @@ use PHPCensor\Builder;
|
|||
|
||||
/**
|
||||
* Mercurial Build Model
|
||||
* @author Pavel Gopanenko <pavelgopanenko@gmail.com>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*
|
||||
* @author Pavel Gopanenko <pavelgopanenko@gmail.com>
|
||||
*/
|
||||
class MercurialBuild extends Build
|
||||
{
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
|
@ -13,11 +6,10 @@ use PHPCensor\Model\Build;
|
|||
use PHPCensor\Builder;
|
||||
|
||||
/**
|
||||
* Remote Git Build Model
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*/
|
||||
* Remote Git Build Model
|
||||
*
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class RemoteGitBuild extends Build
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Build;
|
||||
|
||||
|
@ -14,9 +7,8 @@ use PHPCensor\Builder;
|
|||
|
||||
/**
|
||||
* Remote Subversion Build Model
|
||||
* @author Nadir Dzhilkibaev <imam.sharif@gmail.com>
|
||||
* @package PHPCI
|
||||
* @subpackage Core
|
||||
*
|
||||
* @author Nadir Dzhilkibaev <imam.sharif@gmail.com>
|
||||
*/
|
||||
class SubversionBuild extends Build
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue