From 01f92d2781e75c5878cc6961374b544ff861a4cb Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 24 Oct 2024 14:53:46 -0700 Subject: [PATCH] cleanup: use component filtering utils from Spin crates Signed-off-by: Kate Goldenring --- Cargo.lock | 1104 +++++++++++++++++++++++----- containerd-shim-spin/Cargo.toml | 4 +- containerd-shim-spin/src/engine.rs | 11 +- containerd-shim-spin/src/main.rs | 1 - containerd-shim-spin/src/retain.rs | 241 ------ 5 files changed, 920 insertions(+), 441 deletions(-) delete mode 100644 containerd-shim-spin/src/retain.rs diff --git a/Cargo.lock b/Cargo.lock index aa2a54c..bc3dcb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,15 @@ dependencies = [ "gimli 0.28.1", ] +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli 0.29.0", +] + [[package]] name = "addr2line" version = "0.24.1" @@ -987,7 +996,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", "syn 2.0.77", ] @@ -1546,16 +1555,16 @@ dependencies = [ "openssl", "serde 1.0.210", "serde_json", - "spin-app", - "spin-common", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-componentize", "spin-core", - "spin-expressions", - "spin-factor-outbound-networking", - "spin-factors", + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factors-executor", "spin-loader", - "spin-manifest", + "spin-manifest 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-oci", "spin-runtime-factors", "spin-telemetry", @@ -1570,7 +1579,7 @@ dependencies = [ "trigger-mqtt", "trigger-sqs", "url", - "wasmtime", + "wasmtime 22.0.0", "wat", ] @@ -1649,7 +1658,26 @@ version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6b33d7e757a887989eb18b35712b2a67d96171ec3149d1bfb657b29b7b367c" dependencies = [ - "cranelift-entity", + "cranelift-entity 0.109.0", +] + +[[package]] +name = "cranelift-bforest" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b765ed4349e66bedd9b88c7691da42e24c7f62067a6be17ddffa949367b6e17" +dependencies = [ + "cranelift-entity 0.112.2", +] + +[[package]] +name = "cranelift-bitset" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eaa2aece6237198afd32bff57699e08d4dccb8d3902c214fc1e6ba907247ca4" +dependencies = [ + "serde 1.0.210", + "serde_derive", ] [[package]] @@ -1659,17 +1687,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9acf15cb22be42d07c3b57d7856329cb228b7315d385346149df2566ad5e4aa" dependencies = [ "bumpalo", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", + "cranelift-bforest 0.109.0", + "cranelift-codegen-meta 0.109.0", + "cranelift-codegen-shared 0.109.0", + "cranelift-control 0.109.0", + "cranelift-entity 0.109.0", + "cranelift-isle 0.109.0", "gimli 0.28.1", "hashbrown 0.14.5", "log", - "regalloc2", - "rustc-hash", + "regalloc2 0.9.3", + "rustc-hash 1.1.0", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "351824439e59d42f0e4fa5aac1d13deded155120043565769e55cd4ad3ca8ed9" +dependencies = [ + "bumpalo", + "cranelift-bforest 0.112.2", + "cranelift-bitset", + "cranelift-codegen-meta 0.112.2", + "cranelift-codegen-shared 0.112.2", + "cranelift-control 0.112.2", + "cranelift-entity 0.112.2", + "cranelift-isle 0.112.2", + "gimli 0.29.0", + "hashbrown 0.14.5", + "log", + "regalloc2 0.10.2", + "rustc-hash 2.0.0", "smallvec", "target-lexicon", ] @@ -1680,7 +1731,16 @@ version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e934d301392b73b3f8b0540391fb82465a0f179a3cee7c726482ac4727efcc97" dependencies = [ - "cranelift-codegen-shared", + "cranelift-codegen-shared 0.109.0", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a0ce0273d7a493ef8f31f606849a4e931c19187a4923f5f87fc1f2b13109981" +dependencies = [ + "cranelift-codegen-shared 0.112.2", ] [[package]] @@ -1689,6 +1749,12 @@ version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb2a2566b3d54b854dfb288b3b187f6d3d17d6f762c92898207eba302931da" +[[package]] +name = "cranelift-codegen-shared" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f72016ac35579051913f4f07f6b36c509ed69412d852fd44c8e1d7b7fa6d92a" + [[package]] name = "cranelift-control" version = "0.109.0" @@ -1698,6 +1764,15 @@ dependencies = [ "arbitrary", ] +[[package]] +name = "cranelift-control" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db28951d21512c4fd0554ef179bfb11e4eb6815062957a9173824eee5de0c46c" +dependencies = [ + "arbitrary", +] + [[package]] name = "cranelift-entity" version = "0.109.0" @@ -1708,13 +1783,36 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "cranelift-entity" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ebe592a2f81af9237cf9be29dd3854ecb72108cfffa59e85ef12389bf939e3" +dependencies = [ + "cranelift-bitset", + "serde 1.0.210", + "serde_derive", +] + [[package]] name = "cranelift-frontend" version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f74b84f16af2e982b0c0c72233503d9d55cbfe3865dbe807ca28dc6642a28b5" dependencies = [ - "cranelift-codegen", + "cranelift-codegen 0.109.0", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-frontend" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4437db9d60c7053ac91ded0802740c2ccf123ee6d6898dd906c34f8c530cd119" +dependencies = [ + "cranelift-codegen 0.112.2", "log", "smallvec", "target-lexicon", @@ -1726,13 +1824,30 @@ version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adf306d3dde705fb94bd48082f01d38c4ededc74293a4c007805f610bf08bc6e" +[[package]] +name = "cranelift-isle" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230cb33572b9926e210f2ca28145f2bc87f389e1456560932168e2591feb65c1" + [[package]] name = "cranelift-native" version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ea0ebdef7aff4a79bcbc8b6495f31315f16b3bf311152f472eaa8d679352581" dependencies = [ - "cranelift-codegen", + "cranelift-codegen 0.109.0", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-native" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "364524ac7aef7070b1141478724abebeec297d4ea1e87ad8b8986465e91146d9" +dependencies = [ + "cranelift-codegen 0.112.2", "libc", "target-lexicon", ] @@ -1743,14 +1858,30 @@ version = "0.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d549108a1942065cdbac3bb96c2952afa0e1b9a3beff4b08c4308ac72257576d" dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", + "cranelift-codegen 0.109.0", + "cranelift-entity 0.109.0", + "cranelift-frontend 0.109.0", "itertools 0.12.1", "log", "smallvec", "wasmparser 0.209.1", - "wasmtime-types", + "wasmtime-types 22.0.0", +] + +[[package]] +name = "cranelift-wasm" +version = "0.112.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0572cbd9d136a62c0f39837b6bce3b0978b96b8586794042bec0c214668fd6f5" +dependencies = [ + "cranelift-codegen 0.112.2", + "cranelift-entity 0.112.2", + "cranelift-frontend 0.112.2", + "itertools 0.12.1", + "log", + "smallvec", + "wasmparser 0.217.0", + "wasmtime-types 25.0.2", ] [[package]] @@ -2735,6 +2866,17 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +dependencies = [ + "fallible-iterator 0.3.0", + "indexmap 2.5.0", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.31.0" @@ -5805,7 +5947,20 @@ checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" dependencies = [ "hashbrown 0.13.2", "log", - "rustc-hash", + "rustc-hash 1.1.0", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regalloc2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12908dbeb234370af84d0579b9f68258a0f67e201412dd9a2814e6f45b2fc0f0" +dependencies = [ + "hashbrown 0.14.5", + "log", + "rustc-hash 2.0.0", "slice-group-by", "smallvec", ] @@ -6068,6 +6223,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc_version" version = "0.4.1" @@ -6861,10 +7022,21 @@ dependencies = [ "async-trait", "serde 1.0.210", "serde_json", - "spin-locked-app", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "thiserror", ] +[[package]] +name = "spin-app" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "serde 1.0.210", + "serde_json", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", +] + [[package]] name = "spin-common" version = "2.8.0-pre0" @@ -6878,6 +7050,19 @@ dependencies = [ "url", ] +[[package]] +name = "spin-common" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "dirs 5.0.1", + "sha2", + "tempfile", + "tokio", + "url", +] + [[package]] name = "spin-componentize" version = "2.8.0-pre0" @@ -6901,9 +7086,9 @@ dependencies = [ "async-trait", "indexmap 2.5.0", "semver", - "spin-app", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-componentize", - "spin-serde", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "thiserror", "tokio", "wac-graph", @@ -6917,7 +7102,7 @@ dependencies = [ "anyhow", "async-trait", "tracing", - "wasmtime", + "wasmtime 22.0.0", ] [[package]] @@ -6930,7 +7115,18 @@ dependencies = [ "dotenvy", "once_cell", "serde 1.0.210", - "spin-locked-app", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "thiserror", +] + +[[package]] +name = "spin-expressions" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "async-trait", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", "thiserror", ] @@ -6943,9 +7139,9 @@ dependencies = [ "lru 0.9.0", "serde 1.0.210", "spin-core", - "spin-factors", - "spin-locked-app", - "spin-world", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tokio", "toml 0.8.19", @@ -6960,10 +7156,10 @@ dependencies = [ "anyhow", "async-trait", "serde 1.0.210", - "spin-factors", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-llm-remote-http", - "spin-locked-app", - "spin-world", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", "toml 0.8.19", "tracing", @@ -6982,16 +7178,16 @@ dependencies = [ "ip_network", "reqwest 0.12.7", "rustls 0.23.13", - "spin-factor-outbound-networking", - "spin-factors", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-telemetry", - "spin-world", - "terminal", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", "tokio-rustls 0.26.0", "tracing", - "wasmtime", - "wasmtime-wasi", + "wasmtime 22.0.0", + "wasmtime-wasi 22.0.0", "wasmtime-wasi-http", ] @@ -7003,9 +7199,9 @@ dependencies = [ "anyhow", "rumqttc", "spin-core", - "spin-factor-outbound-networking", - "spin-factors", - "spin-world", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tokio", "tracing", @@ -7020,12 +7216,12 @@ dependencies = [ "flate2", "mysql_async", "mysql_common", - "spin-app", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-core", - "spin-expressions", - "spin-factor-outbound-networking", - "spin-factors", - "spin-world", + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tokio", "tracing", @@ -7045,14 +7241,40 @@ dependencies = [ "rustls-pemfile 2.1.3", "rustls-pki-types", "serde 1.0.210", - "spin-expressions", - "spin-factor-variables", - "spin-factor-wasi", - "spin-factors", - "spin-locked-app", - "spin-manifest", - "spin-serde", - "terminal", + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-variables 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-manifest 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "tracing", + "url", + "urlencoding", + "webpki-roots 0.26.5", +] + +[[package]] +name = "spin-factor-outbound-networking" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "futures-util", + "http 1.1.0", + "ipnet", + "rustls 0.23.13", + "rustls-pemfile 2.1.3", + "rustls-pki-types", + "serde 1.0.210", + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factor-variables 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-manifest 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", "tracing", "url", "urlencoding", @@ -7068,9 +7290,9 @@ dependencies = [ "native-tls", "postgres-native-tls", "spin-core", - "spin-factor-outbound-networking", - "spin-factors", - "spin-world", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tokio", "tokio-postgres", @@ -7085,9 +7307,9 @@ dependencies = [ "anyhow", "redis 0.21.7", "spin-core", - "spin-factor-outbound-networking", - "spin-factors", - "spin-world", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tracing", ] @@ -7099,9 +7321,9 @@ source = "git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5fe dependencies = [ "async-trait", "serde 1.0.210", - "spin-factors", - "spin-locked-app", - "spin-world", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tokio", "toml 0.8.19", @@ -7118,15 +7340,26 @@ dependencies = [ "azure_security_keyvault", "dotenvy", "serde 1.0.210", - "spin-expressions", - "spin-factors", - "spin-world", + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", "toml 0.8.19", "tracing", "vaultrs", ] +[[package]] +name = "spin-factor-variables" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "tracing", +] + [[package]] name = "spin-factor-wasi" version = "2.8.0-pre0" @@ -7135,11 +7368,25 @@ dependencies = [ "async-trait", "bytes", "cap-primitives", - "spin-common", - "spin-factors", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "tokio", + "wasmtime 22.0.0", + "wasmtime-wasi 22.0.0", +] + +[[package]] +name = "spin-factor-wasi" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "async-trait", + "bytes", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", "tokio", - "wasmtime", - "wasmtime-wasi", + "wasmtime 25.0.2", + "wasmtime-wasi 25.0.2", ] [[package]] @@ -7149,12 +7396,26 @@ source = "git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5fe dependencies = [ "anyhow", "serde 1.0.210", - "spin-app", - "spin-factors-derive", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors-derive 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "thiserror", "toml 0.8.19", "tracing", - "wasmtime", + "wasmtime 22.0.0", +] + +[[package]] +name = "spin-factors" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "serde 1.0.210", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "spin-factors-derive 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "thiserror", + "toml 0.8.19", + "wasmtime 25.0.2", ] [[package]] @@ -7167,15 +7428,25 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "spin-factors-derive" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "spin-factors-executor" version = "2.8.0-pre0" source = "git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c#485b04090644ecfda4d0034891a5feca9a90332c" dependencies = [ "anyhow", - "spin-app", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-core", - "spin-factors", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", ] [[package]] @@ -7191,8 +7462,8 @@ dependencies = [ "percent-encoding", "routefinder", "serde 1.0.210", - "spin-app", - "spin-locked-app", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tracing", "wasmtime-wasi-http", ] @@ -7223,7 +7494,7 @@ dependencies = [ "serde 1.0.210", "spin-core", "spin-factor-key-value", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", "url", ] @@ -7239,7 +7510,7 @@ dependencies = [ "serde 1.0.210", "spin-core", "spin-factor-key-value", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", ] @@ -7254,7 +7525,7 @@ dependencies = [ "serde 1.0.210", "serde_json", "spin-telemetry", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tracing", ] @@ -7281,13 +7552,13 @@ dependencies = [ "serde_json", "sha2", "shellexpand 3.1.0", - "spin-common", - "spin-factor-outbound-networking", - "spin-locked-app", - "spin-manifest", - "spin-serde", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-manifest 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tempfile", - "terminal", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "thiserror", "tokio", "tokio-util 0.6.10", @@ -7306,7 +7577,20 @@ dependencies = [ "async-trait", "serde 1.0.210", "serde_json", - "spin-serde", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "thiserror", +] + +[[package]] +name = "spin-locked-app" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "async-trait", + "serde 1.0.210", + "serde_json", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", "thiserror", ] @@ -7319,8 +7603,25 @@ dependencies = [ "indexmap 1.9.3", "semver", "serde 1.0.210", - "spin-serde", - "terminal", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "thiserror", + "toml 0.8.19", + "url", + "wasm-pkg-common", +] + +[[package]] +name = "spin-manifest" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "indexmap 2.5.0", + "semver", + "serde 1.0.210", + "spin-serde 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c)", "thiserror", "toml 0.8.19", "url", @@ -7346,10 +7647,10 @@ dependencies = [ "reqwest 0.11.27", "serde 1.0.210", "serde_json", - "spin-common", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-loader", - "spin-locked-app", - "spin-manifest", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-manifest 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tempfile", "tokio", "tokio-util 0.7.12", @@ -7363,19 +7664,19 @@ version = "2.8.0-pre0" source = "git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c#485b04090644ecfda4d0034891a5feca9a90332c" dependencies = [ "anyhow", - "spin-common", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factor-key-value", "spin-factor-llm", "spin-factor-outbound-http", "spin-factor-outbound-mqtt", "spin-factor-outbound-mysql", - "spin-factor-outbound-networking", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factor-outbound-pg", "spin-factor-outbound-redis", "spin-factor-sqlite", - "spin-factor-variables", - "spin-factor-wasi", - "spin-factors", + "spin-factor-variables 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-key-value-azure", "spin-key-value-redis", "spin-key-value-spin", @@ -7391,24 +7692,24 @@ source = "git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5fe dependencies = [ "anyhow", "clap 3.2.25", - "spin-common", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factor-key-value", "spin-factor-llm", "spin-factor-outbound-http", "spin-factor-outbound-mqtt", "spin-factor-outbound-mysql", - "spin-factor-outbound-networking", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factor-outbound-pg", "spin-factor-outbound-redis", "spin-factor-sqlite", - "spin-factor-variables", - "spin-factor-wasi", - "spin-factors", + "spin-factor-variables 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factors-executor", "spin-runtime-config", "spin-telemetry", "spin-trigger", - "terminal", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tracing", ] @@ -7424,6 +7725,18 @@ dependencies = [ "wasm-pkg-common", ] +[[package]] +name = "spin-serde" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "anyhow", + "base64 0.22.1", + "semver", + "serde 1.0.210", + "wasm-pkg-common", +] + [[package]] name = "spin-sqlite" version = "2.8.0-pre0" @@ -7432,11 +7745,11 @@ dependencies = [ "async-trait", "serde 1.0.210", "spin-factor-sqlite", - "spin-factors", - "spin-locked-app", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-locked-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-sqlite-inproc", "spin-sqlite-libsql", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "table", "tokio", "toml 0.8.19", @@ -7453,7 +7766,7 @@ dependencies = [ "rand 0.8.5", "rusqlite", "spin-factor-sqlite", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", ] @@ -7467,7 +7780,7 @@ dependencies = [ "libsql", "rusqlite", "spin-factor-sqlite", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "sqlparser", "tokio", ] @@ -7484,7 +7797,7 @@ dependencies = [ "opentelemetry-otlp", "opentelemetry-semantic-conventions", "opentelemetry_sdk", - "terminal", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tracing", "tracing-appender", "tracing-opentelemetry", @@ -7504,15 +7817,15 @@ dependencies = [ "sanitize-filename", "serde 1.0.210", "serde_json", - "spin-app", - "spin-common", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-common 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-componentize", "spin-compose", "spin-core", "spin-factor-key-value", "spin-factor-sqlite", - "spin-factor-wasi", - "spin-factors", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-factors-executor", "spin-telemetry", "tokio", @@ -7541,23 +7854,23 @@ dependencies = [ "rustls-pki-types", "serde 1.0.210", "serde_json", - "spin-app", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-core", "spin-factor-outbound-http", - "spin-factor-outbound-networking", - "spin-factor-wasi", - "spin-factors", + "spin-factor-outbound-networking 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-http", "spin-telemetry", "spin-trigger", - "spin-world", - "terminal", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "terminal 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", "tokio-rustls 0.26.0", "tracing", "url", - "wasmtime", - "wasmtime-wasi", + "wasmtime 22.0.0", + "wasmtime-wasi 22.0.0", "wasmtime-wasi-http", "webpki-roots 0.26.5", ] @@ -7572,11 +7885,11 @@ dependencies = [ "futures", "redis 0.26.1", "serde 1.0.210", - "spin-factor-variables", - "spin-factors", + "spin-factor-variables 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-telemetry", "spin-trigger", - "spin-world", + "spin-world 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "tokio", "tracing", ] @@ -7587,7 +7900,16 @@ version = "2.8.0-pre0" source = "git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c#485b04090644ecfda4d0034891a5feca9a90332c" dependencies = [ "async-trait", - "wasmtime", + "wasmtime 22.0.0", +] + +[[package]] +name = "spin-world" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "async-trait", + "wasmtime 25.0.2", ] [[package]] @@ -7861,6 +8183,14 @@ dependencies = [ "termcolor", ] +[[package]] +name = "terminal" +version = "2.8.0-pre0" +source = "git+https://github.com/fermyon/spin?rev=d814705824529896571dd70eccf0ab235c6d269c#d814705824529896571dd70eccf0ab235c6d269c" +dependencies = [ + "termcolor", +] + [[package]] name = "test-environment" version = "0.1.0" @@ -8419,14 +8749,14 @@ dependencies = [ "openssl", "serde 1.0.210", "spin-core", - "spin-factor-wasi", - "spin-factors", + "spin-factor-wasi 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-runtime-factors", "spin-telemetry", "spin-trigger", "tokio", "tracing", - "wasmtime-wasi", + "wasmtime-wasi 22.0.0", ] [[package]] @@ -8439,17 +8769,17 @@ dependencies = [ "futures", "paho-mqtt", "serde 1.0.210", - "spin-app", + "spin-app 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-core", - "spin-expressions", - "spin-factor-variables", - "spin-factors", + "spin-expressions 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factor-variables 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-runtime-factors", "spin-telemetry", "spin-trigger", "tokio", "tracing", - "wasmtime", + "wasmtime 22.0.0", ] [[package]] @@ -8465,14 +8795,14 @@ dependencies = [ "openssl", "serde 1.0.210", "spin-core", - "spin-factors", + "spin-factors 2.8.0-pre0 (git+https://github.com/fermyon/spin?rev=485b04090644ecfda4d0034891a5feca9a90332c)", "spin-runtime-factors", "spin-telemetry", "spin-trigger", "tokio", "tokio-scoped", "tracing", - "wasmtime", + "wasmtime 22.0.0", ] [[package]] @@ -9271,17 +9601,31 @@ dependencies = [ ] [[package]] -name = "wasmprinter" -version = "0.2.80" +name = "wasmparser" +version = "0.217.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" +checksum = "ca917a21307d3adf2b9857b94dd05ebf8496bdcff4437a9b9fb3899d3e6c74e7" dependencies = [ - "anyhow", - "wasmparser 0.121.2", -] - -[[package]] -name = "wasmprinter" + "ahash", + "bitflags 2.6.0", + "hashbrown 0.14.5", + "indexmap 2.5.0", + "semver", + "serde 1.0.210", +] + +[[package]] +name = "wasmprinter" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" +dependencies = [ + "anyhow", + "wasmparser 0.121.2", +] + +[[package]] +name = "wasmprinter" version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceca8ae6eaa8c7c87b33c25c53bdf299f8c2a764aee1179402ff7652ef3a6859" @@ -9290,6 +9634,17 @@ dependencies = [ "wasmparser 0.209.1", ] +[[package]] +name = "wasmprinter" +version = "0.217.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dc568b3e0d47e8f96ea547c90790cfa783f0205160c40de894a427114185ce" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.217.0", +] + [[package]] name = "wasmtime" version = "22.0.0" @@ -9330,18 +9685,74 @@ dependencies = [ "target-lexicon", "wasm-encoder 0.209.1", "wasmparser 0.209.1", - "wasmtime-asm-macros", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-component-util", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", - "wasmtime-slab", - "wasmtime-versioned-export-macros", - "wasmtime-winch", + "wasmtime-asm-macros 22.0.0", + "wasmtime-cache 22.0.0", + "wasmtime-component-macro 22.0.0", + "wasmtime-component-util 22.0.0", + "wasmtime-cranelift 22.0.0", + "wasmtime-environ 22.0.0", + "wasmtime-fiber 22.0.0", + "wasmtime-jit-debug 22.0.0", + "wasmtime-jit-icache-coherence 22.0.0", + "wasmtime-slab 22.0.0", + "wasmtime-versioned-export-macros 22.0.0", + "wasmtime-winch 22.0.0", + "wat", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef01f9cb9636ed42a7ec5a09d785c0643590199dc7372dc22c7e2ba7a31a97d4" +dependencies = [ + "addr2line 0.22.0", + "anyhow", + "async-trait", + "bitflags 2.6.0", + "bumpalo", + "cc", + "cfg-if 1.0.0", + "encoding_rs", + "fxprof-processed-profile", + "gimli 0.29.0", + "hashbrown 0.14.5", + "indexmap 2.5.0", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix 0.38.37", + "semver", + "serde 1.0.210", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.217.0", + "wasmparser 0.217.0", + "wasmtime-asm-macros 25.0.2", + "wasmtime-cache 25.0.2", + "wasmtime-component-macro 25.0.2", + "wasmtime-component-util 25.0.2", + "wasmtime-cranelift 25.0.2", + "wasmtime-environ 25.0.2", + "wasmtime-fiber 25.0.2", + "wasmtime-jit-debug 25.0.2", + "wasmtime-jit-icache-coherence 25.0.2", + "wasmtime-slab 25.0.2", + "wasmtime-versioned-export-macros 25.0.2", + "wasmtime-winch 25.0.2", "wat", "windows-sys 0.52.0", ] @@ -9355,6 +9766,15 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "wasmtime-asm-macros" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5b20797419d6baf2296db2354f864e8bb3447cacca9d151ce7700ae08b4460" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "wasmtime-cache" version = "22.0.0" @@ -9375,6 +9795,26 @@ dependencies = [ "zstd 0.13.2", ] +[[package]] +name = "wasmtime-cache" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "272d5939e989c5b54e3fa83ef420e4a6dba3995c3065626066428b2f73ad1e06" +dependencies = [ + "anyhow", + "base64 0.21.7", + "directories-next", + "log", + "postcard", + "rustix 0.38.37", + "serde 1.0.210", + "serde_derive", + "sha2", + "toml 0.8.19", + "windows-sys 0.52.0", + "zstd 0.13.2", +] + [[package]] name = "wasmtime-component-macro" version = "22.0.0" @@ -9385,17 +9825,38 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.77", - "wasmtime-component-util", - "wasmtime-wit-bindgen", + "wasmtime-component-util 22.0.0", + "wasmtime-wit-bindgen 22.0.0", "wit-parser 0.209.1", ] +[[package]] +name = "wasmtime-component-macro" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26593c4b18c76ca3c3fbdd813d6692256537b639b851d8a6fe827e3d6966fc01" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.77", + "wasmtime-component-util 25.0.2", + "wasmtime-wit-bindgen 25.0.2", + "wit-parser 0.217.0", +] + [[package]] name = "wasmtime-component-util" version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d2912c53d9054984b380dfbd7579f9c3681b2a73b903a56bd71a1c4f175f1e" +[[package]] +name = "wasmtime-component-util" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ed562fbb0cbed20a56c369c8de146c1de06a48c19e26ed9aa45f073514ee60" + [[package]] name = "wasmtime-cranelift" version = "22.0.0" @@ -9404,20 +9865,45 @@ checksum = "a3975deafea000457ba84355c7c0fce0372937204f77026510b7b454f28a3a65" dependencies = [ "anyhow", "cfg-if 1.0.0", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", + "cranelift-codegen 0.109.0", + "cranelift-control 0.109.0", + "cranelift-entity 0.109.0", + "cranelift-frontend 0.109.0", + "cranelift-native 0.109.0", + "cranelift-wasm 0.109.0", "gimli 0.28.1", "log", "object", "target-lexicon", "thiserror", "wasmparser 0.209.1", - "wasmtime-environ", - "wasmtime-versioned-export-macros", + "wasmtime-environ 22.0.0", + "wasmtime-versioned-export-macros 22.0.0", +] + +[[package]] +name = "wasmtime-cranelift" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f389b789cbcb53a8499131182135dea21d7d97ad77e7fb66830f69479ef0e68c" +dependencies = [ + "anyhow", + "cfg-if 1.0.0", + "cranelift-codegen 0.112.2", + "cranelift-control 0.112.2", + "cranelift-entity 0.112.2", + "cranelift-frontend 0.112.2", + "cranelift-native 0.112.2", + "cranelift-wasm 0.112.2", + "gimli 0.29.0", + "log", + "object", + "smallvec", + "target-lexicon", + "thiserror", + "wasmparser 0.217.0", + "wasmtime-environ 25.0.2", + "wasmtime-versioned-export-macros 25.0.2", ] [[package]] @@ -9428,7 +9914,7 @@ checksum = "f444e900e848b884d8a8a2949b6f5b92af642a3e663ff8fbe78731143a55be61" dependencies = [ "anyhow", "cpp_demangle", - "cranelift-entity", + "cranelift-entity 0.109.0", "gimli 0.28.1", "indexmap 2.5.0", "log", @@ -9441,8 +9927,35 @@ dependencies = [ "wasm-encoder 0.209.1", "wasmparser 0.209.1", "wasmprinter 0.209.1", - "wasmtime-component-util", - "wasmtime-types", + "wasmtime-component-util 22.0.0", + "wasmtime-types 22.0.0", +] + +[[package]] +name = "wasmtime-environ" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b72debe8899f19bedf66f7071310f06ef62de943a1369ba9b373613e77dd3d" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bitset", + "cranelift-entity 0.112.2", + "gimli 0.29.0", + "indexmap 2.5.0", + "log", + "object", + "postcard", + "rustc-demangle", + "semver", + "serde 1.0.210", + "serde_derive", + "target-lexicon", + "wasm-encoder 0.217.0", + "wasmparser 0.217.0", + "wasmprinter 0.217.0", + "wasmtime-component-util 25.0.2", + "wasmtime-types 25.0.2", ] [[package]] @@ -9455,8 +9968,23 @@ dependencies = [ "cc", "cfg-if 1.0.0", "rustix 0.38.37", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", + "wasmtime-asm-macros 22.0.0", + "wasmtime-versioned-export-macros 22.0.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-fiber" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92b8d4d504266ee598204f9e69cea8714499cc7c5aeddaa9b3f76aaace8b0680" +dependencies = [ + "anyhow", + "cc", + "cfg-if 1.0.0", + "rustix 0.38.37", + "wasmtime-asm-macros 25.0.2", + "wasmtime-versioned-export-macros 25.0.2", "windows-sys 0.52.0", ] @@ -9469,7 +9997,19 @@ dependencies = [ "object", "once_cell", "rustix 0.38.37", - "wasmtime-versioned-export-macros", + "wasmtime-versioned-export-macros 22.0.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ed7f0bbb9da3252c252b05fcd5fd42672db161e6276aa96e92059500247d8c" +dependencies = [ + "object", + "once_cell", + "rustix 0.38.37", + "wasmtime-versioned-export-macros 25.0.2", ] [[package]] @@ -9484,25 +10024,57 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930bc1325bc0448be6a11754156d770f56f6c3a61f440e9567f36cd2ea3065" +dependencies = [ + "anyhow", + "cfg-if 1.0.0", + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "wasmtime-slab" version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a7de1f2bec5bbb35d532e61c85c049dc84ae671df60492f90b954ecf21169e7" +[[package]] +name = "wasmtime-slab" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055a181b8d03998511294faea14798df436503f14d7fd20edcf7370ec583e80a" + [[package]] name = "wasmtime-types" version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "412463e9000e14cf6856be48628d2213c20c153e29ffc22b036980c892ea6964" dependencies = [ - "cranelift-entity", + "cranelift-entity 0.109.0", "serde 1.0.210", "serde_derive", "smallvec", "wasmparser 0.209.1", ] +[[package]] +name = "wasmtime-types" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8340d976673ac3fdacac781f2afdc4933920c1adc738c3409e825dab3955399" +dependencies = [ + "anyhow", + "cranelift-entity 0.112.2", + "serde 1.0.210", + "serde_derive", + "smallvec", + "wasmparser 0.217.0", +] + [[package]] name = "wasmtime-versioned-export-macros" version = "22.0.0" @@ -9514,6 +10086,17 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "wasmtime-versioned-export-macros" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b0c1f76891f778db9602ee3fbb4eb7e9a3f511847d1fb1b69eddbcea28303c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "wasmtime-wasi" version = "22.0.0" @@ -9540,8 +10123,39 @@ dependencies = [ "tokio", "tracing", "url", - "wasmtime", - "wiggle", + "wasmtime 22.0.0", + "wiggle 22.0.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-wasi" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1497b38341acc97308d6ce784598419fe0131bf6ddc5cda16a91033ef7c66e" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.6.0", + "bytes", + "cap-fs-ext", + "cap-net-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "futures", + "io-extras", + "io-lifetimes 2.0.3", + "once_cell", + "rustix 0.38.37", + "system-interface", + "thiserror", + "tokio", + "tracing", + "url", + "wasmtime 25.0.2", + "wiggle 25.0.2", "windows-sys 0.52.0", ] @@ -9563,8 +10177,8 @@ dependencies = [ "tokio", "tokio-rustls 0.25.0", "tracing", - "wasmtime", - "wasmtime-wasi", + "wasmtime 22.0.0", + "wasmtime-wasi 22.0.0", "webpki-roots 0.26.5", ] @@ -9575,14 +10189,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed4db238a0241df2d15f79ad17b3a37a27f2ea6cb885894d81b42ae107544466" dependencies = [ "anyhow", - "cranelift-codegen", + "cranelift-codegen 0.109.0", "gimli 0.28.1", "object", "target-lexicon", "wasmparser 0.209.1", - "wasmtime-cranelift", - "wasmtime-environ", - "winch-codegen", + "wasmtime-cranelift 22.0.0", + "wasmtime-environ 22.0.0", + "winch-codegen 0.20.0", +] + +[[package]] +name = "wasmtime-winch" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a702ff5eff3b37c11453ec8b54ec444bb9f2c689c7a7af382766c52df86b1e9b" +dependencies = [ + "anyhow", + "cranelift-codegen 0.112.2", + "gimli 0.29.0", + "object", + "target-lexicon", + "wasmparser 0.217.0", + "wasmtime-cranelift 25.0.2", + "wasmtime-environ 25.0.2", + "winch-codegen 0.23.2", ] [[package]] @@ -9597,6 +10228,18 @@ dependencies = [ "wit-parser 0.209.1", ] +[[package]] +name = "wasmtime-wit-bindgen" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2fca2cbb5bb390f65d4434c19bf8d9873dfc60f10802918ebcd6f819a38d703" +dependencies = [ + "anyhow", + "heck 0.4.1", + "indexmap 2.5.0", + "wit-parser 0.217.0", +] + [[package]] name = "wast" version = "35.0.2" @@ -9716,8 +10359,23 @@ dependencies = [ "bitflags 2.6.0", "thiserror", "tracing", - "wasmtime", - "wiggle-macro", + "wasmtime 22.0.0", + "wiggle-macro 22.0.0", +] + +[[package]] +name = "wiggle" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ebee2be6b561d1fe91b37e960c02baa94cdee29af863f5f26a0637f344f27a" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.6.0", + "thiserror", + "tracing", + "wasmtime 25.0.2", + "wiggle-macro 25.0.2", ] [[package]] @@ -9735,6 +10393,21 @@ dependencies = [ "witx", ] +[[package]] +name = "wiggle-generate" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97c4a32959189041ccb260e6dfa7fcf907e665166e755a6a681c32423c90e45f" +dependencies = [ + "anyhow", + "heck 0.4.1", + "proc-macro2", + "quote", + "shellexpand 2.1.2", + "syn 2.0.77", + "witx", +] + [[package]] name = "wiggle-macro" version = "22.0.0" @@ -9744,7 +10417,19 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.77", - "wiggle-generate", + "wiggle-generate 22.0.0", +] + +[[package]] +name = "wiggle-macro" +version = "25.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1c266e16c4b24a29e055ec651e27fce1389c886bb00fbe78b8924a253a439b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", + "wiggle-generate 25.0.2", ] [[package]] @@ -9785,14 +10470,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c6915884e731b2db0d8cf08cb64474cb69221a161675fd3c135f91febc3daa" dependencies = [ "anyhow", - "cranelift-codegen", + "cranelift-codegen 0.109.0", "gimli 0.28.1", - "regalloc2", + "regalloc2 0.9.3", "smallvec", "target-lexicon", "wasmparser 0.209.1", - "wasmtime-cranelift", - "wasmtime-environ", + "wasmtime-cranelift 22.0.0", + "wasmtime-environ 22.0.0", +] + +[[package]] +name = "winch-codegen" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d716f7c87db8ea79f1dc69f7344354b6256451bccca422ac4c3e0d607d144532" +dependencies = [ + "anyhow", + "cranelift-codegen 0.112.2", + "gimli 0.29.0", + "regalloc2 0.10.2", + "smallvec", + "target-lexicon", + "wasmparser 0.217.0", + "wasmtime-cranelift 25.0.2", + "wasmtime-environ 25.0.2", ] [[package]] @@ -10094,6 +10796,24 @@ dependencies = [ "wasmparser 0.209.1", ] +[[package]] +name = "wit-parser" +version = "0.217.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb893dcd6d370cfdf19a0d9adfcd403efb8e544e1a0ea3a8b81a21fe392eaa78" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.5.0", + "log", + "semver", + "serde 1.0.210", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.217.0", +] + [[package]] name = "witx" version = "0.9.1" diff --git a/containerd-shim-spin/Cargo.toml b/containerd-shim-spin/Cargo.toml index 741e65d..dc54fe1 100644 --- a/containerd-shim-spin/Cargo.toml +++ b/containerd-shim-spin/Cargo.toml @@ -15,7 +15,7 @@ containerd-shim-wasm = "0.6.0" containerd-shim = "0.7.1" http = "1" log = "0.4" -spin-app = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } +spin-app = { git = "https://github.com/fermyon/spin", rev = "d814705824529896571dd70eccf0ab235c6d269c" } spin-core = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } spin-componentize = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } # Enable loading components precompiled by the shim @@ -36,7 +36,7 @@ spin-factors-executor = { git = "https://github.com/fermyon/spin", rev = "485b04 spin-telemetry = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } spin-runtime-factors = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } spin-factors = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } -spin-factor-outbound-networking = { git = "https://github.com/fermyon/spin", rev = "485b04090644ecfda4d0034891a5feca9a90332c" } +spin-factor-outbound-networking = { git = "https://github.com/fermyon/spin", rev = "d814705824529896571dd70eccf0ab235c6d269c" } wasmtime = "22.0" tokio = { version = "1", features = ["rt"] } openssl = { version = "*", features = ["vendored"] } diff --git a/containerd-shim-spin/src/engine.rs b/containerd-shim-spin/src/engine.rs index a09fd9f..114bbec 100644 --- a/containerd-shim-spin/src/engine.rs +++ b/containerd-shim-spin/src/engine.rs @@ -13,6 +13,7 @@ use containerd_shim_wasm::{ use futures::future; use log::info; use spin_app::locked::LockedApp; +use spin_factor_outbound_networking::validate_service_chaining_for_components; use spin_trigger::cli::NoCliArgs; use spin_trigger_http::HttpTrigger; use spin_trigger_redis::RedisTrigger; @@ -137,11 +138,11 @@ impl SpinEngine { let cache = initialize_cache().await?; let app_source = Source::from_ctx(ctx, &cache).await?; let mut locked_app = app_source.to_locked_app(&cache).await?; - let components_to_execute = env::var(constants::SPIN_COMPONENTS_TO_RETAIN_ENV) - .ok() - .map(|s| s.split(',').map(|s| s.to_string()).collect::>()); - if let Some(components) = components_to_execute { - crate::retain::retain_components(&mut locked_app, &components)?; + if let Some(components_env) = env::var(constants::SPIN_COMPONENTS_TO_RETAIN_ENV).ok() { + let components = components_env.split(',').collect::>(); + locked_app = spin_app::retain_components(locked_app, &components, &[&validate_service_chaining_for_components]).context( + "failed to resolve application with only [{components:?}] components retained", + )?; } configure_application_variables_from_environment_variables(&locked_app)?; let trigger_cmds = get_supported_triggers(&locked_app) diff --git a/containerd-shim-spin/src/main.rs b/containerd-shim-spin/src/main.rs index 51ca64a..75b5915 100644 --- a/containerd-shim-spin/src/main.rs +++ b/containerd-shim-spin/src/main.rs @@ -6,7 +6,6 @@ use containerd_shim_wasm::{ mod constants; mod engine; -mod retain; mod source; mod trigger; mod utils; diff --git a/containerd-shim-spin/src/retain.rs b/containerd-shim-spin/src/retain.rs deleted file mode 100644 index ba5cc45..0000000 --- a/containerd-shim-spin/src/retain.rs +++ /dev/null @@ -1,241 +0,0 @@ -//! This module contains the logic for modifying a locked app to only contain a subset of its components - -use std::collections::HashSet; - -use anyhow::{bail, Context, Result}; -use spin_app::locked::LockedApp; -use spin_factor_outbound_networking::{allowed_outbound_hosts, parse_service_chaining_target}; - -/// Scrubs the locked app to only contain the given list of components -/// Introspects the LockedApp to find and selectively retain the triggers that correspond to those components -pub fn retain_components(locked_app: &mut LockedApp, retained_components: &[String]) -> Result<()> { - // Create a temporary app to access parsed component and trigger information - let tmp_app = spin_app::App::new("tmp", locked_app.clone()); - validate_retained_components_exist(&tmp_app, retained_components)?; - validate_retained_components_service_chaining(&tmp_app, retained_components)?; - let (component_ids, trigger_ids): (HashSet, HashSet) = tmp_app - .triggers() - .filter_map(|t| match t.component() { - Ok(comp) if retained_components.contains(&comp.id().to_string()) => { - Some((comp.id().to_owned(), t.id().to_owned())) - } - _ => None, - }) - .collect(); - locked_app - .components - .retain(|c| component_ids.contains(&c.id)); - locked_app.triggers.retain(|t| trigger_ids.contains(&t.id)); - Ok(()) -} - -// Validates that all service chaining of an app will be satisfied by the -// retained components. -// -// This does a best effort look up of components that are -// allowed to be accessed through service chaining and will error early if a -// component is configured to to chain to another component that is not -// retained. All wildcard service chaining is disallowed and all templated URLs -// are ignored. -fn validate_retained_components_service_chaining( - app: &spin_app::App, - retained_components: &[String], -) -> Result<()> { - app - .triggers().try_for_each(|t| { - let Ok(component) = t.component() else { return Ok(()) }; - if retained_components.contains(&component.id().to_string()) { - let allowed_hosts = allowed_outbound_hosts(&component).context("failed to get allowed hosts")?; - for host in allowed_hosts { - // Templated URLs are not yet resolved at this point, so ignore unresolvable URIs - if let Ok(uri) = host.parse::() { - if let Some(chaining_target) = parse_service_chaining_target(&uri) { - if !retained_components.contains(&chaining_target) { - if chaining_target == "*" { - bail!("Component selected with '--component {}' cannot use wildcard service chaining: allowed_outbound_hosts = [\"http://*.spin.internal\"]", component.id()); - } - bail!( - "Component selected with '--component {}' cannot use service chaining to unselected component: allowed_outbound_hosts = [\"http://{}.spin.internal\"]", - component.id(), chaining_target - ); - } - } - } - } - } - anyhow::Ok(()) - })?; - - Ok(()) -} - -// Validates that all components specified to be retained actually exist in the app -fn validate_retained_components_exist( - app: &spin_app::App, - retained_components: &[String], -) -> Result<()> { - let app_components = app - .components() - .map(|c| c.id().to_string()) - .collect::>(); - for c in retained_components { - if !app_components.contains(c) { - bail!("Specified component \"{c}\" not found in application"); - } - } - Ok(()) -} - -#[cfg(test)] -mod test { - use super::*; - - pub async fn build_locked_app( - manifest: &toml::map::Map, - ) -> anyhow::Result { - let toml_str = toml::to_string(manifest).context("failed serializing manifest")?; - let dir = tempfile::tempdir().context("failed creating tempdir")?; - let path = dir.path().join("spin.toml"); - std::fs::write(&path, toml_str).context("failed writing manifest")?; - spin_loader::from_file(&path, spin_loader::FilesMountStrategy::Direct, None).await - } - - #[tokio::test] - async fn test_retain_components_filtering_for_only_component_works() { - let manifest = toml::toml! { - spin_manifest_version = 2 - - [application] - name = "test-app" - - [[trigger.test-trigger]] - component = "empty" - - [component.empty] - source = "does-not-exist.wasm" - }; - let mut locked_app = build_locked_app(&manifest).await.unwrap(); - retain_components(&mut locked_app, &["empty".to_string()]).unwrap(); - let components = locked_app - .components - .iter() - .map(|c| c.id.to_string()) - .collect::>(); - assert!(components.contains("empty")); - assert!(components.len() == 1); - } - - #[tokio::test] - async fn test_retain_components_filtering_for_non_existent_component_fails() { - let manifest = toml::toml! { - spin_manifest_version = 2 - - [application] - name = "test-app" - - [[trigger.test-trigger]] - component = "empty" - - [component.empty] - source = "does-not-exist.wasm" - }; - let mut locked_app = build_locked_app(&manifest).await.unwrap(); - let Err(e) = retain_components(&mut locked_app, &["dne".to_string()]) else { - panic!("Expected component not found error"); - }; - assert_eq!( - e.to_string(), - "Specified component \"dne\" not found in application" - ); - assert!(retain_components(&mut locked_app, &["dne".to_string()]).is_err()); - } - - #[tokio::test] - async fn test_retain_components_app_with_service_chaining_fails() { - let manifest = toml::toml! { - spin_manifest_version = 2 - - [application] - name = "test-app" - - [[trigger.test-trigger]] - component = "empty" - - [component.empty] - source = "does-not-exist.wasm" - allowed_outbound_hosts = ["http://another.spin.internal"] - - [[trigger.another-trigger]] - component = "another" - - [component.another] - source = "does-not-exist.wasm" - - [[trigger.third-trigger]] - component = "third" - - [component.third] - source = "does-not-exist.wasm" - allowed_outbound_hosts = ["http://*.spin.internal"] - }; - let mut locked_app = build_locked_app(&manifest) - .await - .expect("could not build locked app"); - let Err(e) = retain_components(&mut locked_app, &["empty".to_string()]) else { - panic!("Expected service chaining to non-retained component error"); - }; - assert_eq!( - e.to_string(), - "Component selected with '--component empty' cannot use service chaining to unselected component: allowed_outbound_hosts = [\"http://another.spin.internal\"]" - ); - let Err(e) = retain_components( - &mut locked_app, - &["third".to_string(), "another".to_string()], - ) else { - panic!("Expected wildcard service chaining error"); - }; - assert_eq!( - e.to_string(), - "Component selected with '--component third' cannot use wildcard service chaining: allowed_outbound_hosts = [\"http://*.spin.internal\"]" - ); - assert!(retain_components(&mut locked_app, &["another".to_string()]).is_ok()); - } - - #[tokio::test] - async fn test_retain_components_app_with_templated_host_passes() { - let manifest = toml::toml! { - spin_manifest_version = 2 - - [application] - name = "test-app" - - [variables] - host = { default = "test" } - - [[trigger.test-trigger]] - component = "empty" - - [component.empty] - source = "does-not-exist.wasm" - - [[trigger.another-trigger]] - component = "another" - - [component.another] - source = "does-not-exist.wasm" - - [[trigger.third-trigger]] - component = "third" - - [component.third] - source = "does-not-exist.wasm" - allowed_outbound_hosts = ["http://{{ host }}.spin.internal"] - }; - let mut locked_app = build_locked_app(&manifest) - .await - .expect("could not build locked app"); - assert!( - retain_components(&mut locked_app, &["empty".to_string(), "third".to_string()]).is_ok() - ); - } -}