Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable selecting component to execute #5

Open
fibonacci1729 opened this issue Apr 2, 2024 · 6 comments
Open

Enable selecting component to execute #5

fibonacci1729 opened this issue Apr 2, 2024 · 6 comments

Comments

@fibonacci1729
Copy link
Contributor

Tracking this so it doesn't get lost.

Currently the trigger can execute only the first command component. We should define a trigger flag --id/--component-id that specifies which command component to execute.

@karthik2804
Copy link
Contributor

implementation detail question. I can imagine not having to specify anything if there is only one component. In cases where there are multiple, would it be required to specify the ID, or if it is not specified, we fall back to executing the first component? I think we should make it compulsory in the case of multiple components as otherwise, the behavior can be confusing if the user changes the order of the components specified.

@fibonacci1729
Copy link
Contributor Author

I agree. In the case of >1 components require the component selection flag.

@itowlson
Copy link

itowlson commented Apr 2, 2024

Is this the right idiom? Suppose, in my manifest, I write:

[[trigger.command]]
component = "do-the-thing"

[[trigger.command]]
component = "do-the-other-thing"

It's not very obvious what this could mean.

In any other trigger, that means all those triggers are instantiated and respond to events. The equivalent semantics would be that all command components run.

But then again, I am not sure what a meaningful use case is for multiple commands in a single application. Perhaps multiple instances of the command trigger should be a validation failure.

@karthik2804
Copy link
Contributor

karthik2804 commented Apr 2, 2024

It could potentially be useful to package multiple command into a suite (I would like to imagine something like busybox) which could be a singular artifact when published via oci, so that I do not need to download multiple images?

As far as the manifest in the example provided, I would hope the author has descriptive name 😅 .

@fibonacci1729
Copy link
Contributor Author

One usecase I can imagine is not needing to duplicate variable definitions across each application on a per command basis. So multiple commands in an application can share a singular set of variables.

@radu-matei
Copy link
Member

(my comment is not a feature request, just exploring the usefulness of multiple components)

There are two main scenarios I can think of here:

  • in Support combining the command trigger with other triggers #7, we're exploring potentially the ordering of execution of a command, basically creating something like "init components" for Spin. Having multiple command components here could be interpreted as "run these components in this order, to completion". This, of course, raises the question of the failure behavior.
  • to @fibonacci1729's point, selecting one component (rather than ordering the execution) could also be useful to avoid duplicating variables. This would be useful in particular when combined with the shim executor (and being able to choose the command component to run based on the "command" field in the pod spec).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants