Accessing plugins from modules

Here’s what I want I’m trying to accomplish:

I’m using a helm plugin called helm-unittest to test my helm chart logic: GitHub - quintush/helm-unittest: BDD styled unit test framework for Kubernetes Helm charts as a Helm plugin.

What I would like to do is use run helm plugin install from an exec module or task to install the plugin using the garden downloaded helm(plugin) if the helm plugin is not installed. I would like to also use the plugin helm to execute the tests helm unittest for the chart.

From what I can tell there is no information about the garden plugins in the exec environment.
Can I accomplish this today? Let me know!


Hi Scheuk

That’s an interesting use case. You can execute arbitrary commands with tools that Garden bundles by running garden tools <provider>.<tool> -- <params>.

That being said, I don’t think we’ve properly thought of this use case and the fact that the Helm binary Garden uses is not installed in the default location might cause issues.

I tried running garden tools kubernetes.helm -- plugin install on my end and bumped into this issue. I’m guessing that’s because the Helm location Garden uses doesn’t have the plugins dir. You could create it manually but that would break if we update the Helm version Garden uses internally, since each one gets installed at their own path (you can check out the .garden/tools dir to see what I mean).

However, you can run arbitrary local tasks and build commands from an exec module if you set local: true.

So just to give you an example, you can do something like this:

kind: Module
name: local-helm
type: exec
local: true
  - name: install-helm-plugin
    command: [helm, plugin, install,]
  - name: helm-unittest
    command: ["helm unittest"]
    dependencies: [install-helm-plugin]

But sounds like that’s not what you’re after since it relies on system Helm and may not be repeatable across environments.

We’d be happy to receive a feature request on GitHub for this functionality though but I don’t have a good feel for the scope of the work as things stand.