-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Reconfigure tasks #954
Comments
I think reconfiguring tasks on runtime is bad idea. Why you need it for? |
I gave an example above: a task bundled with a recipe should only be executed for a selected list of servers (or stages). To be specific its a task which should clear the PHP opcode cache and that doesn't work on all of our servers. Thus we limit the task to the servers where it works. Yes, the original issue is the broken servers but sometimes we don't have a choice and thus try to work with it as good as possible. And yes, I understand that reconfiguring tasks at runtime can have bad side effects. Do you have another idea how we could solve our (and similar) issues? |
I think API like this Also did you try this? task('foo:bar:part', ['foo:bar'])->onlyOn([
'server1',
'server2',
]); Using group tasks for this? |
Your suggestion sounds useful and would at least reduce the visual overhead, I'll try that. |
I will add this solution to docs later. |
@Elfet I just noticed that this is not possible actually since group tasks cannot be configured like this. Do you think it would be possible to allow this for group tasks? Otherwise I'd have to stick to my original attempt, unless task reconfiguration is added. |
@mbrodala can you describe when you want to configure tasks? At what point and based on what data? |
@Elfet I think I made this clear by now. ;-) We have some tasks (e.g. PHP Opcache reset) which are included from recipes but should only run on a few selected servers since e.g. reset does not work on the other servers. |
Ok, so this kind of API will be usable here: task('deploy:opcache')->onlyOn([
'server1',
'server2',
]); |
Yeah, that's my suggestion. I can add a PR if you think this could go in. |
Yes, i think les't give it a try) |
True |
got following error:
|
@torinaki There is no release of Deployer which includes this change yet. |
@mbrodala but offical documentation already contains this changes: |
Yeah, because there is only one branch ( |
Yes, i really wan't to do something with this, maybe have two branches, published and master. |
Description
It would be useful if there was an API to reconfigure existing tasks. Right now if one wants to e.g. limit execution of a task from a recipe to a limited set of servers, one has to do something like this:
I could imagine an API like this instead:
(Same goes for all other methods of the
Task
class.)This would mean that the
$body
oftask()
would become optional. If called with only the task name, theTask
object would be returned if present.What do you think?
The text was updated successfully, but these errors were encountered: