Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into version
Browse files Browse the repository at this point in the history
Signed-off-by: jiaxiao zhou <[email protected]>
  • Loading branch information
Mossaka committed Aug 9, 2023
2 parents 3610689 + ad83804 commit 9f952ce
Show file tree
Hide file tree
Showing 19 changed files with 108 additions and 2,168 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ jobs:
$env:TTRPC_ADDRESS="\\.\pipe\containerd-containerd.ttrpc"
# run the example
cargo run --example skeleton -- -namespace default -id 1234 -address "\\.\pipe\containerd-containerd" -publish-binary ./bin/containerd start
cargo run -p containerd-shim --example skeleton -- -namespace default -id 1234 -address "\\.\pipe\containerd-containerd" -publish-binary ./bin/containerd start
ps skeleton
cargo run --example shim-proto-connect \\.\pipe\containerd-shim-17630016127144989388-pipe
cargo run -p containerd-shim-protos --example shim-proto-connect \\.\pipe\containerd-shim-17630016127144989388-pipe
$skeleton = get-process skeleton -ErrorAction SilentlyContinue
if ($skeleton) { exit 1 }
17 changes: 1 addition & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-20.04, ubuntu-22.04]
containerd: [v1.6.21, v1.7.1]

steps:
Expand Down Expand Up @@ -140,18 +140,3 @@ jobs:
TESTFLAGS_RACE: "-race"
run: sudo -E PATH=$PATH make integration
working-directory: src/github.com/containerd/containerd

- name: Install async shim
run: |
cargo build --release --all-features --bin containerd-shim-runc-v2-rs
sudo install -D ./target/release/containerd-shim-runc-v2-rs /usr/local/bin/
- name: Integration for async shim
env:
GOPROXY: direct
TEST_RUNTIME: "io.containerd.runc.v2-rs"
TESTFLAGS_PARALLEL: 1
EXTRA_TESTFLAGS: "-no-criu -test.skip='(TestContainerPTY|TestContainerExecLargeOutputWithTTY|TestTaskUpdate|TestTaskResize)'"
TESTFLAGS_RACE: "-race"
run: sudo -E PATH=$PATH make integration
working-directory: src/github.com/containerd/containerd
19 changes: 10 additions & 9 deletions crates/runc-shim/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
name = "containerd-runc-shim"
version = "0.1.1"
authors = ["Shaobao Feng <[email protected]>", "Tianyang Zhang <[email protected]>", "The containerd Authors"]
authors = [
"Shaobao Feng <[email protected]>",
"Tianyang Zhang <[email protected]>",
"The containerd Authors",
]
keywords = ["containerd", "shim", "containers"]
description = "Rust implementation of containerd's runc v2 shim runtime"

Expand All @@ -19,9 +23,6 @@ name = "containerd-shim-runc-v2-rs"
path = "src/main.rs"
doc = false

[features]
async = ["containerd-shim/async", "runc/async", "tokio", "futures", "async-trait"]

[dependencies]
log = "0.4"
nix = "0.26"
Expand All @@ -34,9 +35,9 @@ crossbeam = "0.8.1"
uuid = { version = "1.0.0", features = ["v4"] }

# Async dependencies
async-trait = { workspace = true, optional = true }
tokio = { workspace = true, features = ["full"], optional = true }
futures = { workspace = true, optional = true }
async-trait = { workspace = true }
tokio = { workspace = true, features = ["full"] }
futures = { workspace = true }

containerd-shim = { path = "../shim", version = "0.4.0" }
runc = { path = "../runc", version = "0.2.0" }
containerd-shim = { path = "../shim", version = "0.4.0", features = ["async"] }
runc = { path = "../runc", version = "0.2.0", features = ["async"] }
File renamed without changes.
File renamed without changes.
33 changes: 12 additions & 21 deletions crates/runc-shim/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@
limitations under the License.
*/

#[cfg(feature = "async")]
mod asynchronous;
use std::env;

use containerd_shim::{asynchronous::run, parse};

mod common;
mod console;
mod container;
mod io;
#[cfg(not(feature = "async"))]
mod synchronous;

use std::env;
mod processes;
mod runc;
mod service;
mod task;

use containerd_shim::parse;
use service::Service;

fn parse_version() {
let os_args: Vec<_> = env::args_os().collect();
Expand All @@ -38,21 +42,8 @@ fn parse_version() {
}
}

#[cfg(not(feature = "async"))]
fn main() {
parse_version();

containerd_shim::run::<synchronous::Service>("io.containerd.runc.v2-rs", None);
}

#[cfg(feature = "async")]
#[tokio::main]
async fn main() {
parse_version();

containerd_shim::asynchronous::run::<crate::asynchronous::Service>(
"io.containerd.runc.v2-rs",
None,
)
.await;
run::<Service>("io.containerd.runc.v2-rs", None).await;
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ mod tests {
use runc::error::Error::CommandFailed;
use tokio::fs::remove_dir_all;

use crate::{asynchronous::runc::runtime_error, common::LOG_JSON_FILE};
use crate::{common::LOG_JSON_FILE, runc::runtime_error};

#[tokio::test]
async fn test_runtime_error() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,13 @@ use log::{debug, error, warn};
use tokio::sync::mpsc::{channel, Receiver, Sender};

use crate::{
asynchronous::runc::{RuncContainer, RuncFactory},
common::{create_runc, has_shared_pid_namespace, ShimExecutor, GROUP_LABELS},
container::Container,
processes::Process,
runc::{RuncContainer, RuncFactory},
task::TaskService,
};

mod console;
mod container;
mod processes;
mod runc;
mod task;

use container::Container;
use processes::Process;
use task::TaskService;

pub(crate) struct Service {
exit: Arc<ExitSignal>,
id: String,
Expand Down
70 changes: 0 additions & 70 deletions crates/runc-shim/src/synchronous/console.rs

This file was deleted.

Loading

0 comments on commit 9f952ce

Please sign in to comment.