From a22c5b91ce9ca8fe91c0274ad49837a30c53a188 Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Fri, 22 May 2026 17:06:57 +0100 Subject: [PATCH] fix(rust): add support for `nightly` channel As per https://github.com/renovatebot/renovate/discussions/43489, when Renovate provides a date-based nightly version, such as `nightly-2026-06-19`, Containerbase doesn't currently determine the correct URL to download the nightly build from. We can make sure to rewrite the URL as appropriate when a specific Nightly version is specified. With help from Claude to write the test, and GPT-4.1 to write the pattern match. Co-authored-by: gpt-4.1 Co-authored-by: Claude Sonnet 4.6 --- src/usr/local/containerbase/tools/v2/rust.sh | 6 +++++- test/rust/Dockerfile | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/usr/local/containerbase/tools/v2/rust.sh b/src/usr/local/containerbase/tools/v2/rust.sh index 7af2d62c98..9c6d4a9518 100644 --- a/src/usr/local/containerbase/tools/v2/rust.sh +++ b/src/usr/local/containerbase/tools/v2/rust.sh @@ -24,7 +24,7 @@ function init_tool () { } function check_tool_requirements () { - if [[ "${TOOL_VERSION}" == "nightly" || "${TOOL_VERSION}" == "beta" ]]; then + if [[ "${TOOL_VERSION}" == "beta" || "${TOOL_VERSION}" == "nightly" || "${TOOL_VERSION}" == nightly-* ]]; then # allow beta and nightly versions return fi @@ -43,6 +43,10 @@ function install_tool () { local file_name file_name="rust-${TOOL_VERSION}-${arch}-unknown-linux-gnu.tar" + if [[ "${TOOL_VERSION}" == nightly-* ]]; then + NIGHTLY_DATE="${TOOL_VERSION#nightly-}" + file_name="${NIGHTLY_DATE}/rust-nightly-${arch}-unknown-linux-gnu.tar" + fi base_url="https://static.rust-lang.org/dist/${file_name}" # not all releases have checksums diff --git a/test/rust/Dockerfile b/test/rust/Dockerfile index 3ae21ab24e..ef4b197314 100644 --- a/test/rust/Dockerfile +++ b/test/rust/Dockerfile @@ -116,6 +116,19 @@ SHELL [ "/bin/sh", "-c" ] RUN rustc --version RUN cargo --version +#-------------------------------------- +# test e: nightly with date +#-------------------------------------- +FROM base AS teste + +USER 12021 + +RUN install-tool rust nightly-2026-06-19 + +SHELL [ "/bin/sh", "-c" ] +RUN rustc --version +RUN cargo --version + #-------------------------------------- # final #-------------------------------------- @@ -125,3 +138,4 @@ COPY --from=testa /.dummy /.dummy COPY --from=testb /.dummy /.dummy COPY --from=testc /.dummy /.dummy COPY --from=testd /.dummy /.dummy +COPY --from=teste /.dummy /.dummy