Skip to content

chore(build): generates Linux binaries on CentOS 7 MONGOSH-435 #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ variables:
if [ `uname` == Linux ]; then
mkdir -p tmp
cp "$(pwd)/../tmp/expansions.yaml" tmp/expansions.yaml
(cd scripts/docker && docker build -t ubuntu16.04-build -f ubuntu16.04-build.Dockerfile .)
(cd scripts/docker && docker build -t centos7-build -f centos7-build.Dockerfile .)
echo Starting Docker container build
docker run -e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD \
-e EVERGREEN_EXPANSIONS_PATH=/tmp/build/tmp/expansions.yaml \
-e NODE_JS_VERSION \
-e BUILD_VARIANT \
--rm -v $PWD:/tmp/build --network host ubuntu16.04-build \
-c 'cd /tmp/build && npm run evergreen-release package && dist/mongosh --version'
--rm -v $PWD:/tmp/build --network host centos7-build \
-c 'source /opt/rh/devtoolset-8/enable && cd /tmp/build && npm run evergreen-release package && dist/mongosh --version'
else
npm run evergreen-release package
if [ `uname` == Darwin ]; then
Expand Down Expand Up @@ -511,9 +511,15 @@ tasks:
- name: compile_and_upload_artifact_linux
variant: linux
- name: test_linux_artifact
variant: rhel_real
variant: rhel70
- name: test_linux_artifact
variant: debian_real
variant: rhel76
- name: test_linux_artifact
variant: debian10
- name: test_linux_artifact
variant: ubuntu1604
- name: test_linux_artifact
variant: ubuntu2004
- name: compile_and_upload_artifact_macos
variant: darwin_codesign
- name: test_vscode
Expand Down Expand Up @@ -574,14 +580,29 @@ buildvariants:
tasks:
- name: check
- name: compile_and_upload_artifact_linux
- name: rhel_real
display_name: "RHEL 8.0"
run_on: rhel80-large
- name: rhel70
display_name: "RHEL 7.0"
run_on: rhel70-small
tasks:
- name: test_linux_artifact
- name: rhel76
display_name: "RHEL 7.6"
run_on: rhel76-small
tasks:
- name: test_linux_artifact
- name: ubuntu1604
display_name: "Ubuntu 16.04"
run_on: ubuntu1604-small
tasks:
- name: test_linux_artifact
- name: ubuntu2004
display_name: "Ubuntu 20.04"
run_on: ubuntu2004-small
tasks:
- name: test_linux_artifact
- name: debian_real
- name: debian10
display_name: "Debian 10"
run_on: debian10-large
run_on: debian10-small
tasks:
- name: test_linux_artifact
- name: win32
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/.install_node
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ node --version
echo "Using npm version:"
npm --version

npm run bootstrap-ci
npm --unsafe-perm=true run bootstrap-ci
2 changes: 2 additions & 0 deletions .evergreen/.setup_env
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
set -e
export PATH="/opt/python/3.6/bin/:$PATH"

export NVM_DIR="$HOME/.nvm"
echo "Setting NVM environment home: $NVM_DIR"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Expand Down
20 changes: 20 additions & 0 deletions scripts/docker/centos7-build.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM centos:7

RUN yum install -y centos-release-scl epel-release
RUN yum repolist
RUN yum install -y python3 devtoolset-8 rpm-build dpkg-devel dpkg-dev git cmake
RUN scl enable devtoolset-8 bash

# Add Node.js
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash -
RUN yum install -y nodejs

# Add sccache
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

ENV CC="sccache gcc"
ENV CXX="sccache g++"

RUN bash -c 'source /opt/rh/devtoolset-8/enable && g++ --version'

ENTRYPOINT [ "bash" ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:6
FROM centos:7

ARG commit=""
ARG version=""
Expand Down
23 changes: 0 additions & 23 deletions scripts/docker/ubuntu16.04-build.Dockerfile

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/docker/ubuntu16.04-deb.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:16.04

ARG commit=""
ARG version=""
ADD https://s3.amazonaws.com/mciuploads/mongosh/${commit}/mongosh_${version}_amd64.deb /tmp
RUN dpkg -i /tmp/mongosh_${version}_amd64.deb
ENTRYPOINT [ "mongosh" ]


9 changes: 5 additions & 4 deletions scripts/prep-fle-addon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ x"$FLE_NODE_SOURCE_PATH" != x"" -a -z "$BUILD_FLE_FROM_SOURCE" ]; then
# Use prebuilt binaries where available.
case `uname` in
Darwin*) PREBUILT_OSNAME=macos;;
Linux*) PREBUILT_OSNAME=ubuntu1604;;
Linux*) PREBUILT_OSNAME=rhel-70-64-bit;;
# Windows doesn't work because of dllimport/dllexport issues.
#CYGWIN*|MINGW32*|MSYS*|MINGW*) PREBUILT_OSNAME=windows-test;;
esac
Expand All @@ -52,12 +52,13 @@ if [ x"$PREBUILT_OSNAME" != x"" ]; then

# Download and extract prebuilt binaries.
curl -sSfLO https://s3.amazonaws.com/mciuploads/libmongocrypt/$PREBUILT_OSNAME/master/$LIBMONGOCRYPT_VERSION/libmongocrypt.tar.gz
if tar -tzf libmongocrypt.tar.gz lib64; then LIB=lib64; else LIB=lib; fi
mkdir -p prebuilts
tar -xzvf libmongocrypt.tar.gz -C prebuilts nocrypto/ lib/
tar -xzvf libmongocrypt.tar.gz -C prebuilts nocrypto/ $LIB/
mkdir -p lib
mv -v prebuilts/nocrypto/lib/* lib
mv -v prebuilts/nocrypto/$LIB/* lib
mv -v prebuilts/nocrypto/include include
mv -v prebuilts/lib/*bson* lib
mv -v prebuilts/$LIB/*bson* lib
cp lib/bson-1.0.lib lib/bson-static-1.0.lib || true # Windows
else
if [ `uname` = Darwin ]; then
Expand Down
5 changes: 3 additions & 2 deletions testing/download-mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type FullJSON = {
// use mongodb-download-url for that. For macOS, either would probably be fine.
// TODO: upstream all of this into mongodb-download-url :(
async function lookupDownloadUrl(versionInfo: VersionInfo): Promise<string> {
const knownDistroRegex = /^(?<name>rhel80|debian10)/;
const knownDistroRegex = /^(?<name>rhel80|rhel7[0-9]|debian10)/;
const { version } = versionInfo;
const distroId = process.env.DISTRO_ID || '';
if ((process.platform === 'win32' && semver.lt(version, '4.4.0')) ||
Expand All @@ -73,7 +73,8 @@ async function lookupDownloadUrl(versionInfo: VersionInfo): Promise<string> {
.find((downloadInfo: DownloadInfo) =>
downloadInfo.target === 'windows' && downloadInfo.edition === 'base') as DownloadInfo;
} else {
const distro = distroId.match(knownDistroRegex)!.groups!.name;
let distro = distroId.match(knownDistroRegex)!.groups!.name;
if (distro.match(/rhel7[0-9]/)) distro = 'rhel70';
downloadInfo = versionInfo.downloads
.find((downloadInfo: DownloadInfo) =>
downloadInfo.target === distro && downloadInfo.edition === 'targeted') as DownloadInfo;
Expand Down