Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rust to 2025-01-22 #3021

Merged
merged 18 commits into from
Jan 28, 2025
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
- run: rm rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-10-11
toolchain: nightly-2025-01-22
components: rustfmt, clippy
target: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu
- uses: actions/setup-python@v5 # For http mirroring tests with Flask and FastAPI.
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-10-11
toolchain: nightly-2025-01-22
# TODO(alex): `no-deps` here due to an issue in `futures-util`.
- run: cargo doc --document-private-items --no-deps

Expand All @@ -210,7 +210,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# the setup rust toolchain action ignores the input if file exists.. so remove it
- run: rm rust-toolchain.toml
- run: rustup default nightly-2024-10-11
- run: rustup default nightly-2025-01-22
- name: test
run: cargo test --target x86_64-unknown-linux-gnu -p mirrord-agent

Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
with:
components: rustfmt, clippy
target: aarch64-apple-darwin
toolchain: nightly-2024-10-11
toolchain: nightly-2025-01-22
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand Down
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelog.d/+update-rust-2025-01-22.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update rust nightly-2025-01-22.
8 changes: 4 additions & 4 deletions mirrord/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:193d12d5d8015c1ed60b9eda30c708cb9c4653e9 AS chef
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:602d397f8e2088ca6ef229e7da0f86490153d8b7 AS chef
ARG TARGETARCH
WORKDIR /app

Expand All @@ -25,12 +25,12 @@ COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /a
# so we remove from the workspace
RUN sed -i '/members = \[/,/\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml

RUN cargo +nightly-2024-10-11 chef prepare --recipe-path recipe.json
RUN cargo +nightly-2025-01-22 chef prepare --recipe-path recipe.json

FROM chef AS builder

COPY --from=planner /app/recipe.json recipe.json
RUN cargo +nightly-2024-10-11 chef cook --release --zigbuild --target $(cat /.platform) --recipe-path recipe.json
RUN cargo +nightly-2025-01-22 chef cook --release --zigbuild --target $(cat /.platform) --recipe-path recipe.json

# Copy order is important here, since we want the cache to be invalidated as less as possible
# so we start with the most static files, then the most dynamic ones
Expand All @@ -44,7 +44,7 @@ COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /a
# so we remove from the workspace
RUN sed -i '/members = \[/,/\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml

RUN cargo +nightly-2024-10-11 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release
RUN cargo +nightly-2025-01-22 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release
RUN cp /app/target/$(cat /.platform)/release/mirrord-agent /mirrord-agent

FROM ghcr.io/metalbear-co/ci-agent-runtime:latest
Expand Down
16 changes: 8 additions & 8 deletions mirrord/agent/src/steal/orig_dst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ mod linux {

let arr = sa.sin6_addr.s6_addr;
let ip = Ipv6Addr::new(
(arr[0] as u16) << 8 | (arr[1] as u16),
(arr[2] as u16) << 8 | (arr[3] as u16),
(arr[4] as u16) << 8 | (arr[5] as u16),
(arr[6] as u16) << 8 | (arr[7] as u16),
(arr[8] as u16) << 8 | (arr[9] as u16),
(arr[10] as u16) << 8 | (arr[11] as u16),
(arr[12] as u16) << 8 | (arr[13] as u16),
(arr[14] as u16) << 8 | (arr[15] as u16),
((arr[0] as u16) << 8) | (arr[1] as u16),
((arr[2] as u16) << 8) | (arr[3] as u16),
((arr[4] as u16) << 8) | (arr[5] as u16),
((arr[6] as u16) << 8) | (arr[7] as u16),
((arr[8] as u16) << 8) | (arr[9] as u16),
((arr[10] as u16) << 8) | (arr[11] as u16),
((arr[12] as u16) << 8) | (arr[13] as u16),
((arr[14] as u16) << 8) | (arr[15] as u16),
);

let port = sa.sin6_port;
Expand Down
8 changes: 4 additions & 4 deletions mirrord/cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:193d12d5d8015c1ed60b9eda30c708cb9c4653e9 AS chef
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:602d397f8e2088ca6ef229e7da0f86490153d8b7 AS chef
ARG TARGETARCH
WORKDIR /build

Expand All @@ -14,15 +14,15 @@ RUN cargo install [email protected]
FROM chef AS planner

COPY . /build/
RUN cargo +nightly-2024-10-11 chef prepare --recipe-path recipe.json
RUN cargo +nightly-2025-01-22 chef prepare --recipe-path recipe.json

FROM chef AS builder

COPY --from=planner /build/recipe.json recipe.json
RUN cargo +nightly-2024-10-11 chef cook --release --zigbuild --target $(cat /.platform) --recipe-path recipe.json
RUN cargo +nightly-2025-01-22 chef cook --release --zigbuild --target $(cat /.platform) --recipe-path recipe.json

COPY . /build/
RUN cargo +nightly-2024-10-11 zigbuild -p mirrord -p mirrord-layer -Z bindeps --target $(cat /.platform) --release --locked
RUN cargo +nightly-2025-01-22 zigbuild -p mirrord -p mirrord-layer -Z bindeps --target $(cat /.platform) --release --locked
RUN cp /build/target/$(cat /.platform)/release/mirrord /mirrord
RUN cp /build/target/$(cat /.platform)/release/libmirrord_layer.so /libmirrord_layer.so

Expand Down
8 changes: 2 additions & 6 deletions mirrord/intproxy/src/proxies/outgoing/net_protocol_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,8 @@ impl ConnectedSocket {

Ok(())
}
InnerConnectedSocket::TcpStream(stream) => {
stream.write_all(bytes).await.map_err(Into::into)
}
InnerConnectedSocket::UnixStream(stream) => {
stream.write_all(bytes).await.map_err(Into::into)
}
InnerConnectedSocket::TcpStream(stream) => stream.write_all(bytes).await,
InnerConnectedSocket::UnixStream(stream) => stream.write_all(bytes).await,
}
}

