Skip to content

Commit 9e948e0

Browse files
authored
chore(build): generates Linux binaries on CentOS 7 MONGOSH-435 (#497)
For lowering our glibc requirements.
1 parent 5822200 commit 9e948e0

File tree

9 files changed

+72
-41
lines changed

9 files changed

+72
-41
lines changed

.evergreen.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ variables:
2121
if [ `uname` == Linux ]; then
2222
mkdir -p tmp
2323
cp "$(pwd)/../tmp/expansions.yaml" tmp/expansions.yaml
24-
(cd scripts/docker && docker build -t ubuntu16.04-build -f ubuntu16.04-build.Dockerfile .)
24+
(cd scripts/docker && docker build -t centos7-build -f centos7-build.Dockerfile .)
2525
echo Starting Docker container build
2626
docker run -e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD \
2727
-e EVERGREEN_EXPANSIONS_PATH=/tmp/build/tmp/expansions.yaml \
2828
-e NODE_JS_VERSION \
2929
-e BUILD_VARIANT \
30-
--rm -v $PWD:/tmp/build --network host ubuntu16.04-build \
31-
-c 'cd /tmp/build && npm run evergreen-release package && dist/mongosh --version'
30+
--rm -v $PWD:/tmp/build --network host centos7-build \
31+
-c 'source /opt/rh/devtoolset-8/enable && cd /tmp/build && npm run evergreen-release package && dist/mongosh --version'
3232
else
3333
npm run evergreen-release package
3434
if [ `uname` == Darwin ]; then
@@ -531,9 +531,15 @@ tasks:
531531
- name: compile_and_upload_artifact_linux
532532
variant: linux
533533
- name: test_linux_artifact
534-
variant: rhel_real
534+
variant: rhel70
535535
- name: test_linux_artifact
536-
variant: debian_real
536+
variant: rhel76
537+
- name: test_linux_artifact
538+
variant: debian10
539+
- name: test_linux_artifact
540+
variant: ubuntu1604
541+
- name: test_linux_artifact
542+
variant: ubuntu2004
537543
- name: compile_and_upload_artifact_macos
538544
variant: darwin_codesign
539545
- name: test_vscode
@@ -595,14 +601,29 @@ buildvariants:
595601
tasks:
596602
- name: check
597603
- name: compile_and_upload_artifact_linux
598-
- name: rhel_real
599-
display_name: "RHEL 8.0"
600-
run_on: rhel80-large
604+
- name: rhel70
605+
display_name: "RHEL 7.0"
606+
run_on: rhel70-small
607+
tasks:
608+
- name: test_linux_artifact
609+
- name: rhel76
610+
display_name: "RHEL 7.6"
611+
run_on: rhel76-small
612+
tasks:
613+
- name: test_linux_artifact
614+
- name: ubuntu1604
615+
display_name: "Ubuntu 16.04"
616+
run_on: ubuntu1604-small
617+
tasks:
618+
- name: test_linux_artifact
619+
- name: ubuntu2004
620+
display_name: "Ubuntu 20.04"
621+
run_on: ubuntu2004-small
601622
tasks:
602623
- name: test_linux_artifact
603-
- name: debian_real
624+
- name: debian10
604625
display_name: "Debian 10"
605-
run_on: debian10-large
626+
run_on: debian10-small
606627
tasks:
607628
- name: test_linux_artifact
608629
- name: win32

.evergreen/.install_node

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ node --version
1717
echo "Using npm version:"
1818
npm --version
1919

20-
npm run bootstrap-ci
20+
npm --unsafe-perm=true run bootstrap-ci

.evergreen/.setup_env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
set -e
2+
export PATH="/opt/python/3.6/bin/:$PATH"
3+
24
export NVM_DIR="$HOME/.nvm"
35
echo "Setting NVM environment home: $NVM_DIR"
46
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM centos:7
2+
3+
RUN yum install -y centos-release-scl epel-release
4+
RUN yum repolist
5+
RUN yum install -y python3 devtoolset-8 rpm-build dpkg-devel dpkg-dev git cmake
6+
RUN scl enable devtoolset-8 bash
7+
8+
# Add Node.js
9+
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash -
10+
RUN yum install -y nodejs
11+
12+
# Add sccache
13+
RUN curl -L https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz | tar -C /usr/local/bin -xzvf - --strip=1 sccache-0.2.13-x86_64-unknown-linux-musl/sccache
14+
15+
ENV CC="sccache gcc"
16+
ENV CXX="sccache g++"
17+
18+
RUN bash -c 'source /opt/rh/devtoolset-8/enable && g++ --version'
19+
20+
ENTRYPOINT [ "bash" ]

scripts/docker/centos6-rpm.Dockerfile renamed to scripts/docker/centos7-rpm.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM centos:6
1+
FROM centos:7
22

33
ARG commit=""
44
ARG version=""

scripts/docker/ubuntu16.04-build.Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:16.04
2+
3+
ARG commit=""
4+
ARG version=""
5+
ADD https://s3.amazonaws.com/mciuploads/mongosh/${commit}/mongosh_${version}_amd64.deb /tmp
6+
RUN dpkg -i /tmp/mongosh_${version}_amd64.deb
7+
ENTRYPOINT [ "mongosh" ]
8+
9+

scripts/prep-fle-addon.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [ x"$FLE_NODE_SOURCE_PATH" != x"" -a -z "$BUILD_FLE_FROM_SOURCE" ]; then
3636
# Use prebuilt binaries where available.
3737
case `uname` in
3838
Darwin*) PREBUILT_OSNAME=macos;;
39-
Linux*) PREBUILT_OSNAME=ubuntu1604;;
39+
Linux*) PREBUILT_OSNAME=rhel-70-64-bit;;
4040
# Windows doesn't work because of dllimport/dllexport issues.
4141
#CYGWIN*|MINGW32*|MSYS*|MINGW*) PREBUILT_OSNAME=windows-test;;
4242
esac
@@ -52,12 +52,13 @@ if [ x"$PREBUILT_OSNAME" != x"" ]; then
5252

