diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39648fb..3af968d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,14 +46,14 @@ jobs: with: toolchain: stable - - name: Install latest nightly + - name: Install latest nightly (pinned to nightly-2023-01-10, https://github.com/aya-rs/aya/issues/490) uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2023-01-10 components: rust-src - name: Install bpf-linker - run: cargo +nightly install bpf-linker + run: cargo install bpf-linker - name: Install Cargo Generate run: cargo install --git https://github.com/cargo-generate/cargo-generate cargo-generate diff --git a/xtask/src/build_ebpf.rs b/xtask/src/build_ebpf.rs index 25c4f06..452cb17 100644 --- a/xtask/src/build_ebpf.rs +++ b/xtask/src/build_ebpf.rs @@ -43,7 +43,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("{{project-name}}-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/{{project-name}}-ebpf/rust-toolchain.toml b/{{project-name}}-ebpf/rust-toolchain.toml index c046a09..33460c2 100644 --- a/{{project-name}}-ebpf/rust-toolchain.toml +++ b/{{project-name}}-ebpf/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly" +channel="nightly-2023-01-10"