build: add crypto check to markdown lint target#21326
build: add crypto check to markdown lint target#21326danbev wants to merge 6 commits intonodejs:masterfrom
Conversation
Currently, if configured --without-ssl the following error will be
repored by remark-cli:
Running Markdown linter on misc docs...
internal/util.js:100
throw new ERR_NO_CRYPTO();
^
Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support
at assertCrypto (internal/util.js:100:11)
at crypto.js:31:1
at NativeModule.compile (internal/bootstrap/loaders.js:235:7)
at Function.NativeModule.require
(internal/bootstrap/loaders.js:155:18)
at Function.Module._load (internal/modules/cjs/loader.js:530:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous>
(/node/tools/remark-cli/node_modules/math-random/node.js:1:76)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:713:10)
make[1]: *** [tools/.miscmdlintstamp] Error 1
make: *** [lint] Error 2
This commit adds a check for crypto to avoid this error when node has
been configured without crypto support. The alternative was to try to
fix this in randomatic but that lead to another dependency failing
(uuid) and felt like this might be simpler.
Makefile
Outdated
| run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) | ||
| # Lint all changed markdown files under doc/ | ||
| tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) | ||
| ifeq ("$(HAS_CRYPTO)", "true") |
There was a problem hiding this comment.
Slightly more idiomatic: ifeq ($(HAS_CRYPTO),true)
There was a problem hiding this comment.
I'll update this shortly.
configure
Outdated
| 'BUILDTYPE': 'Debug' if options.debug else 'Release', | ||
| 'PYTHON': sys.executable, | ||
| 'NODE_TARGET_TYPE': variables['node_target_type'], | ||
| 'HAS_CRYPTO': variables['node_use_openssl'], |
There was a problem hiding this comment.
I'd call this NODE_USE_OPENSSL for consistency with NODE_TARGET_TYPE (and also grep -i greppability.)
There was a problem hiding this comment.
I'll change this as well. Thanks
richardlau
left a comment
There was a problem hiding this comment.
So this is causing the linter jobs (both on Travis and the CI) to skip doc linting:
https://travis-ci.com/nodejs/node/jobs/129356058
https://ci.nodejs.org/blue/rest/organizations/jenkins/pipelines/node-linter/runs/27/nodes/25/log/?start=0
$ NODE=$(which node) make lint-ci
Running JS linter...
Running C++ linter...
Total errors found: 0
Skipping Markdown linter on misc docs (no crypto)
Skipping Markdown linter on docs (no crypto)
The lint jobs use an existing Node.js binary.
|
I’ll take a look. Thanks
tors 14 juni 2018 kl. 16:04 skrev Richard Lau <notifications@github.com>:
… ***@***.**** requested changes on this pull request.
So this is causing the linter jobs (both on Travis and the CI) to skip doc
linting:
https://travis-ci.com/nodejs/node/jobs/129356058
https://ci.nodejs.org/blue/rest/organizations/jenkins/pipelines/node-linter/runs/27/nodes/25/log/?start=0
$ NODE=$(which node) make lint-ci
Running JS linter...
Running C++ linter...
Total errors found: 0
Skipping Markdown linter on misc docs (no crypto)
Skipping Markdown linter on docs (no crypto)
The lint jobs use an existing Node.js binary.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21326 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAaY37nWro8IZq3zR22qwb8lA-dcSLL2ks5t8m1ygaJpZM4UnZs4>
.
|
The lint task my be run without configure being run in which case there will be no config.mk. The value is set to true as this would be the most common configuration I think.
richardlau
left a comment
There was a problem hiding this comment.
Travis linter now works: https://travis-ci.com/nodejs/node/jobs/129401932
|
@richardlau I think I'm looking at the correct log and it looks like it is not skipping anymore. |
Makefile
Outdated
| run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) | ||
| # Lint all changed markdown files under doc/ | ||
| tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) | ||
| ifeq ($(NODE_USE_OPENSSL),true) |
There was a problem hiding this comment.
Since this step anyway requires an existing node binary, why not simply test @$(call available-node,"-p require('crypto')"). Then you can remove all the other "breadcrumbs".
There was a problem hiding this comment.
Or -p process.config.variables.node_use_openssl
There was a problem hiding this comment.
Good point, it would be safer to do that as the existing node binary might have been compiled without openssl (might not be the common case but could happen). I'll take a look and update. Thanks
This commit checks the node environment to determine if openssl (crypto) support if available.
|
@refack Would you be able to take a look at the latest commit and see what you think? Thanks |
|
/CC @nodejs/build-files |
|
Landed in 6ced651. |
Currently, if configured --without-ssl the following error will be
repored by remark-cli:
Running Markdown linter on misc docs...
internal/util.js:100
throw new ERR_NO_CRYPTO();
^
Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support
at assertCrypto (internal/util.js:100:11)
at crypto.js:31:1
at NativeModule.compile (internal/bootstrap/loaders.js:235:7)
at Function.NativeModule.require
(internal/bootstrap/loaders.js:155:18)
at Function.Module._load (internal/modules/cjs/loader.js:530:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous>
(/node/tools/remark-cli/node_modules/math-random/node.js:1:76)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:713:10)
make[1]: *** [tools/.miscmdlintstamp] Error 1
make: *** [lint] Error 2
This commit adds a check for crypto to avoid this error when node has
been configured without crypto support. The alternative was to try to
fix this in randomatic but that lead to another dependency failing
(uuid) and felt like this might be simpler.
PR-URL: #21326
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, if configured --without-ssl the following error will be
repored by remark-cli:
Running Markdown linter on misc docs...
internal/util.js:100
throw new ERR_NO_CRYPTO();
^
Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support
at assertCrypto (internal/util.js:100:11)
at crypto.js:31:1
at NativeModule.compile (internal/bootstrap/loaders.js:235:7)
at Function.NativeModule.require
(internal/bootstrap/loaders.js:155:18)
at Function.Module._load (internal/modules/cjs/loader.js:530:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous>
(/node/tools/remark-cli/node_modules/math-random/node.js:1:76)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:713:10)
make[1]: *** [tools/.miscmdlintstamp] Error 1
make: *** [lint] Error 2
This commit adds a check for crypto to avoid this error when node has
been configured without crypto support. The alternative was to try to
fix this in randomatic but that lead to another dependency failing
(uuid) and felt like this might be simpler.
PR-URL: #21326
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, if configured
--without-sslthe following error will berepored by remark-cli:
Running Markdown linter on misc docs... internal/util.js:100 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:100:11) at crypto.js:31:1 at NativeModule.compile (internal/bootstrap/loaders.js:235:7) at Function.NativeModule.require (internal/bootstrap/loaders.js:155:18) at Function.Module._load (internal/modules/cjs/loader.js:530:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (/node/tools/remark-cli/node_modules/math-random/node.js:1:76) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) make[1]: *** [tools/.miscmdlintstamp] Error 1 make: *** [lint] Error 2This commit adds a check for crypto to avoid this error when node has
been configured without crypto support. The alternative was to try to
fix this in randomatic but that lead to another dependency failing
(uuid) and felt like this might be simpler.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes