shuttle
shuttle copied to clipboard
Make Shuttle action point to point at multiple scripts
As a user, I would like to architect my scripts in smaller chunks, but be able to call them all with a "super target", so that I can make only one call to shuttle. Example (written in make syntax)
# Super target for destroying infra.
.PHONY: all-destroy
all-destroy: vacuum-cluster \
cluster-rm \
networking-rm \
vpc-rm \
I guess you can just call shuttle in a script like
scripts:
all-destroy:
actions:
- shell: shuttle run vacuum-cluster
- shell: shuttle run cluster-rm
- shell: shuttle run networking-rm
- shell: shuttle run vpc-rm
It is a bit verbose ofc, but might work?
An alternative could be to add a shuttle script action so something like this would be possible:
scripts:
all-destroy:
actions:
- shuttle: vacuum-cluster
- shuttle: cluster-rm
- shuttle: networking-rm
- shuttle: vpc-rm
Not a whole lot better I think. WDYT?
Thanks @Crevil for replying. I get that the shuttlescript won't really give you that much more in terms of readability. But if you made it into an internal script action, then all env and flags you sent to shuttle would be the same in the child commands you detail in your action.
So in the original make script, I would like to be able to execute all the sub-targets regardless if one of them fails or not (imagine that part of my install script worked, and now I want to clean up).
Then I would need a --keep-going equivalent, that I then would love to trickle down to my child commands as well.
Does that make sense in your way of envisioning shuttle usage?
With the current shell action that would already work I think.
# shuttle.yaml
plan: false
scripts:
cluster-rm:
actions:
- shell: echo "Removing cluster from $hello"
all-destroy:
args:
- name: hello
actions:
- shell: shuttle run cluster-rm
When running all-destroy it can reference hello.
$ shuttle run all-destroy hello=world
Removing cluster from world
Is this what you want?
I need to play around with the solution you mention here. Let's close the task and I'll reopen when I have a bit more time to give constructive feedback. Thanks a lot for your replies so far :tada: