Skip to content

Commit

Permalink
fix: build pipeline for lunatic shim
Browse files Browse the repository at this point in the history
update to the latest main branch of runwasi

Signed-off-by: jiaxiao zhou <[email protected]>

delete command in workload.yaml and make lunatic executable

Signed-off-by: jiaxiao zhou <[email protected]>

tests: fix the integration tests for lunatic

this commits fix the integration tests for lunatic shim by
adding hello to the end of the url for curling.

It also removes unused code in mod.rs

Signed-off-by: jiaxiao zhou <[email protected]>
  • Loading branch information
Mossaka committed Aug 22, 2023
1 parent 9c9c125 commit c778b19
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 286 deletions.
42 changes: 1 addition & 41 deletions containerd-shim-lunatic-v1/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion containerd-shim-lunatic-v1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
containerd-shim = "0.4.0"
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "0a2e3a11da05a68fc4c68c09fca901fe54ae4cd6", features = ["cgroupsv2"] }
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "6287dff637b0ac96a43a6bbe2c7919f8b2f2cf27", features = ["cgroupsv2"] }
libcontainer = { version = "0.1", features = ["v2"], default-features = false }
nix = "0.26.2"
serde = "1.0.183"
Expand Down
20 changes: 6 additions & 14 deletions containerd-shim-lunatic-v1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use std::{
sync::{Arc, Condvar, Mutex},
};

use chrono::{DateTime, Utc};
use containerd_shim::run;
use containerd_shim_wasm::{
libcontainer_instance::LibcontainerInstance,
sandbox::{instance_utils::maybe_open_stdio, EngineGetter, Error, InstanceConfig, ShimCli},
sandbox::{
instance::ExitCode, instance_utils::maybe_open_stdio, Error, InstanceConfig, ShimCli,
},
};
use libcontainer::{
container::{builder::ContainerBuilder, Container},
Expand All @@ -22,8 +23,6 @@ use anyhow::{Context, Result};

use crate::executor::LunaticExecutor;

type ExitCode = Arc<(Mutex<Option<(u32, DateTime<Utc>)>>, Condvar)>;

mod common;
mod executor;

Expand Down Expand Up @@ -64,9 +63,9 @@ fn determine_rootdir<P: AsRef<Path>>(bundle: P, namespace: String) -> Result<Pat
}

impl LibcontainerInstance for Wasi {
type E = ();
type Engine = ();

fn new_libcontainer(id: String, cfg: Option<&InstanceConfig<Self::E>>) -> Self {
fn new_libcontainer(id: String, cfg: Option<&InstanceConfig<Self::Engine>>) -> Self {
let cfg = cfg.unwrap();
let bundle = cfg.get_bundle().unwrap_or_default();

Expand Down Expand Up @@ -127,13 +126,6 @@ impl LibcontainerInstance for Wasi {
}
}

impl EngineGetter for Wasi {
type E = ();

fn new_engine() -> std::result::Result<Self::E, Error> {
Ok(())
}
}
fn main() {
run::<ShimCli<Wasi, ()>>("io.containerd.lunatic.v1", None);
run::<ShimCli<Wasi>>("io.containerd.lunatic.v1", None);
}
2 changes: 1 addition & 1 deletion images/lunatic-spawn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN rustup target add wasm32-wasi
RUN cargo build --release --target wasm32-wasi

FROM scratch
COPY --link --from=build /build/target/wasm32-wasi/release/lunatic-spawn.wasm /
COPY --link --chmod=0755 --from=build /build/target/wasm32-wasi/release/lunatic-spawn.wasm /
ENTRYPOINT [ "./lunatic-spawn.wasm" ]
2 changes: 1 addition & 1 deletion images/lunatic-submillisecond/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN rustup target add wasm32-wasi
RUN cargo build --release --target wasm32-wasi

FROM scratch
COPY --link --from=build /build/target/wasm32-wasi/release/lunatic-submillisecond.wasm /
COPY --link --chmod=0755 --from=build /build/target/wasm32-wasi/release/lunatic-submillisecond.wasm /
ENTRYPOINT [ "./lunatic-submillisecond.wasm" ]
2 changes: 1 addition & 1 deletion images/lunatic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN rustup target add wasm32-wasi
RUN cargo build --release --target wasm32-wasi

FROM scratch
COPY --link --from=build /build/target/wasm32-wasi/release/wasi-hello-world.wasm /
COPY --link --chmod=0755 --from=build /build/target/wasm32-wasi/release/wasi-hello-world.wasm /
ENTRYPOINT [ "./wasi-hello-world.wasm" ]
Loading

0 comments on commit c778b19

Please sign in to comment.