Expand Down
2 changes: 1 addition & 1 deletion mirrord/kube/src/api/container/targetless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ where
}
}

impl<'c, T> ContainerApi<JobVariant<T>> for Targetless<'c, JobVariant<T>>
impl<T> ContainerApi<JobVariant<T>> for Targetless<'_, JobVariant<T>>
where
T: ContainerVariant<Update = Pod>,
{
Expand Down
2 changes: 1 addition & 1 deletion mirrord/layer/src/debugger_ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl DebuggerType {
.split(',')
.find_map(|arg| arg.strip_prefix("address="))
})
.and_then(|full_address| full_address.split(':').last())
.and_then(|full_address| full_address.split(':').next_back())
.and_then(|port| port.parse::<u16>().ok())
.map(|port| SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port))
} else {
Expand Down
6 changes: 4 additions & 2 deletions mirrord/layer/src/file/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ impl Drop for RemoteFile {
// operation to complete. The write operation is hooked and at some point tries to lock
// `OPEN_FILES`, which means the thread deadlocks with itself (we call
// `OPEN_FILES.lock()?.remove()` and then while still locked, `OPEN_FILES.lock()` again)
Self::remote_close(self.fd).expect(
"mirrord failed to send close file message to main layer thread. Error: {err:?}",
let result = Self::remote_close(self.fd);
assert!(
result.is_ok(),
"mirrord failed to send close file message to main layer thread. Error: {result:?}",
);
}
}
Expand Down
1 change: 0 additions & 1 deletion mirrord/operator/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ where
layer_config.kube_context.clone(),
)
.await
.map_err(KubeApiError::from)
.map_err(OperatorApiError::CreateKubeClient)?;

client_config.headers.push((
Expand Down
2 changes: 1 addition & 1 deletion mirrord/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mirrord-protocol"
version = "1.16.0"
version = "1.16.1"
authors.workspace = true
description.workspace = true
documentation.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion mirrord/protocol/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl From<io::ErrorKind> for ErrorKindInternal {
io::ErrorKind::WriteZero => ErrorKindInternal::WriteZero,
io::ErrorKind::StorageFull => ErrorKindInternal::StorageFull,
io::ErrorKind::NotSeekable => ErrorKindInternal::NotSeekable,
io::ErrorKind::FilesystemQuotaExceeded => ErrorKindInternal::FilesystemQuotaExceeded,
io::ErrorKind::QuotaExceeded => ErrorKindInternal::FilesystemQuotaExceeded,
io::ErrorKind::FileTooLarge => ErrorKindInternal::FileTooLarge,
io::ErrorKind::ResourceBusy => ErrorKindInternal::ResourceBusy,
io::ErrorKind::ExecutableFileBusy => ErrorKindInternal::ExecutableFileBusy,
Expand Down
6 changes: 2 additions & 4 deletions mirrord/vpn/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ impl VpnAgent {
_ => None,
},
)
.await
.map_err(VpnError::from)?
.await?
else {
return Err(VpnError::AgentUnexpectedResponse);
};
Expand Down Expand Up @@ -79,8 +78,7 @@ impl VpnAgent {
_ => None,
},
)
.await
.map_err(VpnError::from)?;
.await?;

match response {
Some(ServerVpn::NetworkConfiguration(network)) => Ok(network),
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-10-11"
channel = "nightly-2025-01-22"
components = [ "rustfmt", "clippy", "rustc" ]
profile = "minimal"
2 changes: 1 addition & 1 deletion tests/rust-sqs-printer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Using the agent's build image, that has rustup targets, zigbuild etc.
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:193d12d5d8015c1ed60b9eda30c708cb9c4653e9 AS build-env
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:602d397f8e2088ca6ef229e7da0f86490153d8b7 AS build-env
ARG TARGETARCH

WORKDIR /build
Expand Down
Loading