Repository navigation
Hookes executed out of order #4267
Deployer Versionv8.0.5 Target OSMacOS 14.8.9 Which PHP version are you using?PHP 8.5 Content of deploy.php or deploy.yamlSteps to reproduceHooks are executed in the opposite order that they are defined. MAML configuration file. Multiple commands defined in one hook. Command: Output:
|
Replies: 1 comment 1 reply
|
This looks like a bug in the recipe importers, not in your config. The two hook types store tasks differently, but the importer handles a list the same way for both. In public function addBefore(string $task): self
{
array_unshift($this->before, $task); // prepends
return $this;
}
public function addAfter(string $task): self
{
array_push($this->after, $task); // appends
return $this;
}But if (is_array($value)) {
foreach (array_reverse($value) as $v) {
after($key, $v); // same array_reverse is used for before()
}
}For Workaround that doesn't depend on the bug: turn the steps into a group task and hook that single task. In MAML, a task whose body is an array of strings becomes a You could also just write the list in reverse, but that silently breaks once the bug is fixed, so I wouldn't. The fix itself is a one-liner: drop the |

This looks like a bug in the recipe importers, not in your config. The two hook types store tasks differently, but the importer handles a list the same way for both.
In
src/Task/Task.phpthe two hook types insert at opposite ends:But
src/Import/MamlRecipe.php(andYamlRecipe.phptoo) does the same thing for a list in both cases: