| Q |
A |
| Issue Type |
Bug |
| Deployer Version |
5.1.3 |
| Local Machine OS |
Ubuntu 14.04 |
| Remote Machine OS |
Ubuntu 14.04 |
Description
Task restrictions work incorrect with task group when deploy script has several hosts
Steps to reproduce
Content of deploy.php
namespace Deployer;
require 'recipe/common.php';
// Configuration
set('default_stage', 'test');
host('APP')
->hostname('192.168.16.59')
->stage('test')
->roles('app')
;
host('DB')
->hostname('192.168.16.62')
->stage('test')
->roles('db')
;
task('only-db-subtask1', function() {
run("echo 'SubTask1 should be executed only on db host'");
});
task('only-db-subtask2', function() {
run("echo 'SubTask2 should be executed only on db host'");
});
task('group-only-db', [
'only-db-subtask1',
'only-db-subtask2',
'deploy:writable'
])->onRoles('db');
task('only-app', function() {
run("echo 'Should be executed only on app host'");
})->onRoles('app');
task('common', function() {
run("echo 'Common task executed'");
});
task('deploy', [
'group-only-db',
'only-app',
'common'
]);
Output log
➤ Executing task only-db-subtask1
[APP] > echo 'SubTask1 should be executed only on db host'
[APP] < SubTask1 should be executed only on db host
• done on [APP]
[DB] > echo 'SubTask1 should be executed only on db host'
[DB] < SubTask1 should be executed only on db host
• done on [DB]
✔ Ok [7s 59ms]
➤ Executing task only-db-subtask2
[APP] > echo 'SubTask2 should be executed only on db host'
[APP] < SubTask2 should be executed only on db host
• done on [APP]
[DB] > echo 'SubTask2 should be executed only on db host'
[DB] < SubTask2 should be executed only on db host
• done on [DB]
✔ Ok [1s 588ms]
➤ Executing task deploy:writable
• done on [APP]
• done on [DB]
✔ Ok [1ms]
➤ Executing task only-app
[APP] > echo 'Should be executed only on app host'
[APP] < Should be executed only on app host
• done on [APP]
✔ Ok [658ms]
➤ Executing task common
[APP] > echo 'Common task executed'
[APP] < Common task executed
• done on [APP]
[DB] > echo 'Common task executed'
[DB] < Common task executed
• done on [DB]
✔ Ok [1s 317ms]
Expected result: tasks: "only-db-subtask1", "only-db-subtask2" and "deploy:writable" must be executed only DB host.
Actual result: all tasks are executed on all hosts.
The issue in GroupTask if we have 2 or more hosts.
Workaround
Use manual run of task instead of group
task('group-only-db', function() {
invoke('only-db-subtask1');
invoke('only-db-subtask2');
invoke('deploy:writable');
})
->onRoles('db');
Description
Task restrictions work incorrect with task group when deploy script has several hosts
Steps to reproduce
Content of
deploy.phpOutput log
Expected result: tasks: "only-db-subtask1", "only-db-subtask2" and "deploy:writable" must be executed only DB host.
Actual result: all tasks are executed on all hosts.
The issue in GroupTask if we have 2 or more hosts.
Workaround
Use manual run of task instead of group