Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
with:
workspaces: |
"containerd-shim-* -> target"
- name: "Install dependencies"
- run:
rustup toolchain install nightly --component rustfmt
- name: Setup build env
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libseccomp-dev
./scripts/setup-linux.sh
- name: fmt
run: |
make fmt
Expand All @@ -43,10 +44,9 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: azure/setup-kubectl@v4
- name: "Install dependencies"
- name: Setup build env
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libseccomp-dev
./scripts/setup-linux.sh
- name: Extract containerd-shim-spin-linux-${{ env.ARCH }}
run: |
mkdir -p ./bin
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,12 @@ tests/clean:

.PHONY: fmt
fmt:
$(foreach shim,$(SHIMS),cargo fmt --all --manifest-path=containerd-shim-$(shim)/Cargo.toml -- --check;)
$(foreach shim,$(SHIMS),cargo clippy --all-targets --all-features --workspace --manifest-path=containerd-shim-$(shim)/Cargo.toml -- -D warnings;)
cargo fmt --all -- --check
cargo +nightly fmt --all -- --check
cargo clippy --all-targets --all-features --workspace -- --deny=warnings

.PHONY: fix
fix:
$(foreach shim,$(SHIMS),cargo fmt --all --manifest-path=containerd-shim-$(shim)/Cargo.toml;)
$(foreach shim,$(SHIMS),cargo clippy --all-targets --all-features --workspace --manifest-path=containerd-shim-$(shim)/Cargo.toml --fix -- -D warnings;)
cargo fmt --all
cargo +nightly fmt --all
cargo clippy --all-targets --all-features --workspace --fix -- --deny=warnings

.PHONY: build
Expand Down
31 changes: 16 additions & 15 deletions containerd-shim-spin/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
use std::{
collections::{hash_map::DefaultHasher, HashSet},
env,
fs::File,
hash::{Hash, Hasher},
io::Write,
net::{SocketAddr, ToSocketAddrs},
path::{Path, PathBuf},
};

use anyhow::{anyhow, ensure, Context, Result};
use containerd_shim_wasm::container::{Engine, RuntimeContext, Stdio};
use containerd_shim_wasm::sandbox::WasmLayer;
use containerd_shim_wasm::{
container::{Engine, RuntimeContext, Stdio},
sandbox::WasmLayer,
};
use log::info;
use oci_spec::image::MediaType;
use spin_app::locked::LockedApp;
use spin_loader::cache::Cache;
use spin_loader::FilesMountStrategy;
use spin_loader::{cache::Cache, FilesMountStrategy};
use spin_manifest::schema::v2::AppManifest;
use spin_trigger::TriggerHooks;
use spin_trigger::{loader, RuntimeConfig, TriggerExecutor, TriggerExecutorBuilder};
use spin_trigger::{loader, RuntimeConfig, TriggerExecutor, TriggerExecutorBuilder, TriggerHooks};
use spin_trigger_http::HttpTrigger;
use spin_trigger_redis::RedisTrigger;
use std::collections::hash_map::DefaultHasher;
use std::collections::HashSet;
use std::env;
use std::fs::File;
use std::hash::{Hash, Hasher};
use std::io::Write;
use std::net::SocketAddr;
use std::net::ToSocketAddrs;
use std::path::{Path, PathBuf};
use tokio::runtime::Runtime;
use trigger_command::CommandTrigger;
use trigger_sqs::SqsTrigger;
Expand Down
6 changes: 4 additions & 2 deletions containerd-shim-spin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use containerd_shim::Config;
use containerd_shim_wasm::container::Instance;
use containerd_shim_wasm::sandbox::cli::{revision, shim_main, version};
use containerd_shim_wasm::{
container::Instance,
sandbox::cli::{revision, shim_main, version},
};

mod engine;

Expand Down
6 changes: 6 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
newline_style = "Native"
unstable_features = true # Cargo fmt now needs to be called with `cargo +nightly fmt`
group_imports = "StdExternalCrate" # create three groups for std, external and local crates
# Merge imports from the same module
# See: https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#imports_granularity
imports_granularity = "Crate"
4 changes: 4 additions & 0 deletions scripts/setup-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
sudo apt -y update
sudo apt-get install -y protobuf-compiler libseccomp-dev

2 changes: 1 addition & 1 deletion tests/src/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[cfg(test)]
mod test {
use anyhow::Result;
use redis::AsyncCommands;
use tokio::process::Command;

use crate::retry_get;
use anyhow::Result;

const RETRY_TIMES: u32 = 5;
const INTERVAL_IN_SECS: u64 = 10;
Expand Down