diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb59a21..74e0599 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Install latest nightly uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2023-01-10 components: rust-src - name: Install bpf-linker diff --git a/examples/aya-tool/myapp-ebpf/rust-toolchain.toml b/examples/aya-tool/myapp-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/aya-tool/myapp-ebpf/rust-toolchain.toml +++ b/examples/aya-tool/myapp-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/aya-tool/xtask/src/build_ebpf.rs b/examples/aya-tool/xtask/src/build_ebpf.rs index f541371..e7507cc 100644 --- a/examples/aya-tool/xtask/src/build_ebpf.rs +++ b/examples/aya-tool/xtask/src/build_ebpf.rs @@ -43,7 +43,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("myapp-ebpf"); let target = format!("--target={}", opts.target); let args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -52,8 +51,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { "--profile", opts.profile.as_str(), ]; + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program"); diff --git a/examples/cgroup-skb-egress/cgroup-skb-egress-ebpf/rust-toolchain.toml b/examples/cgroup-skb-egress/cgroup-skb-egress-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/cgroup-skb-egress/cgroup-skb-egress-ebpf/rust-toolchain.toml +++ b/examples/cgroup-skb-egress/cgroup-skb-egress-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/cgroup-skb-egress/xtask/src/build_ebpf.rs b/examples/cgroup-skb-egress/xtask/src/build_ebpf.rs index 983055a..81de1ee 100644 --- a/examples/cgroup-skb-egress/xtask/src/build_ebpf.rs +++ b/examples/cgroup-skb-egress/xtask/src/build_ebpf.rs @@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("cgroup-skb-egress-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -54,8 +53,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { if opts.release { args.push("--release") } + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program"); diff --git a/examples/kprobetcp/kprobetcp-ebpf/rust-toolchain.toml b/examples/kprobetcp/kprobetcp-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/kprobetcp/kprobetcp-ebpf/rust-toolchain.toml +++ b/examples/kprobetcp/kprobetcp-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/kprobetcp/xtask/src/build_ebpf.rs b/examples/kprobetcp/xtask/src/build_ebpf.rs index 26fa19d..9b514a2 100644 --- a/examples/kprobetcp/xtask/src/build_ebpf.rs +++ b/examples/kprobetcp/xtask/src/build_ebpf.rs @@ -43,7 +43,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("kprobetcp-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -53,8 +52,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { if opts.release { args.push("--release") } + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program"); diff --git a/examples/lsm-nice/lsm-nice-ebpf/rust-toolchain.toml b/examples/lsm-nice/lsm-nice-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/lsm-nice/lsm-nice-ebpf/rust-toolchain.toml +++ b/examples/lsm-nice/lsm-nice-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/lsm-nice/xtask/src/build_ebpf.rs b/examples/lsm-nice/xtask/src/build_ebpf.rs index e2e6324..200096a 100644 --- a/examples/lsm-nice/xtask/src/build_ebpf.rs +++ b/examples/lsm-nice/xtask/src/build_ebpf.rs @@ -43,7 +43,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("lsm-nice-ebpf"); let target = format!("--target={}", opts.target); let args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -52,8 +51,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { "--profile", opts.profile.as_str(), ]; + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program"); diff --git a/examples/tc-egress/tc-egress-ebpf/rust-toolchain.toml b/examples/tc-egress/tc-egress-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/tc-egress/tc-egress-ebpf/rust-toolchain.toml +++ b/examples/tc-egress/tc-egress-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/tc-egress/xtask/src/build_ebpf.rs b/examples/tc-egress/xtask/src/build_ebpf.rs index 557d0e8..90c2b9b 100644 --- a/examples/tc-egress/xtask/src/build_ebpf.rs +++ b/examples/tc-egress/xtask/src/build_ebpf.rs @@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("tc-egress-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -54,8 +53,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { if opts.release { args.push("--release") } + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program"); diff --git a/examples/xdp-drop/xdp-drop-ebpf/rust-toolchain.toml b/examples/xdp-drop/xdp-drop-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/xdp-drop/xdp-drop-ebpf/rust-toolchain.toml +++ b/examples/xdp-drop/xdp-drop-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/xdp-drop/xtask/src/build_ebpf.rs b/examples/xdp-drop/xtask/src/build_ebpf.rs index 09decf2..ee527d5 100644 --- a/examples/xdp-drop/xtask/src/build_ebpf.rs +++ b/examples/xdp-drop/xtask/src/build_ebpf.rs @@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("xdp-drop-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -54,8 +53,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { if opts.release { args.push("--release") } + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program"); diff --git a/examples/xdp-hello/xdp-hello-ebpf/rust-toolchain.toml b/examples/xdp-hello/xdp-hello-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/xdp-hello/xdp-hello-ebpf/rust-toolchain.toml +++ b/examples/xdp-hello/xdp-hello-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/xdp-hello/xtask/src/build_ebpf.rs b/examples/xdp-hello/xtask/src/build_ebpf.rs index e6f157e..22b3ebe 100644 --- a/examples/xdp-hello/xtask/src/build_ebpf.rs +++ b/examples/xdp-hello/xtask/src/build_ebpf.rs @@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("xdp-hello-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -54,6 +53,11 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { if opts.release { args.push("--release") } + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) .args(&args) diff --git a/examples/xdp-log/xdp-log-ebpf/rust-toolchain.toml b/examples/xdp-log/xdp-log-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/examples/xdp-log/xdp-log-ebpf/rust-toolchain.toml +++ b/examples/xdp-log/xdp-log-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10" diff --git a/examples/xdp-log/xtask/src/build_ebpf.rs b/examples/xdp-log/xtask/src/build_ebpf.rs index 9e1f288..c476ade 100644 --- a/examples/xdp-log/xtask/src/build_ebpf.rs +++ b/examples/xdp-log/xtask/src/build_ebpf.rs @@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("xdp-log-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", "build", "--verbose", target.as_str(), @@ -54,8 +53,14 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { if opts.release { args.push("--release") } + + // Command::new creates a child process which inherits all env variables. This means env + // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed + // so the rust-toolchain.toml file in the -ebpf folder is honored. + let status = Command::new("cargo") .current_dir(&dir) + .env_remove("RUSTUP_TOOLCHAIN") .args(&args) .status() .expect("failed to build bpf program");