Skip to content

Commit 529bd9c

Browse files
bnbarhamDougGregorshahmishal
authored
Install a Swift 5.8.1 toolchain in all swift-ci images (#346)
* Install a Swift 5.8.1 toolchain in all swift-ci images Installs a Swift 5.8.1 toolchain into `/opt/swift/<version>` on each Linux platform. Removes clang since the toolchain clang can be used instead. * Use swift.org keys to avoid timeout and revert group id change * Add missing python3-pkg-resources dependencies * Use swift.org keys to avoid timeout on the rest of the platforms This was only changed for Ubuntu, also update for Amazon Linux, CentOS, and UBI. * Add diffutils to UBI 9 This presumably came through clang previously as a transitive dependency. Add it directly. --------- Co-authored-by: Doug Gregor <[email protected]> Co-authored-by: Mishal Shah <[email protected]>
1 parent b164b63 commit 529bd9c

File tree

6 files changed

+248
-10
lines changed

6 files changed

+248
-10
lines changed

swift-ci/master/amazon-linux/2/Dockerfile

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
1212
# Update and install needed build packages
1313
RUN yum -y group install "development tools"
1414
RUN yum -y install \
15-
clang \
1615
cmake \
1716
curl-devel \
1817
gcc-c++ \
@@ -47,6 +46,49 @@ RUN mkdir -p /usr/local/lib/python3.7/site-packages/
4746

4847
RUN easy_install-3.7 six
4948

49+
ARG SWIFT_PLATFORM=amazonlinux2
50+
ARG SWIFT_VERSION=5.8.1
51+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
52+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
53+
ARG SWIFT_WEBROOT=https://download.swift.org
54+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
55+
56+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
57+
SWIFT_VERSION=$SWIFT_VERSION \
58+
SWIFT_BRANCH=$SWIFT_BRANCH \
59+
SWIFT_TAG=$SWIFT_TAG \
60+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
61+
SWIFT_PREFIX=$SWIFT_PREFIX
62+
63+
RUN set -e; \
64+
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
65+
url=; \
66+
case "${ARCH_NAME##*-}" in \
67+
'x86_64') \
68+
OS_ARCH_SUFFIX=''; \
69+
;; \
70+
'aarch64') \
71+
OS_ARCH_SUFFIX='-aarch64'; \
72+
;; \
73+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
74+
esac; \
75+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
76+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
77+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
78+
&& echo $SWIFT_BIN_URL \
79+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
80+
&& export GNUPGHOME="$(mktemp -d)" \
81+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
82+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
83+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
84+
# - Unpack the toolchain, set libs permissions, and clean up.
85+
&& mkdir -p $SWIFT_PREFIX \
86+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
87+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
88+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
89+
90+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
91+
5092
USER build-user
5193

5294
WORKDIR /home/build-user

swift-ci/master/centos/7/Dockerfile

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ RUN yum install --enablerepo=centosplus -y \
1919
libtool \
2020
libuuid-devel \
2121
libxml2-devel \
22-
llvm-toolset-7.0 \
2322
make \
2423
ncurses-devel \
2524
ninja-build \
@@ -41,13 +40,41 @@ RUN yum install --enablerepo=centosplus -y \
4140
zip \
4241
zlib-devel
4342

44-
RUN echo -e ". /opt/rh/sclo-git25/enable\n. /opt/rh/llvm-toolset-7.0/enable\n. /opt/rh/devtoolset-8/enable\n" >> /home/build-user/.bashrc
45-
46-
RUN echo /opt/rh/llvm-toolset-7.0/root/usr/lib64/ > /etc/ld.so.conf.d/llvm-toolset.conf
47-
RUN ldconfig
43+
RUN echo -e ". /opt/rh/sclo-git25/enable\n. /opt/rh/devtoolset-8/enable\n" >> /home/build-user/.bashrc
4844

4945
RUN sed -i -e 's/\*__block/\*__libc_block/g' /usr/include/unistd.h
5046

47+
ARG SWIFT_PLATFORM=centos7
48+
ARG SWIFT_VERSION=5.8.1
49+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
50+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
51+
ARG SWIFT_WEBROOT=https://download.swift.org
52+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
53+
54+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
55+
SWIFT_VERSION=$SWIFT_VERSION \
56+
SWIFT_BRANCH=$SWIFT_BRANCH \
57+
SWIFT_TAG=$SWIFT_TAG \
58+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
59+
SWIFT_PREFIX=$SWIFT_PREFIX
60+
61+
RUN set -e; \
62+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)" \
63+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM.tar.gz" \
64+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
65+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
66+
&& export GNUPGHOME="$(mktemp -d)" \
67+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
68+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
69+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
70+
# - Unpack the toolchain, set libs permissions, and clean up.
71+
&& mkdir -p $SWIFT_PREFIX \
72+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
73+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
74+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
75+
76+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
77+
5178
USER build-user
5279

5380
WORKDIR /home/build-user

swift-ci/master/rhel-ubi/9/Dockerfile

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ RUN groupadd -g 42 build-user && \
66
RUN yum install -y \
77
git \
88
gcc-c++ \
9-
clang \
109
cmake \
10+
diffutils \
1111
make \
1212
libcurl-devel \
1313
libedit-devel \
@@ -20,6 +20,49 @@ RUN yum install -y \
2020
unzip \
2121
zip
2222

23+
ARG SWIFT_PLATFORM=ubi9
24+
ARG SWIFT_VERSION=5.8.1
25+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
26+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
27+
ARG SWIFT_WEBROOT=https://download.swift.org
28+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
29+
30+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
31+
SWIFT_VERSION=$SWIFT_VERSION \
32+
SWIFT_BRANCH=$SWIFT_BRANCH \
33+
SWIFT_TAG=$SWIFT_TAG \
34+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
35+
SWIFT_PREFIX=$SWIFT_PREFIX
36+
37+
RUN set -e; \
38+
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
39+
url=; \
40+
case "${ARCH_NAME##*-}" in \
41+
'x86_64') \
42+
OS_ARCH_SUFFIX=''; \
43+
;; \
44+
'aarch64') \
45+
OS_ARCH_SUFFIX='-aarch64'; \
46+
;; \
47+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
48+
esac; \
49+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
50+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
51+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
52+
&& echo $SWIFT_BIN_URL \
53+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
54+
&& export GNUPGHOME="$(mktemp -d)" \
55+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
56+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
57+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
58+
# - Unpack the toolchain, set libs permissions, and clean up.
59+
&& mkdir -p $SWIFT_PREFIX \
60+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
61+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
62+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
63+
64+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
65+
2366
USER build-user
2467

2568
WORKDIR /home/build-user

swift-ci/master/ubuntu/18.04/Dockerfile

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ENV DEBIAN_FRONTEND="noninteractive"
77

88
RUN apt -y update && apt -y install \
99
build-essential \
10-
clang \
1110
cmake \
1211
git \
1312
icu-devtools \
@@ -34,6 +33,41 @@ RUN apt -y update && apt -y install \
3433
uuid-dev \
3534
zip
3635

36+
ARG SWIFT_PLATFORM=ubuntu18.04
37+
ARG SWIFT_VERSION=5.8.1
38+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
39+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
40+
ARG SWIFT_WEBROOT=https://download.swift.org
41+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
42+
43+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
44+
SWIFT_VERSION=$SWIFT_VERSION \
45+
SWIFT_BRANCH=$SWIFT_BRANCH \
46+
SWIFT_TAG=$SWIFT_TAG \
47+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
48+
SWIFT_PREFIX=$SWIFT_PREFIX
49+
50+
RUN set -e; \
51+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)" \
52+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM.tar.gz" \
53+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
54+
# - Grab curl here so we cache better up above
55+
&& export DEBIAN_FRONTEND=noninteractive \
56+
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
57+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
58+
&& export GNUPGHOME="$(mktemp -d)" \
59+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
60+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
61+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
62+
# - Unpack the toolchain, set libs permissions, and clean up.
63+
&& mkdir -p $SWIFT_PREFIX \
64+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
65+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
66+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
67+
&& apt-get purge --auto-remove -y curl
68+
69+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
70+
3771
USER build-user
3872

3973
WORKDIR /home/build-user

swift-ci/master/ubuntu/20.04/Dockerfile

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ENV DEBIAN_FRONTEND="noninteractive"
77

