dokku / plugn

Hook system that lets users extend your application with plugins
MIT License
82 stars 22 forks source link

Add support for downloading via tar.gz #19

Closed josegonzalez closed 7 years ago

josegonzalez commented 7 years ago

This adds support for installing a file with a .tar.gz. It will detect curl and wget support, using whichever is available, and then extract the downloaded file to the destination directory

josegonzalez commented 7 years ago

@michaelshobbs your smoke-test-plugin fails the pre-deploy trigger tests...

michaelshobbs commented 7 years ago

@josegonzalez looks like there are a couple issues here.

First, you are correct plugn itself doesn't call the install trigger and thus the plugin does not get compiled. Second, the command plugn install https://github.com/dokku/smoke-test-plugin/archive/v0.3.0.tar.gz smoke-test-plugin yields an incorrect directory structure. Thus, you get the error cat: /var/lib/plugins/available/smoke-test-plugin/plugin.toml: No such file or directory.

root@e3b2cab1f13c:~# find /var/lib/plugins -name "smoke*" -type d
/var/lib/plugins/available/smoke-test-plugin
/var/lib/plugins/available/smoke-test-plugin/smoke-test-plugin-0.3.0

Do we want plugn to handle the compilation step? If so, thoughts on how to detect that? Maybe run make only if there is a Makefile in the root?

josegonzalez commented 7 years ago

If it doesnt handle the install trigger, then we need to change our tests to do that, as it seems our testing is wrong.

Regarding the incorrect directory structure, thoughts on getting that working for github zips? Sorry, a bit groggy still.

michaelshobbs commented 7 years ago

Lemme play with the tar cmd. I'll push to this branch if I get it working.

Regarding the install trigger, the question remains of which component should be responsible for that? Currently dokku calls it. However, that may not be the correct place to do so. The crux of my question is, which component is responsible for triggering the install trigger?

josegonzalez commented 7 years ago

Can we trigger the install command for just a single plugin at a time? If so, then plugn should do that I think. Would be a breaking change - 0.3.0? - but I think better.

In dokku's case, we trigger the install thing and then it tries to install all the things, which may not be great if we are specifically interacting with one plugin.

Maybe in this case we just change tests to run install and punt on that issue for now?

michaelshobbs commented 7 years ago

Unfortunately, triggering a hook on a single plugin is counter to the design of plugn. We can just trigger in this test for now. Git commit inbound.

josegonzalez commented 7 years ago

Sweet that works for me.

josegonzalez commented 7 years ago

Not adding zip support for now. If someone requests it, we can add it then?