Skip to content

Commit 9cd2f9b

Browse files
jamietannagpt-4.1Claude Sonnet 4.6
authored
fix(rust): add support for nightly channel (#6768)
As per renovatebot/renovate#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 <jamie.tanna+github-copilot@mend.io> Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
1 parent 6566ad6 commit 9cd2f9b

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/usr/local/containerbase/tools/v2/rust.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function init_tool () {
2424
}
2525

2626
function check_tool_requirements () {
27-
if [[ "${TOOL_VERSION}" == "nightly" || "${TOOL_VERSION}" == "beta" ]]; then
27+
if [[ "${TOOL_VERSION}" == "beta" || "${TOOL_VERSION}" == "nightly" || "${TOOL_VERSION}" == nightly-* ]]; then
2828
# allow beta and nightly versions
2929
return
3030
fi
@@ -43,6 +43,10 @@ function install_tool () {
4343
local file_name
4444

4545
file_name="rust-${TOOL_VERSION}-${arch}-unknown-linux-gnu.tar"
46+
if [[ "${TOOL_VERSION}" == nightly-* ]]; then
47+
NIGHTLY_DATE="${TOOL_VERSION#nightly-}"
48+
file_name="${NIGHTLY_DATE}/rust-nightly-${arch}-unknown-linux-gnu.tar"
49+
fi
4650
base_url="https://static.rust-lang.org/dist/${file_name}"
4751

4852
# not all releases have checksums

test/rust/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,19 @@ SHELL [ "/bin/sh", "-c" ]
116116
RUN rustc --version
117117
RUN cargo --version
118118

119+
#--------------------------------------
120+
# test e: nightly with date
121+
#--------------------------------------
122+
FROM base AS teste
123+
124+
USER 12021
125+
126+
RUN install-tool rust nightly-2026-06-19
127+
128+
SHELL [ "/bin/sh", "-c" ]
129+
RUN rustc --version
130+
RUN cargo --version
131+
119132
#--------------------------------------
120133
# final
121134
#--------------------------------------
@@ -125,3 +138,4 @@ COPY --from=testa /.dummy /.dummy
125138
COPY --from=testb /.dummy /.dummy
126139
COPY --from=testc /.dummy /.dummy
127140
COPY --from=testd /.dummy /.dummy
141+
COPY --from=teste /.dummy /.dummy

0 commit comments

Comments
 (0)