88
RUN apt-get -y update && apt-get -y install \
99
build-essential \
10-
clang \
1110
cmake \
1211
git \
1312
icu-devtools \
@@ -25,6 +24,7 @@ RUN apt-get -y update && apt-get -y install \
2524
python2-dev \
2625
python3-six \
2726
python3-distutils \
27+
python3-pkg-resources \
2828
python3-psutil \
2929
rsync \
3030
swig \
@@ -33,6 +33,52 @@ RUN apt-get -y update && apt-get -y install \
3333
uuid-dev \
3434
zip
3535

36+
ARG SWIFT_PLATFORM=ubuntu20.04
37+
ARG SWIFT_VERSION=5.8.1
38+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
39+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
40+
ARG SWIFT_WEBROOT=https://download.swift.org
41+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
42+
43+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
44+
SWIFT_VERSION=$SWIFT_VERSION \
45+
SWIFT_BRANCH=$SWIFT_BRANCH \
46+
SWIFT_TAG=$SWIFT_TAG \
47+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
48+
SWIFT_PREFIX=$SWIFT_PREFIX
49+
50+
RUN set -e; \
51+
ARCH_NAME="$(dpkg --print-architecture)"; \
52+
url=; \
53+
case "${ARCH_NAME##*-}" in \
54+
'amd64') \
55+
OS_ARCH_SUFFIX=''; \
56+
;; \
57+
'arm64') \
58+
OS_ARCH_SUFFIX='-aarch64'; \
59+
;; \
60+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
61+
esac; \
62+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
63+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
64+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
65+
# - Grab curl here so we cache better up above
66+
&& export DEBIAN_FRONTEND=noninteractive \
67+
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
68+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
69+
&& export GNUPGHOME="$(mktemp -d)" \
70+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
71+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
72+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
73+
# - Unpack the toolchain, set libs permissions, and clean up.
74+
&& mkdir -p $SWIFT_PREFIX \
75+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
76+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
77+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
78+
&& apt-get purge --auto-remove -y curl
79+
80+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
81+
3682
USER build-user
3783

3884
WORKDIR /home/build-user

swift-ci/master/ubuntu/22.04/Dockerfile

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ENV DEBIAN_FRONTEND="noninteractive"
77

88
RUN apt-get -y update && apt-get -y install \
99
build-essential \
10-
clang \
1110
cmake \
1211
git \
1312
icu-devtools \
@@ -25,6 +24,7 @@ RUN apt-get -y update && apt-get -y install \
2524
python2-dev \
2625
python3-six \
2726
python3-distutils \
27+
python3-pkg-resources \
2828
python3-psutil \
2929
rsync \
3030
swig \
@@ -33,6 +33,52 @@ RUN apt-get -y update && apt-get -y install \
3333
uuid-dev \
3434
zip
3535

36+
ARG SWIFT_PLATFORM=ubuntu22.04
37+
ARG SWIFT_VERSION=5.8.1
38+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
39+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
40+
ARG SWIFT_WEBROOT=https://download.swift.org
41+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
42+
43+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
44+
SWIFT_VERSION=$SWIFT_VERSION \
45+
SWIFT_BRANCH=$SWIFT_BRANCH \
46+
SWIFT_TAG=$SWIFT_TAG \
47+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
48+
SWIFT_PREFIX=$SWIFT_PREFIX
49+
50+
RUN set -e; \
51+
ARCH_NAME="$(dpkg --print-architecture)"; \
52+
url=; \
53+
case "${ARCH_NAME##*-}" in \
54+
'amd64') \
55+
OS_ARCH_SUFFIX=''; \
56+
;; \
57+
'arm64') \
58+
OS_ARCH_SUFFIX='-aarch64'; \
59+
;; \
60+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
61+
esac; \
62+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
63+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
64+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
65+
# - Grab curl here so we cache better up above
66+
&& export DEBIAN_FRONTEND=noninteractive \
67+
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
68+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
69+
&& export GNUPGHOME="$(mktemp -d)" \
70+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
71+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
72+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
73+
# - Unpack the toolchain, set libs permissions, and clean up.
74+
&& mkdir -p $SWIFT_PREFIX \
75+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
76+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
77+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
78+
&& apt-get purge --auto-remove -y curl
79+
80+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
81+
3682
USER build-user
3783

3884
WORKDIR /home/build-user

0 commit comments

Comments
 (0)