Skip to content

Commit efea166

Browse files
ci(NODE-6728): test FLE on Alpine linux (#4417)
Co-authored-by: Durran Jordan <[email protected]>
1 parent 26f15d7 commit efea166

16 files changed

+491
-338
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
lib
3+
.nyc_output
4+
docs
5+
*dylib
6+
*md

.evergreen/config.in.yml

+22
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,21 @@ functions:
734734
args:
735735
- ${PROJECT_DIRECTORY}/.evergreen/install-mongodb-client-encryption.sh
736736

737+
"build and test alpine FLE":
738+
- command: subprocess.exec
739+
type: test
740+
params:
741+
working_dir: "src"
742+
env:
743+
INSTALL_DIR: mongodb-client-encryption
744+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
745+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
746+
NODE_VERSION: ${NODE_VERSION}
747+
MONGODB_URI: ${MONGODB_URI}
748+
binary: bash
749+
args:
750+
- .evergreen/docker/alpine.sh
751+
737752
tasks:
738753
- name: 'test-atlas-data-lake'
739754
tags: ["datalake", "mongohouse"]
@@ -1272,3 +1287,10 @@ post:
12721287

12731288
ignore:
12741289
- "*.md"
1290+
1291+
buildvariants:
1292+
- name: Alpine FLE Tests
1293+
display_name: Alpine FLE Test
1294+
run_on: ubuntu2204-small
1295+
tasks:
1296+
- .alpine-fle

.evergreen/config.yml

+38
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,20 @@ functions:
657657
binary: bash
658658
args:
659659
- ${PROJECT_DIRECTORY}/.evergreen/install-mongodb-client-encryption.sh
660+
build and test alpine FLE:
661+
- command: subprocess.exec
662+
type: test
663+
params:
664+
working_dir: src
665+
env:
666+
INSTALL_DIR: mongodb-client-encryption
667+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
668+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
669+
NODE_VERSION: ${NODE_VERSION}
670+
MONGODB_URI: ${MONGODB_URI}
671+
binary: bash
672+
args:
673+
- .evergreen/docker/alpine.sh
660674
tasks:
661675
- name: test-atlas-data-lake
662676
tags:
@@ -2300,6 +2314,25 @@ tasks:
23002314
vars:
23012315
23022316
- func: run tests
2317+
- name: test-alpine-fle
2318+
tags:
2319+
- alpine-fle
2320+
commands:
2321+
- command: expansions.update
2322+
type: setup
2323+
params:
2324+
updates:
2325+
- {key: NODE_VERSION, value: 16.20.1}
2326+
- {key: VERSION, value: latest}
2327+
- {key: TOPOLOGY, value: replica_set}
2328+
- {key: CLIENT_ENCRYPTION, value: 'true'}
2329+
- {key: TEST_CSFLE, value: 'true'}
2330+
- {key: MONGODB_BINARIES, value: '${PROJECT_DIRECTORY}/mongodb/bin'}
2331+
- func: install dependencies
2332+
- func: bootstrap mongo-orchestration
2333+
- func: bootstrap kms servers
2334+
- func: assume secrets manager rule
2335+
- func: build and test alpine FLE
23032336
- name: test-latest-server-noauth
23042337
tags:
23052338
- latest
@@ -3191,6 +3224,11 @@ post:
31913224
ignore:
31923225
- '*.md'
31933226
buildvariants:
3227+
- name: Alpine FLE Tests
3228+
display_name: Alpine FLE Test
3229+
run_on: ubuntu2204-small
3230+
tasks:
3231+
- .alpine-fle
31943232
- name: rhel80-large-gallium
31953233
display_name: rhel8 Node16
31963234
run_on: rhel80-large

.evergreen/docker/Dockerfile.musl

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ARG ARCH=arm64
2+
ARG NODE_VERSION=16.20.1
3+
4+
FROM ${ARCH}/node:${NODE_VERSION}-alpine AS dependencies
5+
6+
RUN apk --no-cache add make g++ libc-dev curl bash python3 py3-pip cmake git vim ranger
7+
8+
# useful debugging output
9+
RUN <<EOF
10+
python3 --version
11+
git --version
12+
c++ --version
13+
g++ --version
14+
EOF
15+
16+
# clone drivers evergreen tools into the same location that it lives on the host machine
17+
# this ensures any paths configured in variables by drivers-evergreen-tools work
18+
# in the container too.
19+
ARG DRIVERS_TOOLS=drivers-evergreen-tools
20+
WORKDIR ${DRIVERS_TOOLS}
21+
RUN git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git .

.evergreen/docker/alpine.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#! /bin/bash
2+
3+
# script to aid in local testing of linux platforms
4+
# requires a running docker instance
5+
6+
if [ -z ${NODE_VERSION+omitted} ]; then echo "NODE_VERSION is unset" && exit 1; fi
7+
if [ -z ${DRIVERS_TOOLS+omitted} ]; then echo "DRIVERS_TOOLS is unset" && exit 1; fi
8+
if [ -z ${MONGODB_URI+omitted} ]; then echo "MONGODB_URI is unset" && exit 1; fi
9+
10+
# ubuntu2204 hosts in ci use amd64
11+
LINUX_ARCH=${LINUX_ARCH:-amd64}
12+
13+
IMAGE_TAG=${IMAGE_TAG:-alpine-fle-image}
14+
15+
build_alpine() {
16+
docker buildx create --name builder --bootstrap --use
17+
18+
BASE_TAG=$LINUX_ARCH-alpine-base-node-$NODE_VERSION
19+
docker --debug buildx build --load --progress=plain \
20+
--platform linux/$LINUX_ARCH \
21+
--build-arg="ARCH=$LINUX_ARCH" \
22+
--build-arg="NODE_VERSION=$NODE_VERSION" \
23+
--build-arg="DRIVERS_TOOLS=$DRIVERS_TOOLS" \
24+
-f ./.evergreen/docker/Dockerfile.musl -t $IMAGE_TAG \
25+
.
26+
}
27+
28+
test_alpine() {
29+
# # launch a mongocryptd on the host.
30+
./mongodb/bin/mongocryptd --fork --port 3000 --pidfilepath $(pwd)/pid.file --logpath $(pwd)/logpath
31+
MONGOCRYPTD_URI='mongodb://localhost:3000'
32+
33+
# set up FLE creds on host. don't download cryptd because we don't need it.
34+
RUN_WITH_MONGOCRYPTD=true bash .evergreen/setup-fle.sh
35+
36+
# remove node_modules to remove any already downloaded prebuilds
37+
rm -rf node_modules
38+
39+
# run FLE tests in container, using mongocryptd and replica set running on host.
40+
# mount the current directory (the driver's root) as /node-mongodb-native and
41+
# use that as the working directory for `run-alpine-fle-tests.sh`
42+
docker --debug run \
43+
--platform linux/$LINUX_ARCH \
44+
-e MONGODB_URI=${MONGODB_URI} -e MONGOCRYPTD_URI=${MONGOCRYPTD_URI} \
45+
--volume $(pwd):/node-mongodb-native -w /node-mongodb-native \
46+
--network host \
47+
--entrypoint bash \
48+
$IMAGE_TAG \
49+
'.evergreen/run-alpine-fle-tests.sh'
50+
}
51+
52+
build_alpine
53+
test_alpine

.evergreen/generate_evergreen_tasks.js

+22
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,28 @@ const coverageTask = {
729729
SINGLETON_TASKS.push(coverageTask);
730730
SINGLETON_TASKS.push(...customDependencyTests);
731731

732+
SINGLETON_TASKS.push(
733+
{
734+
name: `test-alpine-fle`,
735+
tags: ['alpine-fle'],
736+
commands: [
737+
updateExpansions({
738+
NODE_VERSION: '16.20.1',
739+
VERSION: 'latest',
740+
TOPOLOGY: 'replica_set',
741+
CLIENT_ENCRYPTION: true,
742+
TEST_CSFLE: true,
743+
MONGODB_BINARIES: '${PROJECT_DIRECTORY}/mongodb/bin',
744+
}),
745+
{ func: 'install dependencies' },
746+
{ func: 'bootstrap mongo-orchestration' },
747+
{ func: 'bootstrap kms servers' },
748+
{ func: 'assume secrets manager rule' },
749+
{ func: 'build and test alpine FLE' }
750+
]
751+
}
752+
)
753+
732754
function addPerformanceTasks() {
733755
const makePerfTask = (name, MONGODB_CLIENT_OPTIONS) => ({
734756
name,

.evergreen/run-alpine-fle-tests.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /usr/bin/env bash
2+
3+
set -o errexit
4+
source secrets-export.sh
5+
set -o xtrace
6+
7+
# use local cache - otherwise npm tries to install to ~ in the docker container, which
8+
# fails when in a mounted volume
9+
export npm_config_cache=$(pwd)/.cache
10+
npm install
11+
12+
ALPINE=true \
13+
npm run check:csfle

.evergreen/run-kerberos-tests.sh

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export MONGODB_URI="mongodb://${USER}@${SASL_HOST}/${GSSAPI_DB}?authMechanism=GS
2828

2929
set -o xtrace
3030

31+
npm i kerberos
3132
npm run check:kerberos
3233

3334
set +o xtrace

0 commit comments

Comments
 (0)