diff --git a/containerd-shim-slight-v1/Cargo.lock b/containerd-shim-slight-v1/Cargo.lock index 6e17018b..3cadce67 100644 --- a/containerd-shim-slight-v1/Cargo.lock +++ b/containerd-shim-slight-v1/Cargo.lock @@ -1041,8 +1041,8 @@ checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" dependencies = [ "atty", "bitflags", - "clap_derive", - "clap_lex", + "clap_derive 3.2.18", + "clap_lex 0.2.4", "indexmap", "once_cell", "strsim", @@ -1050,6 +1050,21 @@ dependencies = [ "textwrap", ] +[[package]] +name = "clap" +version = "4.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" +dependencies = [ + "atty", + "bitflags", + "clap_derive 4.0.21", + "clap_lex 0.3.1", + "once_cell", + "strsim", + "termcolor", +] + [[package]] name = "clap_derive" version = "3.2.18" @@ -1063,6 +1078,19 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_derive" +version = "4.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +dependencies = [ + "heck 0.4.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -1072,6 +1100,15 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cloudevents-sdk" version = "0.5.0" @@ -1184,7 +1221,7 @@ name = "containerd-shim-slight-v1" version = "0.1.0" dependencies = [ "chrono", - "clap", + "clap 4.0.26", "containerd-shim", "containerd-shim-wasm", "log", @@ -3963,7 +4000,7 @@ source = "git+https://github.com/deislabs/spiderlightning?rev=01c5c31a7d9c1c885b dependencies = [ "anyhow", "as-any", - "clap", + "clap 3.2.21", "env_logger", "flate2", "log", diff --git a/containerd-shim-slight-v1/Cargo.toml b/containerd-shim-slight-v1/Cargo.toml index c730f674..c074d828 100644 --- a/containerd-shim-slight-v1/Cargo.toml +++ b/containerd-shim-slight-v1/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] chrono = "~0.4" -clap = { version = "3.1.15", features = ["derive", "env"] } +clap = { version = "4", features = ["derive", "env"] } containerd-shim = "~0.3" containerd-shim-wasm = { git = "https://github.com/deislabs/runwasi", branch = "main" } log = "~0.4" diff --git a/containerd-shim-slight-v1/src/main.rs b/containerd-shim-slight-v1/src/main.rs index 57b6854a..43a75155 100644 --- a/containerd-shim-slight-v1/src/main.rs +++ b/containerd-shim-slight-v1/src/main.rs @@ -7,6 +7,7 @@ use std::sync::{Condvar, Mutex}; use std::thread; use chrono::{DateTime, Utc}; +use clap::Parser; use containerd_shim as shim; use containerd_shim_wasm::sandbox::error::Error; use containerd_shim_wasm::sandbox::instance::EngineGetter; @@ -18,6 +19,11 @@ use log::info; use slight_lib::commands::run::handle_run; use tokio::runtime::Runtime; +/// Helper for passing VERSION to opt. +fn version() -> &'static str { + env!("CARGO_PKG_VERSION") +} + type ExitCode = Arc<(Mutex)>>, Condvar)>; pub struct Wasi { exit_code: ExitCode, @@ -197,6 +203,12 @@ impl EngineGetter for Wasi { } } +/// The slight shim +#[derive(Parser, Debug)] +#[command(version = version())] +struct Args {} + fn main() { + Args::parse(); shim::run::>("io.containerd.slight.v1", None); } diff --git a/containerd-shim-spin-v1/Cargo.lock b/containerd-shim-spin-v1/Cargo.lock index 20ccbb52..b5ef3cc7 100644 --- a/containerd-shim-spin-v1/Cargo.lock +++ b/containerd-shim-spin-v1/Cargo.lock @@ -527,8 +527,8 @@ checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", - "clap_derive", - "clap_lex", + "clap_derive 3.2.18", + "clap_lex 0.2.4", "indexmap", "once_cell", "strsim", @@ -536,6 +536,21 @@ dependencies = [ "textwrap", ] +[[package]] +name = "clap" +version = "4.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +dependencies = [ + "bitflags", + "clap_derive 4.1.0", + "clap_lex 0.3.1", + "is-terminal 0.4.2", + "once_cell", + "strsim", + "termcolor", +] + [[package]] name = "clap_derive" version = "3.2.18" @@ -549,6 +564,19 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck 0.4.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -558,6 +586,15 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "clone3" version = "0.2.3" @@ -662,7 +699,7 @@ dependencies = [ "anyhow", "async-trait", "chrono", - "clap", + "clap 4.1.4", "containerd-shim", "containerd-shim-wasm", "log", @@ -1873,6 +1910,18 @@ dependencies = [ "windows-sys 0.36.1", ] +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes 1.0.3", + "rustix 0.36.6", + "windows-sys 0.42.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -3721,7 +3770,7 @@ source = "git+https://github.com/fermyon/spin?tag=v0.7.1#6cf7447036b7c9238cfa638 dependencies = [ "anyhow", "async-trait", - "clap", + "clap 3.2.23", "futures", "futures-util", "http", @@ -3786,7 +3835,7 @@ source = "git+https://github.com/fermyon/spin?tag=v0.7.1#6cf7447036b7c9238cfa638 dependencies = [ "anyhow", "async-trait", - "clap", + "clap 3.2.23", "ctrlc", "dirs", "futures", @@ -4454,7 +4503,7 @@ dependencies = [ "fs-set-times 0.17.1", "io-extras 0.15.0", "io-lifetimes 0.7.5", - "is-terminal", + "is-terminal 0.3.0", "once_cell", "rustix 0.35.13", "system-interface", diff --git a/containerd-shim-spin-v1/Cargo.toml b/containerd-shim-spin-v1/Cargo.toml index bd483836..f537aeb7 100644 --- a/containerd-shim-spin-v1/Cargo.toml +++ b/containerd-shim-spin-v1/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] chrono = "~0.4" -clap = { version = "3.1.15", features = ["derive", "env"] } +clap = { version = "4", features = ["derive", "env"] } containerd-shim = "~0.3" containerd-shim-wasm = { git = "https://github.com/deislabs/runwasi", branch = "main" } log = "~0.4" diff --git a/containerd-shim-spin-v1/src/main.rs b/containerd-shim-spin-v1/src/main.rs index 2eef5f22..f3c5277b 100644 --- a/containerd-shim-spin-v1/src/main.rs +++ b/containerd-shim-spin-v1/src/main.rs @@ -10,6 +10,7 @@ use std::thread; use anyhow::{anyhow, Result}; use chrono::{DateTime, Utc}; +use clap::Parser; use containerd_shim as shim; use containerd_shim_wasm::sandbox::{ error::Error, @@ -31,6 +32,11 @@ mod podio; const SPIN_ADDR: &str = "0.0.0.0:80"; const RUNTIME_CONFIG_FILE_PATH: &str = "runtime_config.toml"; +/// Helper for passing VERSION to opt. +fn version() -> &'static str { + env!("CARGO_PKG_VERSION") +} + type ExitCode = Arc<(Mutex)>>, Condvar)>; pub struct Wasi { @@ -288,7 +294,13 @@ impl EngineGetter for Wasi { } } +/// The spin shim +#[derive(Parser, Debug)] +#[command(version = version())] +struct Args {} + fn main() { + Args::parse(); shim::run::>("io.containerd.spin.v1", None); }