diff --git a/baseimages/Dockerfile.rust b/baseimages/Dockerfile.rust index b9107e88d..18d295e86 100644 --- a/baseimages/Dockerfile.rust +++ b/baseimages/Dockerfile.rust @@ -1,3 +1,3 @@ -FROM rust:1.96.1-alpine3.23@sha256:14b9b5f47dcc6644d0f0c1b35a2c2c5d0124f67159aaee28a348627523459b55 +FROM rust:1.96.1-alpine3.24@sha256:a41f7740f8b45d45795624eec13a8b42263cc700f19f7e4e86e04d3dda08a479 CMD echo this is a dummy file used to automate dependency upgrades for plugins diff --git a/plugins/anthropics/connect-rust/v0.7.0/buf.plugin.yaml b/plugins/anthropics/connect-rust/v0.7.0/buf.plugin.yaml index e87c6d3a1..eca7d8a36 100644 --- a/plugins/anthropics/connect-rust/v0.7.0/buf.plugin.yaml +++ b/plugins/anthropics/connect-rust/v0.7.0/buf.plugin.yaml @@ -9,6 +9,7 @@ output_languages: - rust spdx_license_id: Apache-2.0 license_url: https://github.com/anthropics/connect-rust/blob/v0.7.0/LICENSE +deprecated: true registry: cargo: rust_version: "1.88" diff --git a/plugins/connectrpc/rust/source.yaml b/plugins/connectrpc/rust/source.yaml new file mode 100644 index 000000000..e017419b4 --- /dev/null +++ b/plugins/connectrpc/rust/source.yaml @@ -0,0 +1,3 @@ +source: + crates: + crate_name: connectrpc-codegen diff --git a/plugins/connectrpc/rust/v0.8.0/.dockerignore b/plugins/connectrpc/rust/v0.8.0/.dockerignore new file mode 100644 index 000000000..5d0f124ff --- /dev/null +++ b/plugins/connectrpc/rust/v0.8.0/.dockerignore @@ -0,0 +1,2 @@ +* +!Dockerfile diff --git a/plugins/connectrpc/rust/v0.8.0/Dockerfile b/plugins/connectrpc/rust/v0.8.0/Dockerfile new file mode 100644 index 000000000..b3f064acb --- /dev/null +++ b/plugins/connectrpc/rust/v0.8.0/Dockerfile @@ -0,0 +1,17 @@ +# syntax=docker/dockerfile:1.24 +FROM rust:1.96.1-alpine3.24@sha256:a41f7740f8b45d45795624eec13a8b42263cc700f19f7e4e86e04d3dda08a479 AS builder +RUN apk add --no-cache musl-dev +WORKDIR /app +ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse +# The protoc-gen-connect-rust binary is a [[bin]] target in the +# connectrpc-codegen crate. cargo install compiles it by crate name. +RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ + cargo install connectrpc-codegen --version 0.8.0 --locked --root /app + +FROM gcr.io/distroless/static-debian13:latest@sha256:3592aa8171c77482f62bbc4164e6a2d141c6122554ace66e5cc910cadb961ff0 AS base + +FROM scratch +COPY --link --from=base / / +COPY --link --from=builder /app/bin/protoc-gen-connect-rust /protoc-gen-connect-rust +USER nobody +ENTRYPOINT ["/protoc-gen-connect-rust"] diff --git a/plugins/connectrpc/rust/v0.8.0/buf.plugin.yaml b/plugins/connectrpc/rust/v0.8.0/buf.plugin.yaml new file mode 100644 index 000000000..bb9dd995c --- /dev/null +++ b/plugins/connectrpc/rust/v0.8.0/buf.plugin.yaml @@ -0,0 +1,55 @@ +version: v1 +name: buf.build/connectrpc/rust +plugin_version: v0.8.0 +source_url: https://github.com/connectrpc/connect-rust +description: Generates ConnectRPC service traits, typed clients, and monomorphic dispatchers for Rust. Compatible with the Connect, gRPC, and gRPC-Web protocols. +deps: + - plugin: buf.build/anthropics/buffa:v0.8.1 +output_languages: + - rust +spdx_license_id: Apache-2.0 +license_url: https://github.com/connectrpc/connect-rust/blob/v0.8.0/LICENSE +registry: + cargo: + rust_version: "1.88" + deps: + # ConnectRPC runtime: Router, Context, ConnectError, client transports. + # https://github.com/connectrpc/connect-rust/blob/v0.8.0/connectrpc/Cargo.toml + - name: "connectrpc" + req: "0.8.0" + default_features: true + # Generated service stubs use buffa::Message, buffa::view::OwnedView, + # buffa::bytes::Bytes directly. Message types live in the buffa SDK + # crate (via the plugin dep above); this dep is for the runtime API. + - name: "buffa" + req: "0.8.1" + default_features: true + # Well-known types. Service stubs whose request/response types are + # WKTs (e.g. google.longrunning.Operations) reference them as + # `::buffa_types::google::protobuf::...`, mirroring buffa-codegen's + # extern_path mapping for `.google.protobuf`. Must be a direct dep + # so the `::buffa_types` path resolves in the generated crate. + - name: "buffa-types" + req: "0.8.1" + default_features: true + features: + - json + # Streaming method signatures use futures::Stream. + - name: "futures" + req: "0.3" + default_features: true + # Client transport bounds reference http_body::Body. + - name: "http-body" + req: "1" + default_features: true + # The plugin accepts `extern_path=.=` (or the shorthand + # `buffa_module=`) to tell it where the buffa-generated message + # types live. BSR should inject this based on the buffa dep's SDK crate + # name, same as tonic receives extern_path for its prost dep. Leaving + # it out here; please advise if an explicit entry is needed. + opts: + # Emit one `.rs` per proto package, mirroring the + # buffa plugin's `file_per_package=true` opt. Matches the + # prost/tonic filename convention the BSR Rust SDK lib.rs + # synthesis expects. + - file_per_package diff --git a/tests/plugins_test.go b/tests/plugins_test.go index a9129ad7e..55d318200 100644 --- a/tests/plugins_test.go +++ b/tests/plugins_test.go @@ -81,6 +81,7 @@ exec docker run --log-driver=none --rm -i {{.ImageName}}:{{.Version}} "$@" // build time. The standalone test harness has no dep chain, so provide // a placeholder catch-all mapping. "buf.build/anthropics/connect-rust": {"extern_path=.=crate"}, + "buf.build/connectrpc/rust": {"extern_path=.=crate"}, } // Some plugins do not generate any code for the test protos, so we allow an empty plugin.sum file for these // plugins. The format of the map is map[pluginName]map[image]bool, where the bool indicates whether an empty diff --git a/tests/testdata/buf.build/connectrpc/rust/v0.8.0/eliza/plugin.sum b/tests/testdata/buf.build/connectrpc/rust/v0.8.0/eliza/plugin.sum new file mode 100644 index 000000000..745f04ec3 --- /dev/null +++ b/tests/testdata/buf.build/connectrpc/rust/v0.8.0/eliza/plugin.sum @@ -0,0 +1 @@ +h1:QLUIhPVdSGhw2579QrDFYJHrubR+tyRjQoMOu+GVhnY= diff --git a/tests/testdata/buf.build/connectrpc/rust/v0.8.0/petapis/plugin.sum b/tests/testdata/buf.build/connectrpc/rust/v0.8.0/petapis/plugin.sum new file mode 100644 index 000000000..3935c8274 --- /dev/null +++ b/tests/testdata/buf.build/connectrpc/rust/v0.8.0/petapis/plugin.sum @@ -0,0 +1 @@ +h1:G23VgSBmPDKsPIJcoLEfAqEzZqtHuPV9K0D/rSa3OLs=