From 3cdaef8fa9fc3a910b641fc428b41b0d87d1d902 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Fri, 3 Jun 2016 17:30:45 +0100 Subject: [PATCH 1/4] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 910e15f7..77683b91 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ PHPCI is a free and open source (BSD License) continuous integration tool specif We have a chat room for discussing PHPCI, you can access it here: [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/Block8/PHPCI?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) +**Support the development of PHPCI** + +We [now accept donations](https://www.phptesting.org/support) to directly support the ongoing development of PHPCI. There is of course no obligation to donate, nor any commitment if you do. + +[Donate](https://www.phptesting.org/support) + ## What it does: * Clones your project from Github, Bitbucket or a local path * Allows you to set up and tear down test databases. From 4d0911f2a98dd35b73702a34c8725b7f73e597e8 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 23 Jun 2016 11:28:42 +0100 Subject: [PATCH 2/4] Bug fixes Signed-off-by: Dan Cryer --- PHPCI/Command/InstallCommand.php | 9 +++++ PHPCI/Controller/BuildController.php | 4 ++ PHPCI/Controller/ProjectController.php | 4 ++ PHPCI/Languages/lang.en.php | 3 ++ .../20160623100223_project_table_defaults.php | 18 +++++++++ PHPCI/Service/BuildService.php | 40 +++++++++++-------- PHPCI/View/layout.phtml | 8 ++++ 7 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 PHPCI/Migrations/20160623100223_project_table_defaults.php diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index 318871a5..5f5cbd67 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -21,6 +21,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use PHPCI\Service\UserService; +use Symfony\Component\Console\Question\ConfirmationQuestion; /** * Install console command - Installs PHPCI. @@ -253,6 +254,14 @@ class InstallCommand extends Command $rtn = []; + $helper = $this->getHelper('question'); + $question = new ConfirmationQuestion('Use beanstalkd to manage build queue? ', true); + + if (!$helper->ask($input, $output, $question)) { + $output->writeln('Skipping beanstalkd configuration.'); + return null; + } + if (!$rtn['host'] = $input->getOption('queue-server')) { $rtn['host'] = $dialog->ask($output, 'Enter your beanstalkd hostname [localhost]: ', 'localhost'); } diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index df8778f7..55ccbb37 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -200,6 +200,10 @@ class BuildController extends \PHPCI\Controller $build = $this->buildService->createDuplicateBuild($copy); + if ($this->buildService->queueError) { + $_SESSION['global_error'] = Lang::get('add_to_queue_failed'); + } + $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); return $response; diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index be5dee19..72be46e5 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -116,6 +116,10 @@ class ProjectController extends PHPCI\Controller $email = $_SESSION['phpci_user']->getEmail(); $build = $this->buildService->createBuild($project, null, urldecode($branch), $email); + if ($this->buildService->queueError) { + $_SESSION['global_error'] = Lang::get('add_to_queue_failed'); + } + $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); return $response; diff --git a/PHPCI/Languages/lang.en.php b/PHPCI/Languages/lang.en.php index eec2ee07..63df75d2 100644 --- a/PHPCI/Languages/lang.en.php +++ b/PHPCI/Languages/lang.en.php @@ -372,6 +372,9 @@ PHPCI', 'project_id_argument' => 'A project ID', 'commit_id_option' => 'Commit ID to build', 'branch_name_option' => 'Branch to build', + 'add_to_queue_failed' => 'Build created successfully, but failed to add to build queue. This usually happens + when PHPCI is set to use a beanstalkd server that does not exist, + or your beanstalkd server has stopped.', // Run Command 'run_all_pending' => 'Run all pending PHPCI builds.', diff --git a/PHPCI/Migrations/20160623100223_project_table_defaults.php b/PHPCI/Migrations/20160623100223_project_table_defaults.php new file mode 100644 index 00000000..079db327 --- /dev/null +++ b/PHPCI/Migrations/20160623100223_project_table_defaults.php @@ -0,0 +1,18 @@ +table('project') + ->changeColumn('build_config', MysqlAdapter::PHINX_TYPE_TEXT, array('null' => true)) + ->changeColumn('archived', MysqlAdapter::PHINX_TYPE_INTEGER, array( + 'length' => MysqlAdapter::INT_TINY, + 'default' => 0, + )) + ->save(); + } +} diff --git a/PHPCI/Service/BuildService.php b/PHPCI/Service/BuildService.php index dca0fc0d..a120a64e 100644 --- a/PHPCI/Service/BuildService.php +++ b/PHPCI/Service/BuildService.php @@ -30,6 +30,11 @@ class BuildService */ protected $buildStore; + /** + * @var bool + */ + public $queueError = false; + /** * @param BuildStore $buildStore */ @@ -155,27 +160,30 @@ class BuildService } $config = Config::getInstance(); - $settings = $config->get('phpci.worker', []); if (!empty($settings['host']) && !empty($settings['queue'])) { - $jobData = array( - 'type' => 'phpci.build', - 'build_id' => $build->getId(), - ); + try { + $jobData = array( + 'type' => 'phpci.build', + 'build_id' => $build->getId(), + ); - if ($config->get('using_custom_file')) { - $jobData['config'] = $config->getArray(); + if ($config->get('using_custom_file')) { + $jobData['config'] = $config->getArray(); + } + + $pheanstalk = new Pheanstalk($settings['host']); + $pheanstalk->useTube($settings['queue']); + $pheanstalk->put( + json_encode($jobData), + PheanstalkInterface::DEFAULT_PRIORITY, + PheanstalkInterface::DEFAULT_DELAY, + $config->get('phpci.worker.job_timeout', 600) + ); + } catch (\Exception $ex) { + $this->queueError = true; } - - $pheanstalk = new Pheanstalk($settings['host']); - $pheanstalk->useTube($settings['queue']); - $pheanstalk->put( - json_encode($jobData), - PheanstalkInterface::DEFAULT_PRIORITY, - PheanstalkInterface::DEFAULT_DELAY, - $config->get('phpci.worker.job_timeout', 600) - ); } } } diff --git a/PHPCI/View/layout.phtml b/PHPCI/View/layout.phtml index 2e105c18..1960aff6 100644 --- a/PHPCI/View/layout.phtml +++ b/PHPCI/View/layout.phtml @@ -292,6 +292,14 @@
+ ' . $message . ''; + } + ?> +
From 42ca1c65279b5fc2975df68d1a1a179801fe4914 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Wed, 29 Jun 2016 10:13:27 +0100 Subject: [PATCH 3/4] Fix for handling old unserialize mode. --- PHPCI/Model/Project.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/Model/Project.php b/PHPCI/Model/Project.php index 717b0d9a..4b5268b2 100644 --- a/PHPCI/Model/Project.php +++ b/PHPCI/Model/Project.php @@ -96,7 +96,7 @@ class Project extends ProjectBase $info = $this->data['access_information']; // Handle old-format (serialized) access information first: - if (!empty($info) && substr($info, 0, 1) != '{') { + if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) { $data = unserialize($info); } else { $data = json_decode($info, true); From 64b0f60368c6cc6a6373dc316510c276c2f508d4 Mon Sep 17 00:00:00 2001 From: Arnout Boks Date: Wed, 17 Aug 2016 13:35:21 +0200 Subject: [PATCH 4/4] Removed unused 'standard' option for PhpCpd plugin (#1249) --- PHPCI/Plugin/PhpCpd.php | 5 ----- 1 file changed, 5 deletions(-) mode change 100644 => 100755 PHPCI/Plugin/PhpCpd.php diff --git a/PHPCI/Plugin/PhpCpd.php b/PHPCI/Plugin/PhpCpd.php old mode 100644 new mode 100755 index 2424d41e..aa076d2d --- a/PHPCI/Plugin/PhpCpd.php +++ b/PHPCI/Plugin/PhpCpd.php @@ -50,17 +50,12 @@ class PhpCpd implements \PHPCI\Plugin $this->build = $build; $this->path = $phpci->buildPath; - $this->standard = 'PSR1'; $this->ignore = $phpci->ignore; if (!empty($options['path'])) { $this->path = $phpci->buildPath . $options['path']; } - if (!empty($options['standard'])) { - $this->standard = $options['standard']; - } - if (!empty($options['ignore'])) { $this->ignore = $options['ignore']; }