5353
# Download and extract prebuilt binaries.
5454
curl -sSfLO https://s3.amazonaws.com/mciuploads/libmongocrypt/$PREBUILT_OSNAME/master/$LIBMONGOCRYPT_VERSION/libmongocrypt.tar.gz
55+
if tar -tzf libmongocrypt.tar.gz lib64; then LIB=lib64; else LIB=lib; fi
5556
mkdir -p prebuilts
56-
tar -xzvf libmongocrypt.tar.gz -C prebuilts nocrypto/ lib/
57+
tar -xzvf libmongocrypt.tar.gz -C prebuilts nocrypto/ $LIB/
5758
mkdir -p lib
58-
mv -v prebuilts/nocrypto/lib/* lib
59+
mv -v prebuilts/nocrypto/$LIB/* lib
5960
mv -v prebuilts/nocrypto/include include
60-
mv -v prebuilts/lib/*bson* lib
61+
mv -v prebuilts/$LIB/*bson* lib
6162
cp lib/bson-1.0.lib lib/bson-static-1.0.lib || true # Windows
6263
else
6364
if [ `uname` = Darwin ]; then

testing/download-mongodb.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type FullJSON = {
5858
// use mongodb-download-url for that. For macOS, either would probably be fine.
5959
// TODO: upstream all of this into mongodb-download-url :(
6060
async function lookupDownloadUrl(versionInfo: VersionInfo): Promise<string> {
61-
const knownDistroRegex = /^(?<name>rhel80|debian10)/;
61+
const knownDistroRegex = /^(?<name>rhel80|rhel7[0-9]|debian10)/;
6262
const { version } = versionInfo;
6363
const distroId = process.env.DISTRO_ID || '';
6464
if ((process.platform === 'win32' && semver.lt(version, '4.4.0')) ||
@@ -73,7 +73,8 @@ async function lookupDownloadUrl(versionInfo: VersionInfo): Promise<string> {
7373
.find((downloadInfo: DownloadInfo) =>
7474
downloadInfo.target === 'windows' && downloadInfo.edition === 'base') as DownloadInfo;
7575
} else {
76-
const distro = distroId.match(knownDistroRegex)!.groups!.name;
76+
let distro = distroId.match(knownDistroRegex)!.groups!.name;
77+
if (distro.match(/rhel7[0-9]/)) distro = 'rhel70';
7778
downloadInfo = versionInfo.downloads
7879
.find((downloadInfo: DownloadInfo) =>
7980
downloadInfo.target === distro && downloadInfo.edition === 'targeted') as DownloadInfo;

0 commit comments

Comments
 (0)