datawire / forge

Define and run multi-container apps in Kubernetes
http://forge.sh
Apache License 2.0
417 stars 44 forks source link

Programmatic hook mechanism for before/after commands (e.g. build, deploy). #14

Open plombardi89 opened 7 years ago

plombardi89 commented 7 years ago

It would be really nice to be able to add custom code before and after commands. A real world use case of this would be to do something like istioctl kube-inject after forge build ... or forge deploy .... However, other use cases would be to glue in custom code that goes off and does something like send a Slack message or make an API call to another service.

Spit balling a bit of implementation I would like to see this work similar to how cookiecutter handles hooks: There is a directory called hooks which can have an arbitrary executable programs dropped into it. Some consideration will need to make, however, to account for the different commands in forge and also that there is likely some amount of ordering that needs to be followed.

mumoshu commented 6 years ago

@plombardi89 Great suggestion!

I also find it useful for #127.

With a hook/plugin mechanism, I could add a custom script which is run before/after forge build manifests. Before the build, it will decrypt every secret values so that forge can consume it as usual. After the build, forge doesn't need the decrypted values and therefore the custom script removes the decrypted files.

Btw, thanks for pointing to cookiecutter. Its plugin system was very inspiring for me.