@@ -32,39 +32,62 @@ const MONGOSH_PACKAGES = fs.readdirSync(pathToPackages, { withFileTypes: true })
3232 ...(JSON.parse(fs.readFileSync(path.join(pathToPackages, d.name, 'package.json'))).mongosh || {})
3333 }));
3434
35+ const ALL_UNIT_TEST_BUILD_VARIANTS = [];
3536const ALL_UNIT_TESTS = [];
36- for (const packageInfo of MONGOSH_PACKAGES) {
37- for (const { shortName: nShort, versionSpec: nVersion, skipNodeVersionCheck } of NODE_VERSIONS) {
38- const defaultVariants = ['darwin', 'linux', 'win32'];
39- if (packageInfo.unitTestsOnly) {
40- const id = `n${nShort}_${packageInfo.name.replace(/-/g, '_')}`;
41- ALL_UNIT_TESTS.push({
42- id, nShort, nVersion, skipNodeVersionCheck,
43- packageName: packageInfo.name,
44- variants: packageInfo.variants ?? defaultVariants
45- });
46- } else {
47- for (const { shortName: mShort, versionSpec: mVersion } of MONGODB_VERSIONS) {
48- let variants = packageInfo.variants ?? defaultVariants;
49- variants = (mShort === '42xe') ?
37+ const platformToDetails = {
38+ 'darwin': { displayName: 'MacOS 14 arm64', runOn: 'macos-14-arm64', executableOsId: 'darwin-arm64' },
39+ 'linux': { displayName: 'Ubuntu 20.04 x64', runOn: 'ubuntu2004-small', executableOsId: 'darwin-arm64', tags: ["nightly-driver"]},
40+ 'win32': { displayName: 'Windows', runOn: 'windows-vsCurrent-small', executableOsId: 'win32' },
41+ }
42+ const defaultVariants = ['darwin', 'linux', 'win32'];
43+
44+ for (const { shortName: nShort, versionSpec: nVersion, skipNodeVersionCheck } of NODE_VERSIONS) {
45+ for (const platform of defaultVariants) {
46+ const platformDetails = platformToDetails[platform];
47+ ALL_UNIT_TEST_BUILD_VARIANTS.push({
48+ ...platformDetails,
49+ name: `${platform}-n${nShort}`,
50+ displayName: `${platformDetails.displayName} n${nShort} (Unit tests)`,
51+ id: `${platform}-n${nShort}`,
52+ runWithUnitTestsOnly: true,
53+ tags: platformDetails.tags ?? [],
54+ platform, nShort, nVersion, skipNodeVersionCheck,
55+ });
56+ for (const { shortName: mShort, versionSpec: mVersion } of MONGODB_VERSIONS) {
57+ if (mShort === '42xe' && (platform === 'linux' || platform === 'darwin')) {
5058 // The MongoDB 4.2 enterprise server does not work on Ubuntu 20.04 or arm64 macOS
51- variants.filter(v => v !== 'linux' && v !== 'darwin') :
59+ continue;
60+ }
61+ if (['42xc', '42xe', '44xc', '44xe', '50xc', '50xe'].includes(mShort) && (platform === 'darwin')) {
5262 // Unit tests on macOS use arm64 and therefore require 6.0+
53- (['42xc', '42xe', '44xc', '44xe', '50xc', '50xe'].includes(mShort)) ?
54- variants.filter(v => v !== 'darwin') :
55- variants;
56- const id = `m${mShort}_n${nShort}_${packageInfo.name.replace(/-/g, '_')}`;
57- ALL_UNIT_TESTS.push({
58- id, nShort, nVersion, mShort, mVersion, skipNodeVersionCheck,
59- packageName: packageInfo.name,
60- variants
63+ continue;
64+ }
65+ ALL_UNIT_TEST_BUILD_VARIANTS.push({
66+ ...platformDetails,
67+ name: `tests_${platform}-m${mShort}_n${nShort}`,
68+ id: `${platform}-m${mShort}_n${nShort}`,
69+ runWithUnitTestsOnly: false,
70+ tags: [...(platformDetails.tags ?? []), ...(mShort === 'latest' ? ["mlatest"] : [])],
71+ displayName: `${platformDetails.displayName}${mShort === undefined ? '' : ` m${mShort}`} n${nShort} (Unit tests)`,
72+ platform,
73+ nShort, nVersion, mShort, mVersion, skipNodeVersionCheck,
6174 });
6275 }
63- }
6476 }
6577}
6678
67- const ALL_UNIT_TEST_BUILD_VARIANTS = ['darwin_unit', 'linux_unit', 'win32_unit'];
79+ for (const packageInfo of MONGOSH_PACKAGES) {
80+ const id = `${packageInfo.name.replace(/-/g, '_')}`;
81+
82+ const variants = packageInfo.variants ?? defaultVariants
83+ ALL_UNIT_TESTS.push({
84+ id,
85+ packageName: packageInfo.name,
86+ unitTestsOnly: packageInfo.unitTestsOnly,
87+ variants,
88+ });
89+ }
90+
6891
6992const { RELEASE_PACKAGE_MATRIX } = require('../config/release-package-matrix');
7093
@@ -280,22 +303,24 @@ functions:
280303 content_type: application/x-gzip
281304
282305 check_coverage:
283- <% for (let buildVariant of ALL_UNIT_TEST_BUILD_VARIANTS) {
284- for (let unitTest of ALL_UNIT_TESTS.filter(t => t.variants.includes(buildVariant.replace(/_unit$/, '')))) { %>
306+ <% for (let variant of ALL_UNIT_TEST_BUILD_VARIANTS) {
307+ for (let unitTest of ALL_UNIT_TESTS.filter(t => t.variants.includes(variant.platform) && (!t.unitTestsOnly || (t.unitTestsOnly && variant.runWithUnitTestsOnly)))) {
308+ let buildVariant = variant.id;
309+ %>
285310 - command: s3.get
286311 params:
287312 aws_key: ${aws_key}
288313 aws_secret: ${aws_secret}
289- local_file: src/nyc-output-<% out(buildVariant) %>- <% out(unitTest.id) %>.tgz
290- remote_file: mongosh/binaries/${revision}/${revision_order_id}/nyc-output-<% out(buildVariant) %>- <% out(unitTest.id) %>.tgz
314+ local_file: src/nyc-output-<% out(buildVariant) %>_ <% out(unitTest.id) %>.tgz
315+ remote_file: mongosh/binaries/${revision}/${revision_order_id}/nyc-output-<% out(buildVariant) %>_ <% out(unitTest.id) %>.tgz
291316 bucket: mciuploads
292317 - command: shell.exec
293318 params:
294319 working_dir: src
295320 shell: bash
296321 script: |
297322 set -e
298- tar xvzf nyc-output-<% out(buildVariant) %>- <% out(unitTest.id) %>.tgz
323+ tar xvzf nyc-output-<% out(buildVariant) %>_ <% out(unitTest.id) %>.tgz
299324 <% } } %>
300325 - command: shell.exec
301326 params:
@@ -358,6 +383,8 @@ functions:
358383 shell: bash
359384 env:
360385 NODE_JS_VERSION: ${node_js_version}
386+ DOCKERHUB_USERNAME: ${dockerhub_username}
387+ DOCKERHUB_PASSWORD: ${dockerhub_password}
361388 script: |
362389 set -e
363390 {
@@ -381,6 +408,8 @@ functions:
381408 NODE_JS_VERSION: ${node_js_version}
382409 TEST_MONGOSH_EXECUTABLE: ${test_mongosh_executable|}
383410 KERBEROS_JUMPHOST_DOCKERFILE: ${kerberos_jumphost_dockerfile|}
411+ DOCKERHUB_USERNAME: ${dockerhub_username}
412+ DOCKERHUB_PASSWORD: ${dockerhub_password}
384413 script: |
385414 set -e
386415 {
@@ -610,6 +639,8 @@ functions:
610639 DISTRO_ID_OVERRIDE: ${distro_id}
611640 PACKAGE_VARIANT: ${package_variant}
612641 ARTIFACT_URL_EXTRA_TAG: unsigned
642+ DOCKERHUB_USERNAME: ${dockerhub_username}
643+ DOCKERHUB_PASSWORD: ${dockerhub_password}
613644 sign_artifact:
614645 - command: expansions.write
615646 type: setup
@@ -716,6 +747,8 @@ functions:
716747 shell: bash
717748 env:
718749 NODE_JS_VERSION: ${node_js_version}
750+ DOCKERHUB_USERNAME: ${dockerhub_username}
751+ DOCKERHUB_PASSWORD: ${dockerhub_password}
719752 script: |
720753 set -e
721754 set -x
@@ -730,6 +763,8 @@ functions:
730763 shell: bash
731764 env:
732765 NODE_JS_VERSION: ${node_js_version}
766+ DOCKERHUB_USERNAME: ${dockerhub_username}
767+ DOCKERHUB_PASSWORD: ${dockerhub_password}
733768 script: |
734769 set -e
735770 set -x
@@ -1083,7 +1118,7 @@ tasks:
10831118 - name: check
10841119 depends_on:
10851120 - name: compile_ts
1086- variant: linux_unit
1121+ variant: linux_compile
10871122 commands:
10881123 - func: checkout
10891124 - func: install
@@ -1110,22 +1145,22 @@ tasks:
11101145 # UNIT TESTS
11111146 # E.g. test_m60xc_n20 stands for mongod 6.0.x, community edition, Node.js 20
11121147 ###
1113- <% for (const { id, nShort, nVersion, mShort, mVersion, skipNodeVersionCheck, packageName } of ALL_UNIT_TESTS) { %>
1148+ <% for (const { id, packageName } of ALL_UNIT_TESTS) { %>
11141149 - name: test_<% out(id) %>
1115- tags: <% out(["unit-test ", ...(mShort === 'latest' ? ["mlatest"] : []) ]) %>
1150+ tags: <% out(["assigned_to_jira_team_mongosh_mongosh ", "unit-test" ]) %>
11161151 depends_on:
11171152 - name: compile_ts
1118- variant: linux_unit
1153+ variant: linux_compile
11191154 commands:
11201155 - func: checkout
11211156 - func: install
11221157 vars:
1123- node_js_version: "<% out(nVersion) %>"
1158+ node_js_version: ${node_js_version}
11241159 - func: test
11251160 vars:
1126- mongosh_server_test_version: "<% out(mVersion || '') %>"
1127- node_js_version: "<% out(nVersion) %>"
1128- mongosh_skip_node_version_check: "<% out(skipNodeVersionCheck) %>"
1161+ mongosh_server_test_version: ${mongosh_server_test_version}
1162+ node_js_version: ${node_js_version}
1163+ mongosh_skip_node_version_check: ${mongosh_skip_node_version_check}
11291164 mongosh_test_id: "<% out(id) %>"
11301165 mongosh_run_only_in_package: "<% out(packageName) %>"
11311166 task_name: ${task_name}
@@ -1137,7 +1172,7 @@ tasks:
11371172 - name: test_vscode
11381173 depends_on:
11391174 - name: compile_ts
1140- variant: linux_unit
1175+ variant: linux_compile
11411176 commands:
11421177 - func: checkout
11431178 - func: install
@@ -1148,10 +1183,10 @@ tasks:
11481183 node_js_version: "<% out(NODE_JS_VERSION_20) %>"
11491184 task_name: ${task_name}
11501185 - name: test_connectivity
1151- tags: ["extra-integration-test"]
1186+ tags: ["extra-integration-test", "assigned_to_jira_team_mongosh_mongosh" ]
11521187 depends_on:
11531188 - name: compile_ts
1154- variant: linux_unit
1189+ variant: linux_compile
11551190 commands:
11561191 - func: checkout
11571192 - func: install
@@ -1162,10 +1197,10 @@ tasks:
11621197 node_js_version: "<% out(NODE_JS_VERSION_20) %>"
11631198 task_name: ${task_name}
11641199 - name: test_apistrict
1165- tags: ["extra-integration-test"]
1200+ tags: ["extra-integration-test", "assigned_to_jira_team_mongosh_mongosh" ]
11661201 depends_on:
11671202 - name: compile_ts
1168- variant: linux_unit
1203+ variant: linux_compile
11691204 commands:
11701205 - func: checkout
11711206 - func: install
@@ -1181,7 +1216,7 @@ tasks:
11811216 tags: ["compile-artifact"]
11821217 depends_on:
11831218 - name: compile_ts
1184- variant: linux_unit
1219+ variant: linux_compile
11851220 commands:
11861221 - func: checkout
11871222 - func: install
@@ -1201,7 +1236,7 @@ tasks:
12011236 tags: ["extra-integration-test"]
12021237 depends_on:
12031238 - name: compile_ts
1204- variant: linux_unit
1239+ variant: linux_compile
12051240 commands:
12061241 - func: checkout
12071242 - func: install
@@ -1493,7 +1528,7 @@ tasks:
14931528 exec_timeout_secs: 86400
14941529 depends_on:
14951530 - name: compile_ts
1496- variant: linux_unit
1531+ variant: linux_compile
14971532 commands:
14981533 - func: checkout
14991534 - func: install
@@ -1511,16 +1546,21 @@ tasks:
15111546
15121547# Need to run builds for every possible build variant.
15131548buildvariants:
1514- - name: darwin_unit
1515- display_name: "MacOS 14 arm64 (Unit tests)"
1516- run_on: macos-14-arm64
1549+ <% for (const variant of ALL_UNIT_TEST_BUILD_VARIANTS) { %>
1550+ - name: <% out(variant.name) %>
1551+ display_name: "<% out(variant.displayName) %>"
1552+ run_on: <% out(variant.runOn) %>
1553+ tags: <% out(variant.tags) %>
15171554 expansions:
1518- executable_os_id: darwin-arm64
1555+ executable_os_id: <% out(variant.executableOsId) %>
1556+ mongosh_server_test_version: "<% out(variant.mVersion || '') %>"
1557+ node_js_version: "<% out(variant.nVersion) %>"
1558+ mongosh_skip_node_version_check: "<% out(variant.skipNodeVersionCheck) %>"
15191559 tasks:
1520- - name: check
1521- <% for (const test of ALL_UNIT_TESTS.filter(t => t.variants.includes('darwin'))) { %>
1560+ <% for (const test of ALL_UNIT_TESTS.filter(test => test.variants.includes(variant.platform))) { %>
15221561 - name: test_<% out(test.id) %>
15231562 <% } %>
1563+ <% } %>
15241564 - name: darwin
15251565 display_name: "MacOS Big Sur"
15261566 run_on: macos-11
@@ -1542,21 +1582,23 @@ buildvariants:
15421582 - name: compile_artifact
15431583 - name: e2e_tests_darwin_arm64
15441584
1545- - name: linux_unit
1546- display_name: "Ubuntu 20.04 x64 (Unit tests )"
1585+ - name: linux_compile
1586+ display_name: "Ubuntu 20.04 x64 (Compile and Check )"
15471587 run_on: ubuntu2004-small
15481588 tags: ["nightly-driver"]
15491589 tasks:
15501590 - name: compile_ts
15511591 - name: check
1552- <% for (const test of ALL_UNIT_TESTS.filter(t => t.variants.includes('linux'))) { %>
1553- - name: test_<% out(test.id) %>
1554- <% } %>
1592+ - name: linux_other
1593+ display_name: "Ubuntu 20.04 x64 (Other Tests)"
1594+ run_on: ubuntu2004-small
1595+ tags: ["nightly-driver"]
1596+ tasks:
15551597 - name: test_vscode
15561598 - name: test_connectivity
15571599 - name: test_apistrict
15581600 - name: linux_coverage
1559- display_name: "Coverage and Static Analysis Check"
1601+ display_name: "Ubuntu 20.04 x64 ( Coverage and Static Analysis Check) "
15601602 run_on: ubuntu2004-small
15611603 tasks:
15621604 - name: check_coverage
@@ -1892,17 +1934,6 @@ buildvariants:
18921934 executable_os_id: darwin-arm64
18931935 tasks:
18941936 - name: e2e_tests_darwin_arm64
1895-
1896- - name: win32_unit
1897- display_name: "Windows (Unit tests)"
1898- run_on: windows-vsCurrent-small
1899- expansions:
1900- executable_os_id: win32
1901- tasks:
1902- - name: check
1903- <% for (const test of ALL_UNIT_TESTS.filter(t => t.variants.includes('win32'))) { %>
1904- - name: test_<% out(test.id) %>
1905- <% } %>
19061937 - name: win32
19071938 display_name: "Windows VS 2022"
19081939 run_on: windows-vsCurrent-small
0 commit comments