fermyon / spin-trigger-command

WIP Command Trigger for Spin
Apache License 2.0
4 stars 13 forks source link

WIP: add support for preview 2 components that target the wasi:cli world #1

Closed karthik2804 closed 6 months ago

karthik2804 commented 6 months ago

~This adds a field to the trigger similar to the http-trigger that needs to be set if running preview1 components.~

[[trigger.command]]
component = "sample"
# executor = { type = "preview1" }

This PR adds the ability for the trigger to support preview 2 components along with modules as well. It does it by attempting to load things as a component but falling back to attempting to load modules. The one other constraint it includes is that any preview 2 component supplied must target the wasi:cli world.

radu-matei commented 6 months ago

Can we infer preview1 vs. preview2 without having to explicitly set it in the manifest?

karthik2804 commented 6 months ago

We can attempt to load as a component and fall back to a module. I just tested it locally, and it appears to work as expected.

radu-matei commented 6 months ago

Tested this with both Preview 1 and Preview 2 components and everything looks good. Merging so we can iterate. Thanks!