Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoke() ignore before/after links #1427

Closed
Adirelle opened this issue Nov 23, 2017 · 5 comments
Closed

invoke() ignore before/after links #1427

Adirelle opened this issue Nov 23, 2017 · 5 comments

Comments

@Adirelle
Copy link

Q A
Issue Type Bug
Deployer Version v6.0.3
Local Machine OS Ubuntu 17.10
Remote Machine OS Debian 9

Description

invoke() executes only the given task, ignoring before/after links. I have not checked failure/success tasks.

Steps to reproduce

Link task 'frontend:generate' to be executed before task 'deploy:assets:install' using before().
Define task 'build' to invoke() task 'deploy:assets:install'.
Run task 'build'.

'frontend:generate' is not executed.

Content of deploy.php

task('frontend:vendors', 'yarn install --pure-lockfile');

task('frontend:generate', 'yarn run encore production');
before('frontend:generate', 'frontend:vendors');

task('deploy:assets:install', '{{bin/composer}} install-assets --no-interaction');
after('deploy:assets:install', 'frontend:generate');

task('build', function () {
    set('deploy_path', __DIR__ . '/.build');
    set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --ignore-platform-reqs');

    invoke('deploy:prepare');
    invoke('deploy:release');
    invoke('deploy:update_code');
    invoke('deploy:vendors');
    invoke('deploy:assets:install');
    invoke('deploy:clear_paths');
    invoke('deploy:symlink');
    invoke('cleanup');
})->local();

Output log

$ vendor/bin/dep -v build test
➤ Executing task build
➤ Executing task deploy:prepare
✔ Ok [7ms]
➤ Executing task deploy:release
✔ Ok [35ms]
➤ Executing task deploy:update_code
✔ Ok [4s 568ms]
➤ Executing task deploy:vendors
✔ Ok [2s 87ms]
➤ Executing task deploy:assets:install
✔ Ok [601ms]
➤ Executing task deploy:clear_paths
✔ Ok [17ms]
➤ Executing task deploy:symlink
✔ Ok [26ms]
➤ Executing task cleanup
✔ Ok [2ms]
✔ Ok [2ms]
@Adirelle
Copy link
Author

Adirelle commented Nov 23, 2017

Please note, this implementation of invoke() does the job:

/**
 * Run task
 *
 * @experimental
 * @param string $task
 */
function invoke($task)
{
    $hosts = [Context::get()->getHost()];
    $tasks = Deployer::get()->scriptManager->getTasks($task, $hosts);
    $executor = Deployer::get()->seriesExecutor;

    $executor->run($tasks, $hosts);
}

But I am sure neither about the way I get $hosts nor if using seriesExecutor by default is a good thing.

@antonmedv
Copy link
Member

So, What do you suggest?

@Adirelle
Copy link
Author

To review and test it. I just tweaked it by mimicking the TaskCommand, but I do not know the project well enough to know its implications and side-effects. If it seems fine to you, I can make a PR.

@antonmedv
Copy link
Member

A PR will be okay, as this feature still @experimental we can tweek it.

@Adirelle
Copy link
Author

It is actually fixed in the master branch. I overlooked the PR #1364. It was for another issue but it also solves this one. I am sorry for wasting your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants