LukeMathWalker / LukeMathWalker/cargo-chef
Unable to build `rustls` with `cargo-chef`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
The title of this issue is very specific, but I think it is likely the underlying cause affects other projects as well.
Given a fresh clone of [rustls](https://github.com/rustls/rustls) currently at commit `fc6b4a193b065604d10e16e79d601d8a30c18492`, and the following Dockerfile
```Dockerfile
FROM lukemathwalker/cargo-chef:latest-rust-1.82 AS chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json --package rustls
COPY . .
RUN cargo build --release --package rustls
ENTRYPOINT []
```
Running `docker build --tag rustls-chef --progress=plain --no-cache .` results in the following error at the cook stage:
```
#10 0.452 Updating crates.io index
#10 0.463 error: failed to get `rustls-post-quantum` as a dependency of package `bogo v0.0.1 (/app/bogo)`
#10 0.463
#10 0.463 Caused by:
#10 0.463 failed to load source for dependency `rustls-post-quantum`
#10 0.463
#10 0.463 Caused by:
#10 0.463 Unable to update /app/rustls-post-quantum
#10 0.463
#10 0.463 Caused by:
#10 0.463 failed to read `/app/rustls-post-quantum/Cargo.toml`
#10 0.463
#10 0.463 Caused by:
#10 0.463 No such file or directory (os error 2)
#10 0.464 thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-chef-0.1.68/src/recipe.rs:218:27:
#10 0.464 Exited with status code: 101
#10 0.464 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#10 ERROR: process "/bin/sh -c cargo chef cook --release --recipe-path recipe.json --package rustls" did not complete successfully: exit code: 101
------
> [builder 2/4] RUN cargo chef cook --release --recipe-path recipe.json --package rustls:
0.463 Unable to update /app/rustls-post-quantum
0.463
0.463 Caused by:
0.463 failed to read `/app/rustls-post-quantum/Cargo.toml`
0.463
0.463 Caused by:
0.463 No such file or directory (os error 2)
0.464 thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-chef-0.1.68/src/recipe.rs:218:27:
0.464 Exited with status code: 101
0.464 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
---
Speculation: perhaps `cargo-chef` is not taking into account the workspace excludes correctly? The mentioned package `rustls-post-quantum` is [not supposed to be included by default](https://github.com/rustls/rustls/blob/fc6b4a193b065604d10e16e79d601d8a30c18492/Cargo.toml#L23-L30)
```toml
## Deliberately not included in `members`:
exclude = [
# `cargo fuzz` integration (requires nightly)
"fuzz",
# experimental post-quantum algorithm support
# (conflicting feature requirements with `rustls`)
"rustls-post-quantum",
]
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the supplied Dockerfile and rustls commit, starting with the workspace exclude entries in Cargo.toml and the generated recipe.json. Trace how cargo chef prepare and cook handle the excluded rustls-post-quantum path. Done means the cook stage no longer tries to read that excluded dependency and the documented Docker build succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100