Skip to content

Commit 29c5b94

Browse files
committed
ci: Require specifying version in install-musl.sh
Getting this information from an env has been problematic since `docker build` doesn't pass the environment. Switch to expecting an explicit arg and fail if unset, so we don't accidentally regress. With this change, new musl tests are correctly getting run in CI.
1 parent 5981556 commit 29c5b94

File tree

10 files changed

+45
-15
lines changed

10 files changed

+45
-15
lines changed

ci/docker/aarch64-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
rsync \
1414
xz-utils
1515

16+
ARG MUSL_VERSION
1617
COPY install-musl.sh /
17-
RUN /install-musl.sh aarch64
18+
RUN /install-musl.sh aarch64 "$MUSL_VERSION"
1819

1920
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
2021
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \

ci/docker/arm-unknown-linux-musleabihf/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
1616
rsync \
1717
xz-utils
1818

19+
ARG MUSL_VERSION
1920
COPY install-musl.sh /
20-
RUN /install-musl.sh arm
21+
RUN /install-musl.sh arm "$MUSL_VERSION"
2122

2223
ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
2324
CC_arm_unknown_linux_musleabihf=musl-gcc \

ci/docker/i686-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
1616
rsync \
1717
xz-utils
1818

19+
ARG MUSL_VERSION
1920
COPY install-musl.sh /
20-
RUN /install-musl.sh i686
21+
RUN /install-musl.sh i686 "$MUSL_VERSION"
2122

2223
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
2324
CC_i686_unknown_linux_musl=musl-gcc \

ci/docker/loongarch64-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
rsync \
1414
xz-utils
1515

16+
ARG MUSL_VERSION
1617
COPY install-musl.sh /
17-
RUN /install-musl.sh loongarch64
18+
RUN /install-musl.sh loongarch64 "$MUSL_VERSION"
1819

1920
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
2021
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \

ci/docker/powerpc64le-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
rsync \
1414
xz-utils
1515

16+
ARG MUSL_VERSION
1617
COPY install-musl.sh /
17-
RUN /install-musl.sh powerpc64le
18+
RUN /install-musl.sh powerpc64le "$MUSL_VERSION"
1819

1920
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
2021
ENV PATH=$PATH:/musl-powerpc64/bin:/rust/bin \

ci/docker/s390x-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1010
patch \
1111
rsync
1212

13+
ARG MUSL_VERSION
1314
COPY install-musl.sh /
14-
RUN /install-musl.sh s390x
15+
RUN /install-musl.sh s390x "$MUSL_VERSION"
1516

1617
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
1718
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \

ci/docker/x86_64-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1111
rsync \
1212
xz-utils
1313

14+
ARG MUSL_VERSION
1415
COPY install-musl.sh /
15-
RUN /install-musl.sh x86_64
16+
RUN /install-musl.sh x86_64 "$MUSL_VERSION"
1617

1718
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin \
1819
RUSTFLAGS="-L /musl-x86_64/lib"

ci/install-musl.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@
55

66
set -eux
77

8+
arch="$1"
9+
version="$2"
810
old_musl=1.1.24
911
new_musl=1.2.5
1012

11-
case ${1} in
13+
case "$arch" in
1214
loongarch64) musl_version="$new_musl" ;;
1315
*)
14-
[ -n "${RUST_LIBC_UNSTABLE_MUSL_V1_2_3:-}" ] &&
15-
musl_version="$new_musl" ||
16-
musl_version="$old_musl"
16+
case "$version" in
17+
old) musl_version="$old_musl" ;;
18+
new) musl_version="$new_musl" ;;
19+
*)
20+
echo "musl version must be set to either 'old' or 'new'"
21+
exit 1
22+
;;
23+
esac
1724
;;
1825
esac
1926

ci/prep-semver-baseline.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fi
2121
# Find the most recent version matching a pattern.
2222
version=$(
2323
echo "$index" |
24-
jq -er --slurp --arg pat "$pat" '
24+
jq -er --slurp --arg pat "$pat" '
2525
map(select(.vers | test($pat)))
2626
| last
2727
| debug("version:", .)

ci/run-docker.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
# Disable SC2086 as it confuses the docker command.
44
# shellcheck disable=SC2086
@@ -27,10 +27,26 @@ if [ "${CI:-0}" != "0" ] && [ "$target" = "aarch64-linux-android" ]; then
2727
fi
2828

2929
run() {
30-
echo "Building docker container for target $target"
30+
run_target="$1"
31+
echo "Building docker container for target $run_target"
32+
33+
build_args=(
34+
"--tag=libc-$run_target"
35+
"--file=ci/docker/$run_target/Dockerfile"
36+
"ci/"
37+
)
38+
39+
if [[ "$run_target" = *"musl"* ]]; then
40+
if [ -n "${RUST_LIBC_UNSTABLE_MUSL_V1_2_3:-}" ]; then
41+
build_args+=("--build-arg=MUSL_VERSION=new")
42+
else
43+
build_args+=("--build-arg=MUSL_VERSION=old")
44+
fi
45+
fi
3146

3247
# use -f so we can use ci/ as build context
33-
docker build -t "libc-$target" -f "ci/docker/$target/Dockerfile" ci/
48+
docker build "${build_args[@]}"
49+
3450
mkdir -p target
3551
if [ -w /dev/kvm ]; then
3652
kvm="--volume /dev/kvm:/dev/kvm"

0 commit comments

Comments
 (0)