From 6f0945fb97fc2e35df7c0fc70ab13230521fa0e5 Mon Sep 17 00:00:00 2001 From: Stephen Ball Date: Wed, 7 Oct 2015 15:06:07 +0100 Subject: [PATCH] Added the commit message to the BuildInterpolator so it can be used as the default reason passed to deployer --- PHPCI/Helper/BuildInterpolator.php | 3 +++ PHPCI/Plugin/Deployer.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PHPCI/Helper/BuildInterpolator.php b/PHPCI/Helper/BuildInterpolator.php index fbadbc30..1e7222bb 100644 --- a/PHPCI/Helper/BuildInterpolator.php +++ b/PHPCI/Helper/BuildInterpolator.php @@ -38,6 +38,7 @@ class BuildInterpolator $this->interpolation_vars['%COMMIT%'] = $build->getCommitId(); $this->interpolation_vars['%SHORT_COMMIT%'] = substr($build->getCommitId(), 0, 7); $this->interpolation_vars['%COMMIT_EMAIL%'] = $build->getCommitterEmail(); + $this->interpolation_vars['%COMMIT_MESSAGE%'] = $build->getCommitMessage(); $this->interpolation_vars['%COMMIT_URI%'] = $build->getCommitLink(); $this->interpolation_vars['%BRANCH%'] = $build->getBranch(); $this->interpolation_vars['%BRANCH_URI%'] = $build->getBranchLink(); @@ -49,6 +50,7 @@ class BuildInterpolator $this->interpolation_vars['%BUILD_URI%'] = $phpCiUrl . "build/view/" . $build->getId(); $this->interpolation_vars['%PHPCI_COMMIT%'] = $this->interpolation_vars['%COMMIT%']; $this->interpolation_vars['%PHPCI_SHORT_COMMIT%'] = $this->interpolation_vars['%SHORT_COMMIT%']; + $this->interpolation_vars['%PHPCI_COMMIT_MESSAGE%'] = $this->interpolation_vars['%COMMIT_MESSAGE%']; $this->interpolation_vars['%PHPCI_COMMIT_EMAIL%'] = $this->interpolation_vars['%COMMIT_EMAIL%']; $this->interpolation_vars['%PHPCI_COMMIT_URI%'] = $this->interpolation_vars['%COMMIT_URI%']; $this->interpolation_vars['%PHPCI_PROJECT%'] = $this->interpolation_vars['%PROJECT%']; @@ -61,6 +63,7 @@ class BuildInterpolator putenv('PHPCI=1'); putenv('PHPCI_COMMIT=' . $this->interpolation_vars['%COMMIT%']); putenv('PHPCI_SHORT_COMMIT=' . $this->interpolation_vars['%SHORT_COMMIT%']); + putenv('PHPCI_COMMIT_MESSAGE=' . $this->interpolation_vars['%COMMIT_MESSAGE%']); putenv('PHPCI_COMMIT_EMAIL=' . $this->interpolation_vars['%COMMIT_EMAIL%']); putenv('PHPCI_COMMIT_URI=' . $this->interpolation_vars['%COMMIT_URI%']); putenv('PHPCI_PROJECT=' . $this->interpolation_vars['%PROJECT%']); diff --git a/PHPCI/Plugin/Deployer.php b/PHPCI/Plugin/Deployer.php index bda55ff0..2db839e3 100644 --- a/PHPCI/Plugin/Deployer.php +++ b/PHPCI/Plugin/Deployer.php @@ -34,7 +34,7 @@ class Deployer implements \PHPCI\Plugin { $this->phpci = $phpci; $this->build = $build; - $this->reason = 'PHPCI Build #%BUILD%'; + $this->reason = 'PHPCI Build #%BUILD% - %COMMIT_MESSAGE%'; if (isset($options['webhook_url'])) { $this->webhookUrl = $options['webhook_url'];