-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add version flag to all the shims
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
- Loading branch information
Showing
8 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::process::Command; | ||
use std::str::from_utf8; | ||
|
||
fn main() { | ||
let output = match Command::new("git").arg("rev-parse").arg("HEAD").output() { | ||
Ok(output) => output, | ||
Err(_) => { | ||
return; | ||
} | ||
}; | ||
let mut hash = from_utf8(&output.stdout).unwrap().trim().to_string(); | ||
|
||
let output_dirty = match Command::new("git").arg("diff").arg("--exit-code").output() { | ||
Ok(output) => output, | ||
Err(_) => { | ||
return; | ||
} | ||
}; | ||
|
||
if !output_dirty.status.success() { | ||
hash.push_str(".m"); | ||
} | ||
println!("cargo:rustc-env=CARGO_GIT_HASH={}", hash); | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/containerd-shim-wasmedge/src/bin/containerd-shim-wasmedge-v1/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
use containerd_shim as shim; | ||
use containerd_shim_wasm::sandbox::ShimCli; | ||
use containerd_shim_wasmedge::instance::Wasi as WasiInstance; | ||
use containerd_shim_wasmedge::parse_version; | ||
|
||
fn main() { | ||
parse_version(); | ||
shim::run::<ShimCli<WasiInstance>>("io.containerd.wasmedge.v1", None); | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/containerd-shim-wasmedge/src/bin/containerd-shim-wasmedged-v1/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
use containerd_shim as shim; | ||
use containerd_shim_wasm::sandbox::manager::Shim; | ||
use containerd_shim_wasmedge::parse_version; | ||
|
||
fn main() { | ||
parse_version(); | ||
shim::run::<Shim>("containerd-shim-wasmedged-v1", None) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::process::Command; | ||
use std::str::from_utf8; | ||
|
||
fn main() { | ||
let output = match Command::new("git").arg("rev-parse").arg("HEAD").output() { | ||
Ok(output) => output, | ||
Err(_) => { | ||
return; | ||
} | ||
}; | ||
let mut hash = from_utf8(&output.stdout).unwrap().trim().to_string(); | ||
|
||
let output_dirty = match Command::new("git").arg("diff").arg("--exit-code").output() { | ||
Ok(output) => output, | ||
Err(_) => { | ||
return; | ||
} | ||
}; | ||
|
||
if !output_dirty.status.success() { | ||
hash.push_str(".m"); | ||
} | ||
println!("cargo:rustc-env=CARGO_GIT_HASH={}", hash); | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/containerd-shim-wasmtime/src/bin/containerd-shim-wasmtime-v1/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
use containerd_shim as shim; | ||
use containerd_shim_wasm::sandbox::ShimCli; | ||
use containerd_shim_wasmtime::instance::Wasi as WasiInstance; | ||
use containerd_shim_wasmtime::parse_version; | ||
|
||
fn main() { | ||
parse_version(); | ||
shim::run::<ShimCli<WasiInstance>>("io.containerd.wasmtime.v1", None); | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/containerd-shim-wasmtime/src/bin/containerd-shim-wasmtimed-v1/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
use containerd_shim as shim; | ||
use containerd_shim_wasm::sandbox::manager::Shim; | ||
use containerd_shim_wasmtime::parse_version; | ||
|
||
fn main() { | ||
parse_version(); | ||
shim::run::<Shim>("containerd-shim-wasmtimed-v1", None) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters