You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there way to set "preconditions" on a task? I have some tasks that require a certain variable to be set. Currently I'm just dropping a test -n in the cmd array and letting it die if it's not set, and setting the default value of the variable to "" - but that seems like kind of a round about way of achieving this.
The other "issue" I'm having is whether or not it's possible to pass the results of one command to the next command (as a variable or otherwise) without having to write a temporary file. Again, I can work around this by calling tasks from other tasks and having the "result" that I want be re-computed by a dynamic variable in the sub task, but that implicates the "precondition" feature I mentioned earlier.
The actual use case is that I want to kick off a creating an AMI if the AMI does not already exist, and then pass the output of the "import-task" into a different AWS API call once it's finished. Again, I can accomplish this using multiple tasks, but it makes my tasks very tightly coupled to each other (like "register-image" can only be run by being called from "import-snapshot"
Is there way to set "preconditions" on a task? I have some tasks that require a certain variable to be set. Currently I'm just dropping a test -n in the cmd array and letting it die if it's not set, and setting the default value of the variable to "" - but that seems like kind of a round about way of achieving this.
Task doesn't have this feature (at least yet). What is possible to do, though, is having a default value for a task:
The other "issue" I'm having is whether or not it's possible to pass the results of one command to the next command (as a variable or otherwise) without having to write a temporary file.
I think this was asked before, but no, Task also doesn't have this feature yet.
Again, I can work around this by calling tasks from other tasks and having the "result" that I want be re-computed by a dynamic variable in the sub task, but that implicates the "precondition" feature I mentioned earlier.
Hmm... so your problem here seems to be that variables are cached? They indeed are, i.e., if you populate a variable from a syntax like {sh: '...'} it'll run only once and be cached for future uses.
You could in theory cheat Task to re-run it by using templating to change anything on the command, then it'll re-run. Since this isn't reasonable from a UX perspective, we could add a flag or option to disable this.
It's now 3 months since you opened this issue. Do you have more thoughts? Have you find a way to solve your problem?
The problem with this issue is that there isn't a single actionable thing here. If you'd like to propose features requests, I'd advice to open separate issues for each one.
Activity
andreynering commentedon Jan 26, 2019
Hi @stephenprater,
Task doesn't have this feature (at least yet). What is possible to do, though, is having a default value for a task:
I think this was asked before, but no, Task also doesn't have this feature yet.
Hmm... so your problem here seems to be that variables are cached? They indeed are, i.e., if you populate a variable from a syntax like
{sh: '...'}it'll run only once and be cached for future uses.You could in theory cheat Task to re-run it by using templating to change anything on the command, then it'll re-run. Since this isn't reasonable from a UX perspective, we could add a flag or option to disable this.
andreynering commentedon Mar 23, 2019
Hi @stephenprater
It's now 3 months since you opened this issue. Do you have more thoughts? Have you find a way to solve your problem?
The problem with this issue is that there isn't a single actionable thing here. If you'd like to propose features requests, I'd advice to open separate issues for each one.
What do you think?
stephenprater commentedon Mar 23, 2019
@andreynering I would like to propose these as feature requests. I've started working on them actually and I'm aiming to have PRs sometime soon.
I'll go ahead and close this one since it's more like a "support request" and you answered my questions!
Thanks!
stephenprater commentedon May 17, 2019
#205 Adds the precondition feature I mention here.