Skip to content

Commit 9a9b2bb

Browse files
authored
fix(hadron-build, compass): restore Isolated and Readonly special behavior in packaged application COMPASS-8129 (#6147)
* fix(hadron-build): make sure that target gets the distribution in CI consistently * chore(ci): add missing HADRON_DISTRIBUTION env to coverage, multiple-connections, gen-vuln-check tasks * chore(hadron-build): fix tests * chore(hadron-build): account for distribution being passed to the Target constructor options * fix(hadron-build): includes not has * chore(hadron-build): update test
1 parent 0616adf commit 9a9b2bb

File tree

16 files changed

+34
-121
lines changed

16 files changed

+34
-121
lines changed

.evergreen/compass_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [[ "$OSTYPE" == "cygwin" ]]; then
88
fi
99

1010
echo "Creating signed release build..."
11-
npm run package-compass-nocompile $COMPASS_DISTRIBUTION
11+
npm run package-compass-nocompile
1212
npm run generate-first-party-deps-json
1313

1414
ls -la packages/compass/dist

.evergreen/functions.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,13 @@ functions:
301301
shell: bash
302302
env:
303303
<<: *compass-env
304+
HADRON_DISTRIBUTION: ${compass_distribution}
304305
script: |
305306
set -e
306307
# Load environment variables
307308
eval $(.evergreen/print-compass-env.sh)
308309
# Generates and expansion file with build target metadata in packages/compass/expansions.yml
309-
npm run --workspace mongodb-compass build-info -- ${target_platform} ${target_arch} --format=yaml --flatten ${compass_distribution} --out expansions.raw.yml
310+
npm run --workspace mongodb-compass build-info -- ${target_platform} ${target_arch} --format=yaml --flatten --out expansions.raw.yml
310311
# the 'author' key conflicts with evergreen's own expansion
311312
grep -v '^author:' < packages/compass/expansions.raw.yml > packages/compass/expansions.yml
312313
- command: expansions.update
@@ -405,7 +406,7 @@ functions:
405406
<<: *compass-env
406407
DEBUG: ${debug}
407408
npm_config_loglevel: ${npm_loglevel}
408-
COMPASS_DISTRIBUTION: ${compass_distribution}
409+
HADRON_DISTRIBUTION: ${compass_distribution}
409410
script: |
410411
set -e
411412
@@ -443,7 +444,7 @@ functions:
443444
<<: *compass-env
444445
DEBUG: ${debug}
445446
npm_config_loglevel: ${npm_loglevel}
446-
COMPASS_DISTRIBUTION: ${compass_distribution}
447+
HADRON_DISTRIBUTION: ${compass_distribution}
447448
SIGNING_SERVER_HOSTNAME: ${SIGNING_SERVER_HOSTNAME}
448449
SIGNING_SERVER_PRIVATE_KEY: ${SIGNING_SERVER_PRIVATE_KEY}
449450
SIGNING_SERVER_PRIVATE_KEY_CYGPATH: ${SIGNING_SERVER_PRIVATE_KEY_CYGPATH}
@@ -586,6 +587,7 @@ functions:
586587
E2E_TEST_GROUPS: ${e2e_test_groups}
587588
E2E_TEST_GROUP: ${e2e_test_group}
588589
ATLAS_LOCAL_VERSION: latest
590+
HADRON_DISTRIBUTION: compass
589591
script: |
590592
set -e
591593
# Load environment variables
@@ -614,6 +616,7 @@ functions:
614616
MONGODB_RUNNER_VERSION: ${mongodb_version|}
615617
E2E_TEST_GROUPS: ${e2e_test_groups}
616618
E2E_TEST_GROUP: ${e2e_test_group}
619+
HADRON_DISTRIBUTION: compass
617620
script: |
618621
set -e
619622
# Load environment variables
@@ -623,7 +626,6 @@ functions:
623626
624627
npm run --unsafe-perm --workspace compass-e2e-tests test-ci -- -- --test-multiple-connections
625628
626-
627629
test-packaged-app:
628630
- command: shell.exec
629631
# Fail the task if it's idle for 10 mins
@@ -946,6 +948,7 @@ functions:
946948
DEBUG: ${debug}
947949
SNYK_TOKEN: ${snyk_token}
948950
JIRA_API_TOKEN: ${jira_api_token}
951+
HADRON_DISTRIBUTION: compass
949952
script: |
950953
set -e
951954
# Load environment variables

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ In addition to running lerna commands directly, there are a few convenient npm s
5656
To build compass you can run `package-compass` script:
5757

5858
```sh
59-
npm run package-compass
59+
HADRON_DISTRIBUTION='compass' npm run package-compass
6060
```
6161

62-
You can change the type of distribution you are building with `HADRON_DISTRIBUTION` environmental variable:
62+
It is required to provide `HADRON_DISTRIBUTION` env variable explicitly. You can change the type of distribution you are building by setting a different `HADRON_DISTRIBUTION` value:
6363

6464
```sh
6565
HADRON_DISTRIBUTION='compass-readonly' npm run package-compass

package-lock.json

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"release": "npm run release --workspace mongodb-compass --",
2929
"reformat": "lerna run reformat --stream --no-bail",
3030
"package-compass": "npm run package-compass --workspace=mongodb-compass --",
31+
"package-compass-debug": "npm run package-compass-debug --workspace=mongodb-compass --",
3132
"package-compass-nocompile": "npm run package-compass-nocompile --workspace=mongodb-compass --",
3233
"prestart": "npm run compile --workspace=@mongodb-js/webpack-config-compass",
3334
"prestart-web": "npm run prestart",

packages/compass/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
}
3232
],
3333
"distributions": {
34-
"default": "compass",
3534
"compass": {
3635
"name": "mongodb-compass",
3736
"productName": "MongoDB Compass",
@@ -143,7 +142,7 @@
143142
"install": "node scripts/download-fonts.js && node scripts/download-csfle.js",
144143
"electron-rebuild": "electron-rebuild --only kerberos,keytar,interruptor,os-dns-native,win-export-certificate-and-key,macos-export-certificate-and-key --prebuild-tag-prefix not-real-prefix-to-force-rebuild",
145144
"prestart": "npm run electron-rebuild",
146-
"start": "npm run webpack serve -- --mode development",
145+
"start": "HADRON_DISTRIBUTION=${HADRON_DISTRIBUTION:-compass} npm run webpack serve -- --mode development",
147146
"test-electron": "npm run test-main && npm run test-renderer",
148147
"test-main": "xvfb-maybe electron-mocha --no-sandbox \"./src/main/**/*.spec.*\" \"./src/main/**/*.test.*\"",
149148
"test-renderer": "xvfb-maybe electron-mocha --no-sandbox --config ./.mocharc.renderer.js \"./src/app/**/*.spec.*\"",
@@ -158,7 +157,7 @@
158157
"package-compass-nocompile": "hadron-build release",
159158
"prepackage-compass": "npm run compile",
160159
"package-compass": "npm run package-compass-nocompile",
161-
"package-compass-debug": "DEBUG='*' HADRON_SKIP_INSTALLER=true NO_ASAR=true npm run package-compass",
160+
"package-compass-debug": "DEBUG='hadron*,compass*' HADRON_SKIP_INSTALLER=true NO_ASAR=true npm run package-compass",
162161
"upload": "hadron-build upload",
163162
"download": "hadron-build download",
164163
"evergreen-expansions": "hadron-build info --format=yaml --flatten > expansions.yml",

packages/hadron-build/cli.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const yargs = require('yargs')
1111
.command(require('./commands/info'))
1212
.command(require('./commands/upload'))
1313
.command(require('./commands/download'))
14-
.command(require('./commands/verify'))
1514
.demand(1, 'Please specify a command.')
1615
.strict()
1716
.env()

packages/hadron-build/commands/info.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
const _ = require('lodash');
33
const Target = require('../lib/target');
4-
const verifyDistro = require('../lib/distro');
54
const Table = require('cli-table');
65
const yaml = require('js-yaml');
76
const inspect = require('util').inspect;
@@ -74,8 +73,6 @@ const toTable = (target) => {
7473
};
7574

7675
exports.handler = (argv) => {
77-
verifyDistro(argv);
78-
7976
let target = new Target(argv.dir, {
8077
version: argv.version,
8178
platform: argv.platform,

packages/hadron-build/commands/release.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
const Target = require('../lib/target');
18-
const verifyDistro = require('../lib/distro');
1918
const cli = require('mongodb-js-cli')('hadron-build:release');
2019
const util = require('util');
2120
const format = util.format;
@@ -30,8 +29,6 @@ const run = require('./../lib/run');
3029
const rebuild = require('@electron/rebuild').rebuild;
3130
const { signArchive } = require('./../lib/signtool');
3231

33-
const verify = require('./verify');
34-
3532
exports.command = 'release';
3633

3734
exports.describe = ':shipit:';
@@ -514,8 +511,6 @@ exports.builder = {
514511
}
515512
};
516513

517-
_.assign(exports.builder, verify.builder);
518-
519514

520515
/**
521516
* @param {any} argv Parsed command arguments
@@ -525,8 +520,6 @@ _.assign(exports.builder, verify.builder);
525520
exports.run = async (argv, done) => {
526521
cli.argv = argv;
527522

528-
verifyDistro(argv);
529-
530523
const target = new Target(argv.dir);
531524

532525
cli.debug(`Building distribution: ${target.distribution}`);
@@ -551,7 +544,6 @@ exports.run = async (argv, done) => {
551544
const noAsar = process.env.NO_ASAR === 'true' || argv.no_asar;
552545

553546
const tasks = _.flatten([
554-
() => verify.tasks(argv),
555547
task('copy npmrc from root', ({ dir }, done) => {
556548
fs.cp(
557549
path.resolve(dir, '..', '..', '.npmrc'),

packages/hadron-build/commands/verify.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)