Ver código fonte

Backport PR #11249: Fix Webpack crypto handling (#11251)

Co-authored-by: Steven Silvester <ssilvester@apple.com>
MeeseeksMachine 3 anos atrás
pai
commit
a7f3fc2de2

+ 3 - 3
.github/workflows/linuxtests.yml

@@ -13,10 +13,10 @@ jobs:
     name: Linux
     strategy:
       matrix:
-        group: [integrity, integrity2, integrity3, release_check, docs, usage, usage2, splice_source, python, examples, interop, nonode, linkcheck, lint]
+        group: [integrity, integrity2, integrity3, release_test, docs, usage, usage2, splice_source, python, examples, interop, nonode, linkcheck, lint]
         python: [3.6, 3.8]
         include:
-          - group: release_check
+          - group: release_test
             upload-output: true
         exclude:
           - group: integrity
@@ -25,7 +25,7 @@ jobs:
             python: 3.6
           - group: integrity3
             python: 3.6
-          - group: release_check
+          - group: release_test
             python: 3.6
           - group: docs
             python: 3.6

+ 2 - 1
builder/src/build.ts

@@ -198,7 +198,8 @@ export namespace Build {
         output: {
           path: path.resolve(path.join(themeOutput, 'themes', name)),
           // we won't use these JS files, only the extracted CSS
-          filename: '[name].js'
+          filename: '[name].js',
+          hashFunction: 'sha256'
         },
         module: {
           rules: [

+ 6 - 0
builder/src/webpack.config.base.ts

@@ -3,6 +3,12 @@
 
 import * as path from 'path';
 import * as webpack from 'webpack';
+import crypto from 'crypto';
+
+// Workaround for loaders using "md4" by default, which is not supported in FIPS-compliant OpenSSL
+const cryptoOrigCreateHash = crypto.createHash;
+crypto.createHash = (algorithm: string) =>
+  cryptoOrigCreateHash(algorithm == 'md4' ? 'sha256' : algorithm);
 
 const rules = [
   { test: /\.css$/, use: ['style-loader', 'css-loader'] },

+ 1 - 1
buildutils/src/ensure-repo.ts

@@ -42,7 +42,7 @@ const URL_CONFIG = {
 const MISSING: Dict<string[]> = {
   '@jupyterlab/coreutils': ['path'],
   '@jupyterlab/buildutils': ['path', 'webpack'],
-  '@jupyterlab/builder': ['path'],
+  '@jupyterlab/builder': ['path', 'crypto'],
   '@jupyterlab/galata': ['fs', 'path'],
   '@jupyterlab/testutils': ['fs', 'path'],
   '@jupyterlab/vega5-extension': ['vega-embed']

+ 1 - 1
dev_mode/package.json

@@ -4,7 +4,7 @@
   "private": true,
   "license": "BSD-3-Clause",
   "scripts": {
-    "build": "npm run clean && webpack",
+    "build": "cat package.json && npm run clean && webpack",
     "build:dev": "npm run build",
     "build:prod": "webpack --config webpack.prod.config.js",
     "build:prod:minimize": "webpack --config webpack.prod.minimize.config.js",

+ 5 - 0
scripts/ci_install.sh

@@ -15,6 +15,10 @@ fi
 # create jupyter base dir (needed for config retrieval)
 mkdir ~/.jupyter
 
+# Set up git config
+git config --global user.name foo
+git config --global user.email foo@bar.com
+
 # Install and enable the server extension
 pip install -q --upgrade pip --user
 pip --version
@@ -29,6 +33,7 @@ jupyter serverextension list 1>serverextensions 2>&1
 cat serverextensions
 cat serverextensions | grep -i "jupyterlab.*enabled"
 cat serverextensions | grep -i "jupyterlab.*OK"
+rm serverextensions
 
 if [[ $GROUP == integrity ]]; then
     pip install notebook==4.3.1

+ 10 - 9
scripts/ci_script.sh

@@ -133,18 +133,19 @@ if [[ $GROUP == integrity3 ]]; then
 fi
 
 
-if [[ $GROUP == release_check ]]; then
-    jlpm run publish:js --dry-run
-    jlpm run prepare:python-release
-    ./scripts/release_test.sh
+if [[ $GROUP == release_test ]]; then
+    # bump the version
+    git checkout -b test HEAD
+    jlpm bumpversion next --force
 
-    # Prep for using verdaccio during publish
+    # Use verdaccio during publish
     node buildutils/lib/local-repository.js start
     npm whoami
-    pushd packages/application
-    npm version patch
-    npm publish
-    popd
+
+    jlpm run publish:js --yes
+    jlpm run prepare:python-release
+    cat jupyterlab/staging/package.json
+    ./scripts/release_test.sh
     node buildutils/lib/local-repository.js stop
 fi
 

+ 9 - 9
scripts/release_test.sh

@@ -18,20 +18,20 @@ conda activate "$JLAB_TEST_ENV"
 python -m pip install $(ls dist/*.whl)
 
 cp examples/notebooks/*.ipynb $TEST_DIR/
+cp -r jupyterlab/tests/mock_packages $TEST_DIR
 
 pushd $TEST_DIR
 
-JLAB_BROWSER_CHECK_OUTPUT=${OUTPUT_DIR} python -m jupyterlab.browser_check
-
-popd
+ls -ltr
 
-pushd jupyterlab/tests/mock_packages
-jupyter labextension install mimeextension --no-build --debug
-jupyter labextension develop extension
-jupyter labextension build extension
-popd
+JLAB_BROWSER_CHECK_OUTPUT=${OUTPUT_DIR} python -m jupyterlab.browser_check
 
-pushd $TEST_DIR
+# Remove node_modules to get a clean directory and build the extensions
+rm -rf ./mock_packages/mimeextension/node_modules
+rm -rf ./mock_packages/extension/node_modules
+jupyter labextension install ./mock_packages/mimeextension --no-build --debug
+jupyter labextension develop ./mock_packages/extension --debug
+jupyter labextension build ./mock_packages/extension --debug
 
 conda install --override-channels --strict-channel-priority -c conda-forge -c nodefaults -y ipywidgets altair matplotlib-base vega_datasets jupyterlab_widgets