From f34dc9e96714f245bd85ca6cdff6174919c37f34 Mon Sep 17 00:00:00 2001 From: Timon de Groot Date: Thu, 4 Jul 2024 13:05:44 +0200 Subject: [PATCH 1/2] DeployRunner: Fix regression caused by role selection This reverts commit 31c9cdf1. The role selection does not work, because: - The label is actually called `roles` - The `roles` label is an array, so `=` comparison with a role string does not work - Deployer selector does not support a comparison operator to check if an array contains a value --- src/DeployRunner.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/DeployRunner.php b/src/DeployRunner.php index 1617ff5..47f4f95 100644 --- a/src/DeployRunner.php +++ b/src/DeployRunner.php @@ -150,10 +150,6 @@ private function initializeConfigurableTask(ConfigurableTaskInterface $task, Con if ($task->supports($taskConfig)) { $task = $task->configureWithTaskConfig($taskConfig); - if ($task && $taskConfig instanceof ServerRoleConfigurableInterface) { - $this->configureTaskOnServerRoles($task, $taskConfig); - } - if ($task && $taskConfig instanceof StageConfigurableInterface) { $this->configureTaskOnStage($task, $taskConfig); } @@ -161,11 +157,6 @@ private function initializeConfigurableTask(ConfigurableTaskInterface $task, Con } } - private function configureTaskOnServerRoles(Task $task, ServerRoleConfigurableInterface $taskConfiguration) - { - $task->select('role=' . implode(',role=', $taskConfiguration->getServerRoles())); - } - private function configureTaskOnStage(Task $task, StageConfigurableInterface $taskConfiguration) { if (!$taskConfiguration->getStage()) { From b3387fc583d9de627d3dfd4a80a92060be83120a Mon Sep 17 00:00:00 2001 From: Timon de Groot Date: Thu, 4 Jul 2024 13:07:35 +0200 Subject: [PATCH 2/2] DeployRunner: Fix task variable being overridden by other var type $task is of type ConfigurableTaskInterface, while $deployerTask is of type Task (from Deployer). Next taskConfig iteration would run `supports` on Deployer Task type, which obviously does not exist. --- src/DeployRunner.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DeployRunner.php b/src/DeployRunner.php index 47f4f95..aa0fda3 100644 --- a/src/DeployRunner.php +++ b/src/DeployRunner.php @@ -148,10 +148,10 @@ private function initializeConfigurableTask(ConfigurableTaskInterface $task, Con foreach ($configurations as $taskConfig) { if ($task->supports($taskConfig)) { - $task = $task->configureWithTaskConfig($taskConfig); + $deployerTask = $task->configureWithTaskConfig($taskConfig); - if ($task && $taskConfig instanceof StageConfigurableInterface) { - $this->configureTaskOnStage($task, $taskConfig); + if ($deployerTask && $taskConfig instanceof StageConfigurableInterface) { + $this->configureTaskOnStage($deployerTask, $taskConfig); } } }