I was trying today to get a certain build plugin only “activating” on a branch deploy/deploy preview (i.e. not in the “production” build). However, because all examples for netlify.toml build plugins shows it as a “global” thing I have had to “work out” the toml for myself. I think I have it right, but both netlify build --dry --context=branch-deploy and a proper branch push deploy log don’t show my plugin being used. If I use the “standard” [[plugins]] section name I can see it in the build dry run output.
Upon further digging, I have a feeling that this is because [[plugins]] is “global” in the netlify.toml file, but when you use [context.xxxxx.some-key] you’re actually setting the key as if it were inside the global [build] section in the netlify.toml file. Is that right?
Either way, is there a way to use a build plugin in one context but not another? Or use it in all, but specify different inputs depending on context?
I think I can “hack” it for the time being by using multiple sites (though they all deploy from the same GH repo) and simply not having a specific env var specified in one of the sites (the plugin lukcily requires an env var for a secret).
I have thumbs upped and subscribed to the GH issue.
but don’t need this plugin to run on our CMS build because we won’t be running tests. There are also a few other plugins that I can see this being useful for.