Skip to content

Add SIP for target world validation #3217

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tschneidereit
Copy link
Contributor

@tschneidereit tschneidereit commented Aug 7, 2025

This SIP describes and motivates the functionality introduced in #2806.

Rendered

This SIP describes and motivates the functionality introduced in spinframework#2806.

Signed-off-by: Till Schneidereit <[email protected]>
@tschneidereit tschneidereit force-pushed the sip-validate-target-environment branch from ad2a273 to be389fb Compare August 7, 2025 09:57
Signed-off-by: Till Schneidereit <[email protected]>

Each entry in the list can be:
- A string that identifies an environment in the default registry (e.g., `"spin-up:3.3"`).
- A table with `registry` and `id` keys to identify an environment in a custom OCI registry.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should permit wkg registry names (bare domain) here with the /.well-known/wasm-pkg/registry.json indirection.

Copy link
Collaborator

@lann lann Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we could specify a slightly different syntax that implies this lookup, like

targets = ["my.org/[email protected]"]

This would look up the oci prefix at https://my.org/.well-known/wasm-pkg/registry.json and use it to construct an oci reference like ghcr.io/my-org/my-env:1.0. If we wanted to mechanically avoid conflicts between environments and regular wasm packages we could stick another substring in there e.g. ghcr.io/my-org/my-env:spin-env-1.0 or ghcr.io/my-org/spin-env/my-env:1.0 or something.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lann These entries point to TOML documents not WIT documents. (The TOML documents then point onward to WIT documents, which are typically wkg package references.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure; I'm suggesting that we could reuse the domain -> OCI mapping that wkg already implements to allow nicer specifications of targets from registries.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry thanks for the clarification

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a convenience feature we could add without breaking back compat if the feature achieves traction? Or are we sufficiently confident that other folks will be publishing environment TOMLs that we need to offer this in the first drop?

Comment on lines +52 to +53
[triggers.redis]
worlds = ["spin:up/[email protected]"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me wonder if we should accept e.g. { trigger_type = "redis", world = "spin:up/[email protected]" } as a valid target.

Copy link
Collaborator

@lann lann Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a slightly more verbose but flexible way to get the same effect would be allowing inline environment definitions. 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe the target could be just the world reference? While that wouldn't have explicit trigger types those can be sort of inferred from the manifest itself. 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lann I am wary of that for two reasons:

  1. It breaks down as soon as multi-trigger-type enters play - you find yourself needing to infer which world corresponds to which trigger type. We tried that and it was terrible.
  2. It breaks the "I want to make sure I can deploy to..." abstraction. The goal here is for the developer to say "I want this to run on Wasmtime 35, Spin 3.2, and SpinKube 3.1." If I want to target spin:up/[email protected], and figure out for myself whether that's compatible with SpinKube 3.1, then I have the tools to do that. The idea is to take care of "knowing which worlds a host supports" for you.

I'm not opposed to inline environments as an escape hatch, but I'd like them to be defined in the same way as other environments, and at that point I don't see a vast amount of value compared to putting them in a my-environment.toml file.

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

Successfully merging this pull request may close these issues.

4 participants